|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
pt.tumba.geoclass.GKBParser
public class GKBParser
A SAX2 event handler class, used for parsing RDF data from our geographical knowledge base (GKB). Essentially, the knowledge base contains information about geographical features, encoded in the form of an OWL ontology.
The ontology uses a semantic location model where concepts are defined relativelly to given universes of discourse (i.e. architecture, physical geography, political geography or city planning). This perspective is to link a mathematical definition of position (i.e. a geometric model) to a more human freiendly notion of place.
The data parsed from the RDF file is used both for recognizing named entities in text, and for building a probabilistic graphical model of geographical concepts, which is latter used to help in classifying web pages according to their geographical scopes.
Constructor Summary | |
---|---|
GKBParser()
Constructor for GKBParser. |
|
GKBParser(java.io.PrintStream output)
Constructor for GKBParser. |
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
Receive notification of character data inside an element. |
void |
endElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName)
Receive notification of the end of an element. |
static ClassNetwork |
getClassNetwork(java.io.File file)
Returns a network of geographical features parsed from a given RDF file. |
static ClassNetwork |
getClassNetwork(java.io.File file,
java.io.PrintStream output)
Returns a network of geographical features parsed from a given RDF file. |
static ClassNetwork |
getClassNetwork(java.lang.String file)
Returns a network of geographical features parsed from a given RDF file. |
static ClassNetwork |
getClassNetwork(java.lang.String file,
java.io.PrintStream output)
Returns a network of geographical features parsed from a given RDF file. |
static java.util.Map |
getFeatures(java.io.File file,
java.io.PrintStream output)
Returns a network of geographical features parsed from a given RDF file. |
static void |
main(java.lang.String[] args)
The main method. |
void |
setOutput(java.io.Writer output)
Sets up a writer for printing the list of features from the RDF file. |
void |
startDocument()
Receive notification of the beginning of the document, and initialization of parsing variables. |
void |
startElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName,
org.xml.sax.Attributes atts)
Receive notification of the start of an element. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GKBParser()
public GKBParser(java.io.PrintStream output)
output
- A PrintStream for printing the list of features from the RDF file.Method Detail |
---|
public void startDocument()
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
public void startElement(java.lang.String uri, java.lang.String name, java.lang.String qName, org.xml.sax.Attributes atts)
This event allows up to three name components for each element:
the Namespace URI and local name are required when the namespaces property is true (the default), and are optional when the namespaces property is false (if one is specified, both must be);
the qualified name is required when the namespace-prefixes property is true, and is optional when the namespace-prefixes property is false (the default).
The attribute list will contain attributes used for Namespace declarations (xmlns* attributes) only if the http://xml.org/sax/features/namespace-prefixes property is true (it is false by default, and support for a true value is optional).
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
localName
- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName
- The qualified name (with prefix), or the empty string if qualified names are not available.atts
- The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.public void endElement(java.lang.String uri, java.lang.String name, java.lang.String qName)
The SAX2 parser will invoke this method at the end of every element in the RDF document; there will be a corresponding startElement event for every endElement event (even when the element is empty).
For information on the names, see startElement.
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
localName
- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName
- The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.public void characters(char[] ch, int start, int length)
According to the XML tags apearing in the document, this method takes specific actions for each chunk of character data (such as assigning the data to the appropriate variables).
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
ch
- The characters.start
- The start position in the character array.length
- The end position in the character array.public static ClassNetwork getClassNetwork(java.lang.String file) throws org.xml.sax.SAXException, java.io.IOException
file
- The path to the RDF file.
org.xml.sax.SAXException
- A problem occurred while parsing the RDF data.
java.io.IOException
- A problem occurred while reading the File.public static ClassNetwork getClassNetwork(java.lang.String file, java.io.PrintStream output) throws org.xml.sax.SAXException, java.io.IOException
file
- The path to the RDF file.output
- A PrintStream for printing the list of features from the RDF file.
org.xml.sax.SAXException
- A problem occurred while parsing the RDF data.
java.io.IOException
- A problem occurred while reading the File.public static ClassNetwork getClassNetwork(java.io.File file) throws org.xml.sax.SAXException, java.io.IOException
file
- The RDF File.
org.xml.sax.SAXException
- A problem occurred while parsing the RDF data.
java.io.IOException
- A problem occurred while reading the File.public static ClassNetwork getClassNetwork(java.io.File file, java.io.PrintStream output) throws org.xml.sax.SAXException, java.io.IOException
file
- The RDF File.output
- A PrintStream for printing the list of features from the RDF file.
org.xml.sax.SAXException
- A problem occurred while parsing the RDF data.
java.io.IOException
- A problem occurred while reading the File.public static java.util.Map getFeatures(java.io.File file, java.io.PrintStream output) throws org.xml.sax.SAXException, java.io.IOException
file
- The RDF File.output
- A PrintStream for printing the list of features from the RDF file.
org.xml.sax.SAXException
- A problem occurred while parsing the RDF data.
java.io.IOException
- A problem occurred while reading the File.public void setOutput(java.io.Writer output)
null
, no output will be produced.
output
- A writer for printing the list of features from the RDF file.public static void main(java.lang.String[] args) throws java.lang.Exception
args
- The command line options, tokenized.
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |