|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.coode.owlapi.rdfxml.parser.OWLRDFConsumer
public class OWLRDFConsumer
Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 07-Dec-2006
A parser/interpreter for an RDF graph which represents an OWL ontology. The
consumer interprets triple patterns in the graph to produce the appropriate
OWLAPI entities, class expressions and axioms.
The parser is based on triple handlers. A given triple handler handles a specific
type of triple. Generally speaking this is based on the predicate of a triple, for
example, A rdfs:subClassOf B is handled by a subClassOf handler. A handler determines
if it can handle a triple in a streaming mode (i.e. while parsing is taking place) or
if it can handle a triple after parsing has taken place and the complete graph is in
memory. Once a handler handles a triple, that triple is deemed to have been consumed
an is discarded.
The parser attempts to consume as many triples as possible while streaming parsing
is taking place. Whether or not a triple can be consumed dIRIng parsing is determined
by installed triple handlers.
Field Summary | |
---|---|
static java.util.logging.Logger |
logger
|
Constructor Summary | |
---|---|
OWLRDFConsumer(OWLOntologyManager owlOntologyManager,
OWLOntology ontology,
AnonymousNodeChecker checker)
|
Method Summary | ||
---|---|---|
void |
addAnnotatedSource(IRI annotatedAnonSource,
IRI annotationMainNode)
Records an annotation of an anonymous node (either an annotation of an annotation, or an annotation of an axiom for example) |
|
protected void |
addAnnotationIRI(IRI iri)
|
|
protected void |
addAnnotationProperty(IRI iri)
|
|
void |
addAxiom(IRI axiomIRI)
|
|
protected void |
addAxiom(OWLAxiom axiom)
|
|
void |
addFirst(IRI subject,
IRI object)
|
|
void |
addFirst(IRI subject,
OWLLiteral object)
|
|
protected void |
addImport(OWLImportsDeclaration declaration)
|
|
protected void |
addIndividual(IRI iri)
|
|
void |
addList(IRI iri)
|
|
void |
addModelAttribte(java.lang.String string,
java.lang.String string1)
Receives the notification that the attribute and its value has been parsed. |
|
void |
addOntology(IRI iri)
|
|
protected void |
addOntologyAnnotation(OWLAnnotation annotation)
|
|
protected void |
addOWLClass(IRI iri)
|
|
protected void |
addOWLDataProperty(IRI iri)
|
|
void |
addOWLDataRange(IRI iri)
|
|
protected void |
addOWLDatatype(IRI iri)
|
|
protected void |
addOWLObjectProperty(IRI iri)
|
|
protected void |
addRDFProperty(IRI iri)
|
|
void |
addRest(IRI subject,
IRI object)
|
|
protected void |
addRestriction(IRI iri)
|
|
protected void |
addSharedAnonymousNode(IRI iri,
java.lang.Object translation)
|
|
protected void |
addSWRLBuiltInAtom(IRI iri)
|
|
protected void |
addSWRLClassAtom(IRI iri)
|
|
protected void |
addSWRLDataPropertyAtom(IRI iri)
|
|
protected void |
addSWRLDataRangeAtom(IRI iri)
|
|
protected void |
addSWRLDifferentFromAtom(IRI iri)
|
|
protected void |
addSWRLIndividualPropertyAtom(IRI iri)
|
|
protected void |
addSWRLRule(IRI iri)
|
|
protected void |
addSWRLSameAsAtom(IRI iri)
|
|
protected void |
addSWRLVariable(IRI iri)
|
|
void |
addTriple(IRI subject,
IRI predicate,
IRI object)
|
|
void |
addTriple(IRI subject,
IRI predicate,
OWLLiteral con)
|
|
protected void |
applyChange(OWLOntologyChange change)
|
|
IRI |
checkForSynonym(IRI original)
|
|
protected void |
consumeTriple(IRI subject,
IRI predicate,
IRI object)
|
|
protected void |
consumeTriple(IRI subject,
IRI predicate,
OWLLiteral con)
|
|
void |
endModel()
This is where we do all remaining parsing |
|
java.util.Set<IRI> |
getAnnotatedSourceAnnotationMainNodes(IRI source)
Gets the main nodes of annotations that annotated the specified source |
|
OWLClassExpression |
getClassExpressionIfTranslated(IRI mainNode)
|
|
OWLDataFactory |
getDataFactory()
|
|
OWLLiteral |
getFirstLiteral(IRI subject)
|
|
IRI |
getFirstResource(IRI subject,
boolean consume)
|
|
OWLAxiom |
getLastAddedAxiom()
|
|
OWLLiteral |
getLiteralObject(IRI subject,
IRI predicate,
boolean consume)
|
|
java.util.Set<IRI> |
getOntologies()
|
|
OWLOntology |
getOntology()
|
|
RDFXMLOntologyFormat |
getOntologyFormat()
|
|
protected OWLClass |
getOWLClass(IRI iri)
|
|
protected OWLDataProperty |
getOWLDataProperty(IRI iri)
|
|
protected OWLIndividual |
getOWLIndividual(IRI iri)
|
|
protected OWLObjectProperty |
getOWLObjectProperty(IRI iri)
|
|
OWLOntologyManager |
getOWLOntologyManager()
|
|
java.util.Set<OWLAnnotation> |
getPendingAnnotations()
Gets any annotations that were translated since the last call of this method (calling this method clears the current pending annotations) |
|
java.util.Set<IRI> |
getPredicatesBySubject(IRI subject)
|
|
IRI |
getResourceObject(IRI subject,
IRI predicate,
boolean consume)
|
|
IRI |
getRest(IRI subject,
boolean consume)
|
|
protected java.lang.Object |
getSharedAnonymousNode(IRI iri)
|
|
void |
handle(IRI subject,
IRI predicate,
IRI object)
Handles triples in a non-streaming mode. |
|
void |
handle(IRI subject,
IRI predicate,
OWLLiteral object)
|
|
boolean |
hasPredicate(IRI subject,
IRI predicate)
|
|
boolean |
hasPredicateObject(IRI subject,
IRI predicate,
IRI object)
|
|
void |
importsClosureChanged()
|
|
void |
includeModel(java.lang.String string,
java.lang.String string1)
Receives the notification that the model being parsed includes another model with supplied URIs. |
|
protected boolean |
isAnnotation(IRI iri)
|
|
protected boolean |
isAnnotationProperty(IRI iri)
|
|
protected boolean |
isAnonymousNode(IRI iri)
Checks whether a node is anonymous. |
|
boolean |
isAxiom(IRI iri)
|
|
protected boolean |
isClass(IRI iri)
|
|
protected boolean |
isDataPropertyOnly(IRI iri)
|
|
boolean |
isDataRange(IRI iri)
|
|
protected boolean |
isIndividual(IRI iri)
|
|
boolean |
isList(IRI iri,
boolean consume)
|
|
protected boolean |
isObjectPropertyOnly(IRI iri)
|
|
protected boolean |
isOntology(IRI iri)
|
|
protected boolean |
isOntologyProperty(IRI iri)
|
|
protected boolean |
isRDFProperty(IRI iri)
|
|
boolean |
isRestriction(IRI iri)
|
|
protected boolean |
isSharedAnonymousNode(IRI iri)
|
|
boolean |
isStrict()
Determines if strict parsing should be used. |
|
protected boolean |
isSWRLBuiltInAtom(IRI iri)
|
|
protected boolean |
isSWRLClassAtom(IRI iri)
|
|
protected boolean |
isSWRLDataRangeAtom(IRI iri)
|
|
protected boolean |
isSWRLDataValuedPropertyAtom(IRI iri)
|
|
protected boolean |
isSWRLDifferentFromAtom(IRI iri)
|
|
protected boolean |
isSWRLIndividualPropertyAtom(IRI iri)
|
|
protected boolean |
isSWRLRule(IRI iri)
|
|
protected boolean |
isSWRLSameAsAtom(IRI iri)
|
|
protected boolean |
isSWRLVariable(IRI iri)
|
|
boolean |
isTriplePresent(IRI subject,
IRI predicate,
IRI object,
boolean consume)
|
|
boolean |
isTriplePresent(IRI subject,
IRI predicate,
OWLLiteral object,
boolean consume)
|
|
|
iterateLiteralTriples(org.coode.owlapi.rdfxml.parser.OWLRDFConsumer.LiteralTripleIterator<E> iterator)
|
|
|
iterateResourceTriples(org.coode.owlapi.rdfxml.parser.OWLRDFConsumer.ResourceTripleIterator<E> iterator)
|
|
void |
logicalURI(java.lang.String string)
Receives the logical URI of the model. |
|
void |
setIRIProvider(IRIProvider iriProvider)
|
|
void |
setOntologyFormat(RDFXMLOntologyFormat format)
|
|
protected void |
setOntologyID(OWLOntologyID ontologyID)
|
|
void |
setPendingAnnotations(java.util.Set<OWLAnnotation> annotations)
|
|
void |
setXMLBase(java.lang.String base)
|
|
void |
startModel(java.lang.String string)
Called when model parsing is started. |
|
void |
statementWithLiteralValue(java.lang.String subject,
java.lang.String predicate,
java.lang.String object,
java.lang.String lang,
java.lang.String datatype)
Called when a statement with literal value is added to the model. |
|
void |
statementWithResourceValue(java.lang.String subject,
java.lang.String predicate,
java.lang.String object)
Called when a statement with resource value is added to the model. |
|
java.util.Set<OWLAnnotation> |
translateAnnotations(IRI mainNode)
Translates the annotation on a main node. |
|
OWLClassExpression |
translateClassExpression(IRI mainNode)
|
|
OWLDataPropertyExpression |
translateDataPropertyExpression(IRI iri)
|
|
OWLDataRange |
translateDataRange(IRI iri)
|
|
OWLIndividual |
translateIndividual(IRI node)
|
|
OWLObjectPropertyExpression |
translateObjectPropertyExpression(IRI mainNode)
|
|
java.util.Set<OWLClassExpression> |
translateToClassExpressionSet(IRI mainNode)
|
|
java.util.Set<OWLLiteral> |
translateToConstantSet(IRI mainNode)
|
|
java.util.List<OWLDataPropertyExpression> |
translateToDataPropertyList(IRI mainNode)
|
|
java.util.Set<OWLDataRange> |
translateToDataRangeSet(IRI mainNode)
|
|
java.util.Set<OWLFacetRestriction> |
translateToFacetRestrictionSet(IRI mainNode)
|
|
java.util.Set<OWLIndividual> |
translateToIndividualSet(IRI mainNode)
|
|
java.util.List<OWLObjectPropertyExpression> |
translateToObjectPropertyList(IRI mainNode)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.logging.Logger logger
Constructor Detail |
---|
public OWLRDFConsumer(OWLOntologyManager owlOntologyManager, OWLOntology ontology, AnonymousNodeChecker checker)
Method Detail |
---|
public boolean isStrict()
true
if strict parsing should be used, otherwise false
.public void setIRIProvider(IRIProvider iriProvider)
public OWLOntology getOntology()
public RDFXMLOntologyFormat getOntologyFormat()
public void setOntologyFormat(RDFXMLOntologyFormat format)
public OWLDataFactory getDataFactory()
public java.util.Set<OWLAnnotation> getPendingAnnotations()
public void setPendingAnnotations(java.util.Set<OWLAnnotation> annotations)
public void importsClosureChanged()
protected boolean isAnonymousNode(IRI iri)
iri
- The IRI of the node to be checked.
true
if the node is anonymous, or
false
if the node is not anonymous.protected boolean isSharedAnonymousNode(IRI iri)
protected void addSharedAnonymousNode(IRI iri, java.lang.Object translation)
protected java.lang.Object getSharedAnonymousNode(IRI iri)
protected void addAxiom(OWLAxiom axiom)
protected void applyChange(OWLOntologyChange change)
protected void setOntologyID(OWLOntologyID ontologyID)
protected void addOntologyAnnotation(OWLAnnotation annotation)
protected void addImport(OWLImportsDeclaration declaration)
public OWLAxiom getLastAddedAxiom()
protected void addOWLClass(IRI iri)
protected void addOWLObjectProperty(IRI iri)
protected void addIndividual(IRI iri)
protected boolean isIndividual(IRI iri)
protected void addRDFProperty(IRI iri)
protected boolean isRDFProperty(IRI iri)
protected void addOWLDataProperty(IRI iri)
protected void addOWLDatatype(IRI iri)
public void addOWLDataRange(IRI iri)
protected void addRestriction(IRI iri)
protected void addAnnotationProperty(IRI iri)
protected void addAnnotationIRI(IRI iri)
protected boolean isAnnotation(IRI iri)
public boolean isRestriction(IRI iri)
protected boolean isClass(IRI iri)
protected boolean isObjectPropertyOnly(IRI iri)
protected boolean isDataPropertyOnly(IRI iri)
protected boolean isOntologyProperty(IRI iri)
protected boolean isAnnotationProperty(IRI iri)
protected boolean isOntology(IRI iri)
public OWLOntologyManager getOWLOntologyManager()
public void addAnnotatedSource(IRI annotatedAnonSource, IRI annotationMainNode)
annotatedAnonSource
- The source that the annotation annotatesannotationMainNode
- The annotationspublic java.util.Set<IRI> getAnnotatedSourceAnnotationMainNodes(IRI source)
source
- The source (axiom or annotation main node)
protected OWLClass getOWLClass(IRI iri)
protected OWLObjectProperty getOWLObjectProperty(IRI iri)
protected OWLDataProperty getOWLDataProperty(IRI iri)
protected OWLIndividual getOWLIndividual(IRI iri)
protected void consumeTriple(IRI subject, IRI predicate, IRI object)
protected void consumeTriple(IRI subject, IRI predicate, OWLLiteral con)
protected void addSWRLRule(IRI iri)
protected boolean isSWRLRule(IRI iri)
protected void addSWRLIndividualPropertyAtom(IRI iri)
protected boolean isSWRLIndividualPropertyAtom(IRI iri)
protected void addSWRLDataPropertyAtom(IRI iri)
protected boolean isSWRLDataValuedPropertyAtom(IRI iri)
protected void addSWRLClassAtom(IRI iri)
protected boolean isSWRLClassAtom(IRI iri)
protected void addSWRLSameAsAtom(IRI iri)
protected boolean isSWRLSameAsAtom(IRI iri)
protected void addSWRLDifferentFromAtom(IRI iri)
protected boolean isSWRLDifferentFromAtom(IRI iri)
protected void addSWRLDataRangeAtom(IRI iri)
protected boolean isSWRLDataRangeAtom(IRI iri)
protected void addSWRLBuiltInAtom(IRI iri)
protected boolean isSWRLBuiltInAtom(IRI iri)
protected void addSWRLVariable(IRI iri)
protected boolean isSWRLVariable(IRI iri)
public void handle(IRI subject, IRI predicate, IRI object) throws UnloadableImportException
subject
- The subject of the triplepredicate
- The predicate of the tripleobject
- The object of the triple
UnloadableImportException
- .public void handle(IRI subject, IRI predicate, OWLLiteral object)
public void startModel(java.lang.String string) throws org.xml.sax.SAXException
RDFConsumer
startModel
in interface RDFConsumer
string
- physical URI of the model
org.xml.sax.SAXException
public void endModel() throws org.xml.sax.SAXException
endModel
in interface RDFConsumer
org.xml.sax.SAXException
public void addModelAttribte(java.lang.String string, java.lang.String string1) throws org.xml.sax.SAXException
RDFConsumer
addModelAttribte
in interface RDFConsumer
string
- the key of the attributestring1
- the value of the attribute
org.xml.sax.SAXException
public void includeModel(java.lang.String string, java.lang.String string1) throws org.xml.sax.SAXException
RDFConsumer
includeModel
in interface RDFConsumer
string
- logical URI of the modelstring1
- physical URI of the model
org.xml.sax.SAXException
public void logicalURI(java.lang.String string) throws org.xml.sax.SAXException
RDFConsumer
logicalURI
in interface RDFConsumer
string
- logical URI of the model
org.xml.sax.SAXException
public IRI checkForSynonym(IRI original)
public void statementWithLiteralValue(java.lang.String subject, java.lang.String predicate, java.lang.String object, java.lang.String lang, java.lang.String datatype) throws org.xml.sax.SAXException
RDFConsumer
statementWithLiteralValue
in interface RDFConsumer
subject
- URI of the subject resourcepredicate
- URI of the predicate resourceobject
- literal object valuelang
- the languagedatatype
- the URI of the literal's datatype (may be null
)
org.xml.sax.SAXException
public void statementWithResourceValue(java.lang.String subject, java.lang.String predicate, java.lang.String object) throws org.xml.sax.SAXException
RDFConsumer
statementWithResourceValue
in interface RDFConsumer
subject
- URI of the subject resourcepredicate
- URI of the predicate resourceobject
- URI of the object resource
org.xml.sax.SAXException
public OWLDataRange translateDataRange(IRI iri)
public OWLDataPropertyExpression translateDataPropertyExpression(IRI iri)
public OWLObjectPropertyExpression translateObjectPropertyExpression(IRI mainNode)
public OWLIndividual translateIndividual(IRI node)
public java.util.Set<OWLAnnotation> translateAnnotations(IRI mainNode)
mainNode
- The main node
public OWLClassExpression translateClassExpression(IRI mainNode)
public OWLClassExpression getClassExpressionIfTranslated(IRI mainNode)
public java.util.List<OWLObjectPropertyExpression> translateToObjectPropertyList(IRI mainNode)
public java.util.List<OWLDataPropertyExpression> translateToDataPropertyList(IRI mainNode)
public java.util.Set<OWLClassExpression> translateToClassExpressionSet(IRI mainNode)
public java.util.Set<OWLLiteral> translateToConstantSet(IRI mainNode)
public java.util.Set<OWLIndividual> translateToIndividualSet(IRI mainNode)
public java.util.Set<OWLDataRange> translateToDataRangeSet(IRI mainNode)
public java.util.Set<OWLFacetRestriction> translateToFacetRestrictionSet(IRI mainNode)
public java.util.Set<IRI> getPredicatesBySubject(IRI subject)
public IRI getResourceObject(IRI subject, IRI predicate, boolean consume)
public OWLLiteral getLiteralObject(IRI subject, IRI predicate, boolean consume)
public boolean isTriplePresent(IRI subject, IRI predicate, IRI object, boolean consume)
public boolean isTriplePresent(IRI subject, IRI predicate, OWLLiteral object, boolean consume)
public boolean hasPredicate(IRI subject, IRI predicate)
public boolean hasPredicateObject(IRI subject, IRI predicate, IRI object)
public void addList(IRI iri)
public boolean isList(IRI iri, boolean consume)
public void addRest(IRI subject, IRI object)
public void addFirst(IRI subject, IRI object)
public IRI getFirstResource(IRI subject, boolean consume)
public OWLLiteral getFirstLiteral(IRI subject)
public IRI getRest(IRI subject, boolean consume)
public void addFirst(IRI subject, OWLLiteral object)
public void addOntology(IRI iri)
public java.util.Set<IRI> getOntologies()
public void addAxiom(IRI axiomIRI)
public boolean isAxiom(IRI iri)
public boolean isDataRange(IRI iri)
public <E extends java.lang.Throwable> void iterateResourceTriples(org.coode.owlapi.rdfxml.parser.OWLRDFConsumer.ResourceTripleIterator<E> iterator) throws E extends java.lang.Throwable
E extends java.lang.Throwable
public <E extends java.lang.Throwable> void iterateLiteralTriples(org.coode.owlapi.rdfxml.parser.OWLRDFConsumer.LiteralTripleIterator<E> iterator) throws E extends java.lang.Throwable
E extends java.lang.Throwable
public void addTriple(IRI subject, IRI predicate, IRI object)
public void addTriple(IRI subject, IRI predicate, OWLLiteral con)
public void setXMLBase(java.lang.String base)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |