| java.lang.Object com.hp.hpl.jena.reasoner.dig.DIGAdapter
DIGAdapter | public class DIGAdapter (Code) | |
An adapter class that mediates between a Jena InfGraph and a DIG reasoner process.
author: Ian Dickinson, HP Labs author: (email) version: CVS $Id: DIGAdapter.java,v 1.26 2008/01/02 12:07:11 andy_seaborne Exp $ |
Constructor Summary | |
public | DIGAdapter(OntModelSpec spec, Graph source) Construct a DIG adapter for the given source data graph, which is encoding an
ontology in a language represented by the given model spec. | public | DIGAdapter(OntModelSpec spec, Graph source, DIGConnection connection, Model axioms) Construct a DIG adapter for the given source data graph, which is encoding an
ontology in a language represented by the given model spec.
Parameters: spec - An ont model spec encoding the ontology language of the source graph Parameters: source - The graph that contains the source data on which the DIG reasonerwill operate Parameters: connection - A pre-configured DIG connection to use to communicate with theexternal reasoner Parameters: axioms - A model containing axioms appropriate to the ontology languagethis adapter is processing. |
Method Summary | |
public void | addClassDescription(Element elem, com.hp.hpl.jena.graph.Node node) Add a DIG reference to the class identifed in the source graph by the given Jena
graph Node to the given XML element. | public void | addClassDescription(Element elem, com.hp.hpl.jena.graph.Node node, Model sourceData) Add a DIG reference to the class identifed in the source graph by the given Jena
graph Node to the given XML element. | public void | addClassDescription(Element elem, Resource res, Model sourceData) Add a DIG reference to the class identifed in the source graph by the given Jena
resource to the given XML element. | protected Element | addElement(Element parent, String childName) | protected void | addNamedDefs(Element tell, Iterator i, String defType, Set nameCollection) | protected Element | addNamedElement(Element parent, String elemName, String uri) | protected void | addNamedEntities(Element tell) In Dig, defXXX elements are required to introduce all named entities,
such as concepts and roles. | public void | close() | protected Set | collectNamedTerms(String queryType, String[] path) | protected void | collectRoleProperties(Collection roles) | public Element | createQueryElement(Document query, String elemName) | public ExtendedIterator | find(TriplePattern pattern) Basic pattern lookup interface - answer an iterator over the triples
matching the given pattern. | public ExtendedIterator | find(TriplePattern pattern, Model premises) Basic pattern lookup interface - answer an iterator over the triples
matching the given (S,P,O) pattern, given also some premises for the
query. | public DIGConnection | getConnection() | public DIGIdentifier | getDigIdentifier() | public Graph | getGraph() | protected Set | getKnownConcepts() | protected Set | getKnownIndividuals() | protected Set | getKnownRoles() | public String | getNodeID(com.hp.hpl.jena.graph.Node n) | public Profile | getOntLanguage() | public DIGProfile | getProfile() | public DIGQueryTranslator | getQueryTranslator(TriplePattern pattern, Model premises) Answer the query translator that matches the given pattern, if any
Parameters: pattern - The triple pattern that has been received Parameters: premises - A model containing the premises to a query (e.g. | public Iterator | getRecentWarnings() | public String | getResourceID(Resource r) | public OntModelSpec | getSourceSpecification() | public boolean | isConcept(com.hp.hpl.jena.graph.Node node, Model premises) | public boolean | isIndividual(com.hp.hpl.jena.graph.Node node) | public boolean | isRole(com.hp.hpl.jena.graph.Node node, Model premises) | public void | resetKB() | public void | setProfile(DIGProfile profile) | protected void | translateAllDifferent(Element expr, RDFList diffMembers) | protected void | translateAllDifferentAxioms(Element expr) | protected void | translateAttribRangeAxioms(Element expr, String propURI, Iterator i, String propType) | protected void | translateAttribute(Element expr, DatatypeProperty attrib, Model source) | protected void | translateAttributes(Element expr) | protected void | translateBinaryPropertyAxioms(Element expr, String propURI, String axiomType, Iterator i, String propType) | protected void | translateClassDescription(Element parent, OntClass classDescr, Model source) | protected void | translateClassDisjointAxioms(Element tell) | protected void | translateClassEquivalences(Element tell) | protected void | translateClassExpressions(Element tell, Property p, int classExprType) Translate class expressions, such as union classes, intersection classes, etc, into the DIG.
concept language. | protected void | translateClassExpressions(Element tell, StmtIterator i, int classExprType, Model source) | protected void | translateClassIdentifier(Element expr, Resource c) | protected void | translateClassList(Element expr, RDFList operands, Model source) | protected void | translateClasses(Element tell) | protected void | translateComplementClass(Element expr, OntClass cls, Model source) | protected void | translateDifferentIndividuals(Element expr, Individual ind, Individual other) | protected void | translateDomainRangeAxioms(Element expr, String propURI, String axiomType, Iterator i, String propType, Model source) | protected void | translateEnumeratedClass(Element expr, OntClass cls, Model source) | protected void | translateHasValueRestriction(Element expr, HasValueRestriction r) Translate a has value restriction to DIG form. | protected void | translateIndividual(Element expr, Resource r) | protected void | translateIndividuals(Element expr) | protected void | translateInstanceAttrib(Element expr, Individual ind, OntProperty p, Literal obj) | protected void | translateInstanceRole(Element expr, Individual ind, OntProperty p, Individual obj) | protected void | translateInstanceTypes(Element expr, Individual ind) | protected void | translateIntersectionClass(Element expr, OntClass cls, Model source) | protected void | translateInverseAxiom(Element expr, Property p, String propType, Property inv) | protected void | translateInverseAxioms(Element expr, ObjectProperty p, String propType) | protected void | translateInverseFunctionalAxiom(Element expr, ObjectProperty role, String propType) | public Document | translateKbToDig() | protected void | translateLiteral(Literal lit, Element parent) | protected void | translateRestrictionClass(Element expr, Resource c, Model source) | protected void | translateRestrictions(Element tell) | protected void | translateRole(Element expr, ObjectProperty role, Model source) | protected void | translateRoles(Element expr) | protected void | translateSameIndividuals(Element expr, Individual ind, Individual other) | protected void | translateSubClassAxioms(Element tell) | protected void | translateUnaryPropertyAxiom(Element expr, String propURI, String axiomType, String propType) | protected void | translateUnionClass(Element expr, OntClass cls, Model source) | public boolean | uploadKB() Upload the entire contents of the local knowledge base (OWL/DAML model)
to the DIG reasoner, using a single large TELL verb.
True if the ontology model was uploaded to DIG without any warnings. |
ANON_MARKER | final public static String ANON_MARKER(Code) | | Mark a bNode identifier
|
KNOWN_CONCEPTS | final public static List KNOWN_CONCEPTS(Code) | | Well known concept URI's
|
PELLET_PROFILE | final public static DIGProfile PELLET_PROFILE(Code) | | DIG profile for Pellet
|
RACER_17_PROFILE | final public static DIGProfile RACER_17_PROFILE(Code) | | DIG profile for 1.7
|
XSD_INT_TYPES | final public static List XSD_INT_TYPES(Code) | | Well known integer type URI's, these we will translate into DIG integer attributes
|
m_axioms | protected Model m_axioms(Code) | | Model containing axiom statements
|
m_conceptNames | protected Set m_conceptNames(Code) | | The set of known concept names from the DIG reasoner
|
m_conceptNamesAsked | protected boolean m_conceptNamesAsked(Code) | | Flag that is set to true once we have asked the remote reasoner for its list of concept names
|
m_indNames | protected Set m_indNames(Code) | | The set of known individual names from the DIG reasoner
|
m_indNamesAsked | protected boolean m_indNamesAsked(Code) | | Flag that is set to true once we have asked the remote reasoner for its list of individual names
|
m_profile | protected DIGProfile m_profile(Code) | | The profile for the DIG interface this reasoner is interacting with. Pellet
|
m_roleNames | protected Set m_roleNames(Code) | | The set of known role names from the DIG reasoner
|
m_roleNamesAsked | protected boolean m_roleNamesAsked(Code) | | Flag that is set to true once we have asked the remote reasoner for its list of role names
|
m_sourceData | protected OntModel m_sourceData(Code) | | The graph that contains the data we are uploading to the external DIG reasoner
|
s_queryTable | protected static DIGQueryTranslator[] s_queryTable(Code) | | The table that represents the query translations we know about
|
DIGAdapter | public DIGAdapter(OntModelSpec spec, Graph source)(Code) | | Construct a DIG adapter for the given source data graph, which is encoding an
ontology in a language represented by the given model spec. Allocates a new
DIG connection using the default connection URL (http://localhost:8081 ).
Parameters: spec - An ont model spec encoding the ontology language of the source graph Parameters: source - The graph that contains the source data on which the DIG reasonerwill operate |
DIGAdapter | public DIGAdapter(OntModelSpec spec, Graph source, DIGConnection connection, Model axioms)(Code) | | Construct a DIG adapter for the given source data graph, which is encoding an
ontology in a language represented by the given model spec.
Parameters: spec - An ont model spec encoding the ontology language of the source graph Parameters: source - The graph that contains the source data on which the DIG reasonerwill operate Parameters: connection - A pre-configured DIG connection to use to communicate with theexternal reasoner Parameters: axioms - A model containing axioms appropriate to the ontology languagethis adapter is processing. May be null. |
addClassDescription | public void addClassDescription(Element elem, com.hp.hpl.jena.graph.Node node)(Code) | | Add a DIG reference to the class identifed in the source graph by the given Jena
graph Node to the given XML element. If the class is a named class, this will be
a <catom> element, otherwise it will be a class description axiom.
Assumes that the instance variable m_sourceData provides the statements that
further define the class if it is a description not a name.
Parameters: elem - The parent XML element to which the class description will be attached Parameters: node - An RDF graph node representing a class we wish to describe. |
addClassDescription | public void addClassDescription(Element elem, com.hp.hpl.jena.graph.Node node, Model sourceData)(Code) | | Add a DIG reference to the class identifed in the source graph by the given Jena
graph Node to the given XML element. If the class is a named class, this will be
a <catom> element, otherwise it will be a class description axiom.
Parameters: elem - The parent XML element to which the class description will be attached Parameters: node - An RDF graph node representing a class we wish to describe. Parameters: sourceData - A model containing the statements about the given class descriptionresource |
addClassDescription | public void addClassDescription(Element elem, Resource res, Model sourceData)(Code) | | Add a DIG reference to the class identifed in the source graph by the given Jena
resource to the given XML element. If the class is a named class, this will be
a <catom> element, otherwise it will be a class description axiom.
Parameters: elem - The parent XML element to which the class description will be attached Parameters: res - An RDF resource representing a class we wish to describe. Parameters: sourceData - A model containing the statements about the given class descriptionresource |
addElement | protected Element addElement(Element parent, String childName)(Code) | | Add to the given element a child element with the given name
|
addNamedDefs | protected void addNamedDefs(Element tell, Iterator i, String defType, Set nameCollection)(Code) | | Add the named definitions from the given iterator to the tell document we are building.
Parameters: tell - The document being built Parameters: i - An iterator over resources Parameters: defType - The type of DIG element we want to build Parameters: nameCollection - Optional set of names of this type of entity to collect |
addNamedElement | protected Element addNamedElement(Element parent, String elemName, String uri)(Code) | | Answer a element with the given element name,
and with a attribute 'name' with the given uri as name.
Parameters: parent - The parent node to add to Parameters: elemName - The element name, eg defconcept Parameters: uri - The URI of the definition A named element |
addNamedEntities | protected void addNamedEntities(Element tell)(Code) | | In Dig, defXXX elements are required to introduce all named entities,
such as concepts and roles. This method collects such definitions and
adds the defXXX elements as children of the tell element.
Parameters: tell - The XML element, typically <tells>, to which to attach thedeclarations |
close | public void close()(Code) | | Close this adapter, and release the connector to the external DIG KB.
|
collectNamedTerms | protected Set collectNamedTerms(String queryType, String[] path)(Code) | | Answer an iterator of named terms known to the DIG reasoner, from the cache if possible.
Parameters: queryType - The query verb for the ask Parameters: path - A list of element names to extract the term names from the returned document An iterator of the known names of a particular type |
collectRoleProperties | protected void collectRoleProperties(Collection roles)(Code) | | Add all object properties (roles) to the given collection
|
createQueryElement | public Element createQueryElement(Document query, String elemName)(Code) | | Create a new element to represent a query, adding to it a unique query
ID.
Parameters: query - The query document Parameters: elemName - The string name of the query element The new query element |
find | public ExtendedIterator find(TriplePattern pattern)(Code) | | Basic pattern lookup interface - answer an iterator over the triples
matching the given pattern. Where possible, this query will first be
given to the external reasoner, with the local graph used to generate
supplemental bindings.
Parameters: pattern - a TriplePattern to be matched against the data An ExtendedIterator over all Triples in the data setthat match the pattern |
find | public ExtendedIterator find(TriplePattern pattern, Model premises)(Code) | | Basic pattern lookup interface - answer an iterator over the triples
matching the given (S,P,O) pattern, given also some premises for the
query. Where possible, this query will first be
given to the external reasoner, with the local graph used to generate
supplemental bindings.
Parameters: pattern - a TriplePattern to be matched against the data Parameters: premises - A model containing additional premises for the find query,typically used to allow the subject and/or object to be an expressionrather than just a simple node An ExtendedIterator over all Triples in the data setthat match the pattern |
getConnection | public DIGConnection getConnection()(Code) | | Answer this adapter's connection to the database.
The DIG connector this adapter is using, or null if the connection hasbeen closed. |
getDigIdentifier | public DIGIdentifier getDigIdentifier()(Code) | | Answer the DIG identification structure we obtain by querying the attached reasoner.
An object containing the results of querying the reasoner for its identityand capabilities |
getGraph | public Graph getGraph()(Code) | | Answer the graph of local (source) data.
The graph containing the local source data. |
getKnownConcepts | protected Set getKnownConcepts()(Code) | | Answer an iterator of the concept names known to the DIG reasoner, from the cache if possible.
An iterator of the known concept names |
getKnownIndividuals | protected Set getKnownIndividuals()(Code) | | Answer an iterator of the individual names known to the DIG reasoner, from the cache if possible.
An iterator of the known individual names |
getKnownRoles | protected Set getKnownRoles()(Code) | | Answer an iterator of the role names known to the DIG reasoner, from the cache if possible.
An iterator of the known role names |
getNodeID | public String getNodeID(com.hp.hpl.jena.graph.Node n)(Code) | | Answer an identifier for a node, named or anon
Parameters: n - An RDF node A unique identifier for the node as a string, which will eitherbe the resource URI for named nodes, or a unique ID string for bNodes |
getOntLanguage | public Profile getOntLanguage()(Code) | | Answer the ontology language profile we're assuming in this reasoner.
The ontology language via the language profile |
getProfile | public DIGProfile getProfile()(Code) | | Answer the DIG profile for the DIG interface this reasoner is attached to.
A profile detailing the parameters of the DIG variant this reasoner is interacting with. |
getQueryTranslator | public DIGQueryTranslator getQueryTranslator(TriplePattern pattern, Model premises)(Code) | | Answer the query translator that matches the given pattern, if any
Parameters: pattern - The triple pattern that has been received Parameters: premises - A model containing the premises to a query (e.g. a class expression) A DIG translator that can translate this pattern to a DIG query,or null if no matches. |
getRecentWarnings | public Iterator getRecentWarnings()(Code) | | Answer an iterator over any recent warnings returned from from the remote DIG reasoner.
An iterator over any warnings; if there are no warnings the returnvalue will be an iterator that returns hasNext() = false. |
getResourceID | public String getResourceID(Resource r)(Code) | | Answer an identifier for a resource, named or bNode
Parameters: r - A resource A unique identifier for the resource as a string, which will eitherbe the resource URI for named resources, or a unique ID string for bNodes |
getSourceSpecification | public OntModelSpec getSourceSpecification()(Code) | | Answer the ontology language specification for the source model underlying
this DIG adapter.
The ontology model spec |
isConcept | public boolean isConcept(com.hp.hpl.jena.graph.Node node, Model premises)(Code) | | Answer true if the given node corresponds to one of the concepts known to
the DIG reasoner.
Parameters: node - A node to test Parameters: premises - A model defining premises that may encode more information aboutnode, or may be null True if node is a known concept |
isIndividual | public boolean isIndividual(com.hp.hpl.jena.graph.Node node)(Code) | | Answer true if the given node corresponds to one of the individuals known to
the DIG reasoner.
Parameters: node - A node to test True if node is a known individual |
isRole | public boolean isRole(com.hp.hpl.jena.graph.Node node, Model premises)(Code) | | Answer true if the given node corresponds to one of the roles known to
the DIG reasoner.
Parameters: node - A node to test Parameters: premises - A model defining premises that may encode more information aboutnode, or may be null True if node is a known role |
resetKB | public void resetKB()(Code) | | Clear the old contents of the DIG knowledge base
|
setProfile | public void setProfile(DIGProfile profile)(Code) | | Set the profile specifying the variable parts of the DIG profile that are being
used in this instance.
Parameters: profile - The new DIG profile |
translateAllDifferent | protected void translateAllDifferent(Element expr, RDFList diffMembers)(Code) | | Translate a single AllDifferent declaration as a set of pair-wise disjoints
|
translateAllDifferentAxioms | protected void translateAllDifferentAxioms(Element expr)(Code) | | Translate all of the AllDifferent axioms in the KB
|
translateAttribRangeAxioms | protected void translateAttribRangeAxioms(Element expr, String propURI, Iterator i, String propType)(Code) | | Concrete ranges have special treatment
|
translateAttribute | protected void translateAttribute(Element expr, DatatypeProperty attrib, Model source)(Code) | | Attributes (datatype properties) have fewer axiom choices than roles
|
translateAttributes | protected void translateAttributes(Element expr)(Code) | | Translate all of the attribute (datatype properties) in the KB
|
translateBinaryPropertyAxioms | protected void translateBinaryPropertyAxioms(Element expr, String propURI, String axiomType, Iterator i, String propType)(Code) | | Helper method for binary axioms each argument of which is an ratom element
|
translateClassDescription | protected void translateClassDescription(Element parent, OntClass classDescr, Model source)(Code) | | Translate a node representing a class expression (presumed anonymous, though
this is not tested) into the appropriate DIG class axiom.
Parameters: parent - The XML node that will be the parent of the class description axiom Parameters: classDescr - An OntClass representing the class expression to be translated |
translateClassDisjointAxioms | protected void translateClassDisjointAxioms(Element tell)(Code) | | Translate any statements from the KB that indicates disjointness between
two classes.
Parameters: tell - The XML element representing the tell verb we will attach thetranslations to. |
translateClassEquivalences | protected void translateClassEquivalences(Element tell)(Code) | | Translate the class equivalence axioms in the source model into DIG
equalsc axioms.
Parameters: tell - The node representing the DIG tell verb |
translateClassExpressions | protected void translateClassExpressions(Element tell, Property p, int classExprType)(Code) | | Translate class expressions, such as union classes, intersection classes, etc, into the DIG.
concept language. The translations are attached to the given tell node.
Parameters: tell - The node representing the DIG tell verb Parameters: p - A property that will require an implicit equivalence to be made explicitin a correct translation to DIG Parameters: classExprType - Denotes the type of class expression we are translating |
translateClassExpressions | protected void translateClassExpressions(Element tell, StmtIterator i, int classExprType, Model source)(Code) | | A named owl:class with a class-construction axiom directly attached is implicitly
an equivalence axiom with the anonymous class that has the given class construction.
Parameters: tell - The node representing the DIG tell verb Parameters: i - A statement iterator whose subjects denote the class expressions to be translated Parameters: classExprType - Denotes the type of class expression we are translating |
translateClassIdentifier | protected void translateClassIdentifier(Element expr, Resource c)(Code) | | Translate a given class resource into a DIG concept description, as a child
of the given expression element
Parameters: expr - The parent expression element Parameters: c - The concept resource |
translateClassList | protected void translateClassList(Element expr, RDFList operands, Model source)(Code) | | Translate a list of class descriptions into DIG concept descriptions
|
translateClasses | protected void translateClasses(Element tell)(Code) | | Translate all of the classes in the current KB into descriptions
using the DIG concept language, and attach the axioms generated
to the given element.
Parameters: tell - The XML element, typically <tells>, to whichto attach the generated translations. |
translateComplementClass | protected void translateComplementClass(Element expr, OntClass cls, Model source)(Code) | | Translate a complement class to a not element
|
translateDifferentIndividuals | protected void translateDifferentIndividuals(Element expr, Individual ind, Individual other)(Code) | | Translate differentFrom(i0, i1) we assert disjoint( iset(i0), iset(i1) )
|
translateDomainRangeAxioms | protected void translateDomainRangeAxioms(Element expr, String propURI, String axiomType, Iterator i, String propType, Model source)(Code) | | Domain and range are translated as dig domain and range elements
|
translateEnumeratedClass | protected void translateEnumeratedClass(Element expr, OntClass cls, Model source)(Code) | | Translate an enumerated class to an iset element
|
translateHasValueRestriction | protected void translateHasValueRestriction(Element expr, HasValueRestriction r)(Code) | | Translate a has value restriction to DIG form. This is slightly tricky, because there is no
direct translation in the DIG concept language. We translate a has value restriction with an
individual value to a existential restriction of the singleton concept. We translate a has
value restriction with a datatype value either to an exists restriction on an integer
equality or a string equality, depending on the value.
Parameters: expr - The parent expression node Parameters: r - The has value restriction to translate |
translateIndividual | protected void translateIndividual(Element expr, Resource r)(Code) | | Translate the various axioms pertaining to an individual
|
translateIndividuals | protected void translateIndividuals(Element expr)(Code) | | Translate the individuals in the KB to DIG form
|
translateInstanceTypes | protected void translateInstanceTypes(Element expr, Individual ind)(Code) | | The rdf:type of each individual becomes a DIG instanceof element
|
translateIntersectionClass | protected void translateIntersectionClass(Element expr, OntClass cls, Model source)(Code) | | Translate an intersection class to an and element
|
translateInverseAxiom | protected void translateInverseAxiom(Element expr, Property p, String propType, Property inv)(Code) | | Translate inverseOf as equality between the role and the inverse of the named inverse role
|
translateInverseFunctionalAxiom | protected void translateInverseFunctionalAxiom(Element expr, ObjectProperty role, String propType)(Code) | | To translate an inverse functional property, we must introduce a new skolem constant for the inverse role
|
translateKbToDig | public Document translateKbToDig()(Code) | | Answer an XML document that contains the DIG translation of the local graph, wrapped
as a tell verb
An XML document containing the tell verb |
translateLiteral | protected void translateLiteral(Literal lit, Element parent)(Code) | | Translate an RDF literal to an IVAL or SVAL element
|
translateRestrictionClass | protected void translateRestrictionClass(Element expr, Resource c, Model source)(Code) | | Translate a given restriction resource into a DIG concept description, as a child
of the given expression element
Parameters: expr - The parent expression element Parameters: c - The restriction concept resource |
translateRestrictions | protected void translateRestrictions(Element tell)(Code) | | Translate the restrictions in the source model into the DIG concept language.
Parameters: tell - The node representing the DIG tell verb |
translateRoles | protected void translateRoles(Element expr)(Code) | | Translate all of the roles (ObjectProperties) in the KB
|
translateSameIndividuals | protected void translateSameIndividuals(Element expr, Individual ind, Individual other)(Code) | | Translate sameAs(i0, i1) we assert equalc( iset(i0), iset(i1) )
|
translateSubClassAxioms | protected void translateSubClassAxioms(Element tell)(Code) | | Translate the sub-class axioms in the source model into DIG
impliesc axioms
Parameters: tell - The node representing the DIG tell verb |
translateUnaryPropertyAxiom | protected void translateUnaryPropertyAxiom(Element expr, String propURI, String axiomType, String propType)(Code) | | Helper method for unary axioms, the argument of which is an ratom element
|
translateUnionClass | protected void translateUnionClass(Element expr, OntClass cls, Model source)(Code) | | Translate an union class to an or element
|
uploadKB | public boolean uploadKB()(Code) | | Upload the entire contents of the local knowledge base (OWL/DAML model)
to the DIG reasoner, using a single large TELL verb.
True if the ontology model was uploaded to DIG without any warnings. Recent warningsare available via DIGAdapter.getRecentWarnings exception: DigReasonerException - If the upload fails for any reason. The error message fromthe DIG reasoner will be returned. |
|
|