de.fau.cs.www8.jadeowlcodec.tool
Class Helper

java.lang.Object
  extended by de.fau.cs.www8.jadeowlcodec.tool.Helper

public class Helper
extends java.lang.Object


Nested Class Summary
static class Helper.KeyValue<K,V>
          Helper class for addRelation method
static class Helper.SimpleIterator<T>
          Base class for a simple Iterator that does not support removal
 
Field Summary
static java.lang.String OWL_NS
           
static java.lang.String OWL_THING
           
 
Constructor Summary
Helper()
           
 
Method Summary
static java.lang.Iterable<Helper.KeyValue<java.lang.String,java.lang.String>> attributeIterableBlackList(org.w3c.dom.Element e, java.lang.String[] blackList)
          get an Iterator over all the attributes whose name is not in the given blacklist
static jade.lang.acl.ACLMessage createOWLCodecACLMessage(int performative)
           
static java.lang.String dumpNode(org.w3c.dom.Node doc)
           
static byte[] dumpNodeByteArray(org.w3c.dom.Node doc)
           
static java.lang.Iterable<org.w3c.dom.Element> elementIterable(org.w3c.dom.Element e)
          get an Iterator over all the (direct) child elements of a DOM Element
static java.lang.Iterable<org.w3c.dom.Element> elementIterable(org.w3c.dom.Element e, java.lang.String tagName)
          get an Iterator over all the (direct) child elements with a given tagname of a DOM Element
static java.lang.Iterable<org.w3c.dom.Element> elementIterableBlackList(org.w3c.dom.Element e, java.lang.String[] blackList)
          get an Iterator over all the (direct) child elements whose tagname is not in the given blacklist
static java.lang.Iterable<org.w3c.dom.Element> elementIterableWhiteList(org.w3c.dom.Element e, java.lang.String[] whiteList)
          get an Iterator over all the (direct) child elements whose tagname is in the given whitelist
static java.util.LinkedList<org.w3c.dom.Element> getElementsByTagName(org.w3c.dom.Element e, java.lang.String name, boolean recurse)
           
static java.util.LinkedList<org.w3c.dom.Element> getElementsByTagNameFirstLevel(org.w3c.dom.Element e, java.lang.String name)
           
static java.util.LinkedList<org.w3c.dom.Element> getElementsByTagNameRecursive(org.w3c.dom.Element e, java.lang.String name)
           
static org.w3c.dom.Element getEnclosingElement(org.w3c.dom.Node n, java.util.Collection<java.lang.String> tagNames)
           
static org.w3c.dom.Element getEnclosingElement(org.w3c.dom.Node n, java.lang.String tagName)
           
static org.w3c.dom.Element getFirstContainedElement(org.w3c.dom.Node root, java.lang.String tagName)
           
static java.lang.String getFullNameFromAttributes(org.w3c.dom.Element e)
           
static java.lang.String getIndentation(int indentation)
           
static java.lang.String getOWLCodecBasePackackeName()
           
static Uri.Other getOWLCodecBaseURI()
           
static org.w3c.dom.Element getParentElement(org.w3c.dom.Node n)
           
static
<T> java.lang.String
getUniqueIn(T desiredName, java.util.Set<T> existingSet)
          find a name based on desiredName that is unique within existingSet type T can be anything that has a working toString
static java.lang.String manuallyDumpElement(org.w3c.dom.Element e)
          dump an element to string using a crude, dumbed down internal serialization method useful for getting subtrees
static void manuallyDumpElement(org.w3c.dom.Element e, java.io.StringWriter sw, int indent)
           
static java.lang.String mnemonicFromUri(Uri uri)
           
static org.w3c.dom.Node nextElementSibling(org.w3c.dom.Node n)
          find the next sibling of n that is a Node.ELEMENT_NODE
static java.lang.String tabText(java.lang.String s)
          Add n*'\t' before every line, for better debug output
static java.lang.String tabText(java.lang.String s, int n)
          Add n*'\t' before every line, for better debug output
static int tryParseInputInt(java.io.BufferedReader buff)
           
static java.lang.String xmlEscape(java.lang.Object o)
          escape string for containing it inside an xml attribute or elements
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OWL_NS

public static final java.lang.String OWL_NS
See Also:
Constant Field Values

OWL_THING

public static final java.lang.String OWL_THING
See Also:
Constant Field Values
Constructor Detail

Helper

public Helper()
Method Detail

getIndentation

public static java.lang.String getIndentation(int indentation)

getUniqueIn

public static <T> java.lang.String getUniqueIn(T desiredName,
                                               java.util.Set<T> existingSet)
find a name based on desiredName that is unique within existingSet type T can be anything that has a working toString

Parameters:
desiredName - a name that might already be taken
existingSet - set of names that are already taken
Returns:
desired name or a new name that is not in set

manuallyDumpElement

public static java.lang.String manuallyDumpElement(org.w3c.dom.Element e)
dump an element to string using a crude, dumbed down internal serialization method useful for getting subtrees

Parameters:
e -
Returns:
String(representation) of an element

manuallyDumpElement

