org.mindswap.rdfparser
Class RDFParser
java.lang.Object
|
+--org.mindswap.xmlparser.XMLParser
|
+--org.mindswap.rdfparser.RDFParser
- All Implemented Interfaces:
- DAMLConsts, OWLConsts, RDFConsts, XMLConsts
- Direct Known Subclasses:
- DAMLParser
- public class RDFParser
- extends XMLParser
- implements RDFConsts, DAMLConsts, OWLConsts
Fields inherited from interface org.mindswap.rdfparser.consts.RDFConsts |
OLD_DAMLURL, RDF, RDF_About, RDF_AboutEach, RDF_AboutEachPrefix, RDF_Alt, RDF_Bag, RDF_BagID, RDF_Class, RDF_Comment, RDF_ConstraintProperty, RDF_Description, RDF_Domain, RDF_First, RDF_ID, RDF_IsDefinedBy, RDF_Label, RDF_Li, RDF_Nil, RDF_NodeID, RDF_Object, RDF_ParseType, RDF_Predicate, RDF_Property, RDF_Range, RDF_Resource, RDF_Rest, RDF_SeeAlso, RDF_Seq, RDF_SubClass, RDF_Subject, RDF_SubProperty, RDF_TERMS, RDF_Type, RDF_Value, RDFSURL, RDFURL |
Fields inherited from interface org.mindswap.damlparser.consts.DAMLConsts |
DAML_Cardinality, DAML_CardinalityQ, DAML_Class, DAML_Collection, DAML_Comment, DAML_ComplementOf, DAML_DatatypeProperty, DAML_DifferentIndividualFrom, DAML_DisjointUnionOf, DAML_DisjointWith, DAML_Domain, DAML_EquivalentTo, DAML_First, DAML_HasClass, DAML_HasClassQ, DAML_HasValue, DAML_Imports, DAML_IntersectionOf, DAML_InverseOf, DAML_IsDefinedBy, DAML_Item, DAML_Label, DAML_List, DAML_MaxCardinality, DAML_MaxCardinalityQ, DAML_MinCardinality, DAML_MinCardinalityQ, DAML_Nil, DAML_ObjectProperty, DAML_OneOf, DAML_OnProperty, DAML_Ontology, DAML_Property, DAML_Range, DAML_Resource, DAML_Rest, DAML_Restriction, DAML_SameClassAs, DAML_SameIndividualAs, DAML_SamePropertyAs, DAML_SeeAlso, DAML_SubClassOf, DAML_SubPropertyOf, DAML_TERMS, DAML_Thing, DAML_ToClass, DAML_TransitiveProperty, DAML_Type, DAML_UnambiguousProperty, DAML_UnionOf, DAML_UniqueProperty, DAML_VersionInfo, DAMLURL, INFINITE_CARDINALITY |
Fields inherited from interface org.mindswap.owlparser.consts.OWLConsts |
OWL_AllValuesFrom, OWL_Cardinality, OWL_Class, OWL_ComplementOf, OWL_DatatypeProperty, OWL_DifferentIndividualFrom, OWL_DisjointUnionOf, OWL_DisjointWith, OWL_FunctionalProperty, OWL_HasValue, OWL_Imports, OWL_IntersectionOf, OWL_InverseFunctionalProperty, OWL_InverseOf, OWL_LITE_TERMS, OWL_MaxCardinality, OWL_MinCardinality, OWL_ObjectProperty, OWL_OneOf, OWL_OnProperty, OWL_Ontology, OWL_Restriction, OWL_SameAs, OWL_SameClassAs, OWL_SameIndividualAs, OWL_SamePropertyAs, OWL_SomeValuesFrom, OWL_SymmetricProperty, OWL_TERMS, OWL_TransitiveProperty, OWL_UnionOf, OWL_VersionInfo, OWLURL |
Fields inherited from interface org.mindswap.xmlparser.consts.XMLConsts |
TARGET_NAMESPACE, XML_BASE, XML_Binary, XML_Boolean, XML_Byte, XML_CDATA, XML_COMPLEXTYPE, XML_Date, XML_Decimal, XML_Doctype, XML_Double, XML_ELEMENT, XML_Entity, XML_ENUMERATION, XML_Float, XML_IMPORT, XML_Int, XML_Integer, XML_Long, XML_MAXOCCURS, XML_MINOCCURS, XML_NAME, XML_NAMESPACE, XML_NegativeInteger, XML_NILLABLE, XML_NonNegativeInteger, XML_NonPositiveInteger, XML_PositiveInteger, XML_REF, XML_RESTRICTION, XML_SCHEMA, XML_SEQUENCE, XML_Short, XML_SIMPLETYPE, XML_String, XML_Time, XML_TimeDuration, XML_TYPE, XML_UnsignedByte, XML_UnsignedInt, XML_UnsignedLong, XML_UnsignedShort, XML_UriReference, XML_VALUE, XMLURL |
Method Summary |
RDFFile |
createFromTriples(org.mindswap.n3.ntriples.NTripleList list,
java.lang.String filename,
java.lang.String abbrev,
Namespaces ns)
Given a list of NTriples, the associated filename and abbreviation, and any namespaces the user
wishes to have in the file, the parser can create the same object model as it would from an RDF file.
|
RDFFile |
read(java.lang.String fn,
java.lang.String abbrev)
The core function of the parser. |
RDFFile |
readRDF(java.lang.String fn,
java.lang.String abbrev)
The core function of the parser. |
RDFFile |
recursiveRead(java.lang.String fn,
java.lang.String abbrev)
Similar to the read function, recursiveRead returns an RDFFile object the same as read does
however, recursiveRead is intended to be called when in the middle of an invocation of read. |
void |
revalidate(RDFFile f)
Will cause the validation routines to be run against the parameter.
|
Methods inherited from class org.mindswap.xmlparser.XMLParser |
read |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RDFParser
public RDFParser()
read
public RDFFile read(java.lang.String fn,
java.lang.String abbrev)
throws java.io.FileNotFoundException,
java.io.IOException,
XMLParserException
- The core function of the parser. Takes as input the filename to parse and the abbreviation
to use for the parsed file in the namespaces section. Returns an RDFFile which is the parsed
representation of the file.
- Parameters:
fn
- The filename from which to load the RDF and parse.abbrev
- The abbreviation to be associated with this file in the namespace declaration.- Returns:
- The parsed object model (RDFFile) that represents the RDF file, or null if loading RDF spec.
- Throws:
java.io.FileNotFoundException
- If the provided url does not exist.java.io.IOException
- Thrown if there is some error during the reading of the file.XMLParserException
- Thrown when there is an error during parsing due to invalid formatting or other syntactical errors present in the file.
readRDF
public RDFFile readRDF(java.lang.String fn,
java.lang.String abbrev)
throws java.io.FileNotFoundException,
java.io.IOException,
XMLParserException
- The core function of the parser. Takes as input the filename to parse and the abbreviation
to use for the parsed file in the namespaces section. Returns an RDFFile which is the parsed
representation of the file.
- Parameters:
fn
- The filename from which to load the RDF and parse.abbrev
- The abbreviation to be associated with this file in the namespace declaration.- Returns:
- The parsed object model (RDFFile) that represents the RDF file, or null if loading RDF spec.
- Throws:
java.io.FileNotFoundException
- If the provided url does not exist.java.io.IOException
- Thrown if there is some error during the reading of the file.XMLParserException
- thrown when there is an error during parsing due to invalid formatting or other syntactical errors present in the file.
recursiveRead
public RDFFile recursiveRead(java.lang.String fn,
java.lang.String abbrev)
throws java.io.FileNotFoundException,
java.io.IOException,
XMLParserException,
InvalidFormatException,
InvalidDataException
- Similar to the read function, recursiveRead returns an RDFFile object the same as read does
however, recursiveRead is intended to be called when in the middle of an invocation of read.
It should not, under any circumstances, be invoked by another program. It is only public because
RDFClass and RDFProperty use it during validation.
- Parameters:
fn
- The filename from which to load the RDF and parse.abbrev
- The abbreviation to be associated with this file in the namespace declaration.- Returns:
- The parsed object model (RDFFile) that represents the RDF file.
- Throws:
java.io.FileNotFoundException
- If the provided url does not exist.java.io.IOException
- Thrown if there is some error during the reading of the file.XMLParserException
- Thrown when there is an error during parsing due to invalid formatting or other syntactical errors present in the file.
revalidate
public void revalidate(RDFFile f)
throws InvalidDataException,
InvalidFormatException
- Will cause the validation routines to be run against the parameter.
- Parameters:
fn
- A previously parsed RDFFile object.- Throws:
InvalidFormatException
- If there is a formatting error in the file.InvalidDataException
- If data for a resource is invalid.
createFromTriples
public RDFFile createFromTriples(org.mindswap.n3.ntriples.NTripleList list,
java.lang.String filename,
java.lang.String abbrev,
Namespaces ns)
throws java.lang.Exception
- Given a list of NTriples, the associated filename and abbreviation, and any namespaces the user
wishes to have in the file, the parser can create the same object model as it would from an RDF file.
- Parameters:
list
- filename
- abbrev
- ns
- - Returns:
- The parsed object model (RDFFile) that represents the provided NTriples.
- Throws:
java.lang.Exception
- Thrown if there errors of any type.