public static void manuallyDumpElement(org.w3c.dom.Element e,
                                       java.io.StringWriter sw,
                                       int indent)

dumpNode

public static java.lang.String dumpNode(org.w3c.dom.Node doc)

dumpNodeByteArray

public static byte[] dumpNodeByteArray(org.w3c.dom.Node doc)

mnemonicFromUri

public static java.lang.String mnemonicFromUri(Uri uri)

nextElementSibling

public static org.w3c.dom.Node nextElementSibling(org.w3c.dom.Node n)
find the next sibling of n that is a Node.ELEMENT_NODE

Parameters:
n - node
Returns:
next sibling that is an element, or null

getParentElement

public static org.w3c.dom.Element getParentElement(org.w3c.dom.Node n)

getEnclosingElement

public static org.w3c.dom.Element getEnclosingElement(org.w3c.dom.Node n,
                                                      java.lang.String tagName)

getEnclosingElement

public static org.w3c.dom.Element getEnclosingElement(org.w3c.dom.Node n,
                                                      java.util.Collection<java.lang.String> tagNames)

getFirstContainedElement

public static org.w3c.dom.Element getFirstContainedElement(org.w3c.dom.Node root,
                                                           java.lang.String tagName)

xmlEscape

public static java.lang.String xmlEscape(java.lang.Object o)
escape string for containing it inside an xml attribute or elements


getElementsByTagName

public static java.util.LinkedList<org.w3c.dom.Element> getElementsByTagName(org.w3c.dom.Element e,
                                                                             java.lang.String name,
                                                                             boolean recurse)

getElementsByTagNameRecursive

public static java.util.LinkedList<org.w3c.dom.Element> getElementsByTagNameRecursive(org.w3c.dom.Element e,
                                                                                      java.lang.String name)

getElementsByTagNameFirstLevel

public static java.util.LinkedList<org.w3c.dom.Element> getElementsByTagNameFirstLevel(org.w3c.dom.Element e,
                                                                                       java.lang.String name)

createOWLCodecACLMessage

public static jade.lang.acl.ACLMessage createOWLCodecACLMessage(int performative)

getFullNameFromAttributes

public static java.lang.String getFullNameFromAttributes(org.w3c.dom.Element e)

getOWLCodecBaseURI

public static Uri.Other getOWLCodecBaseURI()

getOWLCodecBasePackackeName

public static java.lang.String getOWLCodecBasePackackeName()

elementIterable

public static java.lang.Iterable<org.w3c.dom.Element> elementIterable(org.w3c.dom.Element e)
get an Iterator over all the (direct) child elements of a DOM Element

Parameters:
e - the Element whose children will be iterated
Returns:
Iterator iterating over all the child Elements of e

elementIterable

public static java.lang.Iterable<org.w3c.dom.Element> elementIterable(org.w3c.dom.Element e,
                                                                      java.lang.String tagName)
get an Iterator over all the (direct) child elements with a given tagname of a DOM Element

Parameters:
e - the Element whose children will be iterated
tagName - the name of the child Elements that will be iterated
Returns:
Iterator iterating over the child Elements of e with name tagName

elementIterableWhiteList

public static java.lang.Iterable<org.w3c.dom.Element> elementIterableWhiteList(org.w3c.dom.Element e,
                                                                               java.lang.String[] whiteList)
get an Iterator over all the (direct) child elements whose tagname is in the given whitelist

Parameters:
e - the Element whose children will be iterated
whiteList - array containing the child Element tagnames that will be iterated over
Returns:
Iterator iterating over the child Elements of e whose name is in whiteList

elementIterableBlackList

public static java.lang.Iterable<org.w3c.dom.Element> elementIterableBlackList(org.w3c.dom.Element e,
                                                                               java.lang.String[] blackList)
get an Iterator over all the (direct) child elements whose tagname is not in the given blacklist

Parameters:
e - the Element whose children will be iterated
blackList - array containing the child Element tagnames that will not be iterated over
Returns:
Iterator iterating over the child Elements of e whose name is not in blackList

tabText

public static java.lang.String tabText(java.lang.String s)
Add n*'\t' before every line, for better debug output

Parameters:
s - String to tab
Returns:
tabbed String

tabText

public static java.lang.String tabText(java.lang.String s,
                                       int n)
Add n*'\t' before every line, for better debug output

Parameters:
s - String to tab
Returns:
tabbed String

attributeIterableBlackList

public static java.lang.Iterable<Helper.KeyValue<java.lang.String,java.lang.String>> attributeIterableBlackList(org.w3c.dom.Element e,
                                                                                                                java.lang.String[] blackList)
get an Iterator over all the attributes whose name is not in the given blacklist

Parameters:
e - the Element whose attibutes will be iterated
blackList - array containing the attribute names that will not be iterated over
Returns:
Iterator iterating over the attributes of e whose name is not in blackList

tryParseInputInt

public static int tryParseInputInt(java.io.BufferedReader buff)
                            throws java.io.IOException
Throws:
java.io.IOException


Copyright 2007 Moritz Goeb, Bernhard Schiemann, Ulf Schreiber of Chair of Artificial Intelligence, University of Erlangen-Nuremberg