|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hp.hpl.jena.reasoner.dig.DIGAdapter
public class DIGAdapter
An adapter class that mediates between a Jena InfGraph and a DIG reasoner process.
Field Summary | |
---|---|
static java.lang.String |
ANON_MARKER
Mark a bNode identifier |
static java.util.List |
KNOWN_CONCEPTS
Well known concept URI's |
static DIGProfile |
PELLET_PROFILE
DIG profile for Pellet |
static DIGProfile |
RACER_17_PROFILE
DIG profile for 1.7 |
static java.util.List |
XSD_INT_TYPES
Well known integer type URI's, these we will translate into DIG integer attributes |
Constructor Summary | |
---|---|
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. |
|
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. |
Method Summary | |
---|---|
void |
addClassDescription(org.w3c.dom.Element elem,
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. |
void |
addClassDescription(org.w3c.dom.Element elem,
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. |
void |
addClassDescription(org.w3c.dom.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. |
void |
close()
Close this adapter, and release the connector to the external DIG KB. |
org.w3c.dom.Element |
createQueryElement(org.w3c.dom.Document query,
java.lang.String elemName)
Create a new element to represent a query, adding to it a unique query ID. |
ExtendedIterator |
find(TriplePattern pattern)
Basic pattern lookup interface - answer an iterator over the triples matching the given pattern. |
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. |
DIGConnection |
getConnection()
Answer this adapter's connection to the database. |
DIGIdentifier |
getDigIdentifier()
Answer the DIG identification structure we obtain by querying the attached reasoner. |
Graph |
getGraph()
Answer the graph of local (source) data. |
java.lang.String |
getNodeID(Node n)
Answer an identifier for a node, named or anon |
Profile |
getOntLanguage()
Answer the ontology language profile we're assuming in this reasoner. |
DIGProfile |
getProfile()
Answer the DIG profile for the DIG interface this reasoner is attached to. |
DIGQueryTranslator |
getQueryTranslator(TriplePattern pattern,
Model premises)
Answer the query translator that matches the given pattern, if any |
java.util.Iterator |
getRecentWarnings()
Answer an iterator over any recent warnings returned from from the remote DIG reasoner. |
java.lang.String |
getResourceID(Resource r)
Answer an identifier for a resource, named or bNode |
OntModelSpec |
getSourceSpecification()
Answer the ontology language specification for the source model underlying this DIG adapter. |
boolean |
isConcept(Node node,
Model premises)
Answer true if the given node corresponds to one of the concepts known to the DIG reasoner. |
boolean |
isIndividual(Node node)
Answer true if the given node corresponds to one of the individuals known to the DIG reasoner. |
boolean |
isRole(Node node,
Model premises)
Answer true if the given node corresponds to one of the roles known to the DIG reasoner. |
void |
resetKB()
Clear the old contents of the DIG knowledge base |
void |
setProfile(DIGProfile profile)
Set the profile specifying the variable parts of the DIG profile that are being used in this instance. |
org.w3c.dom.Document |
translateKbToDig()
Answer an XML document that contains the DIG translation of the local graph, wrapped as a tell verb |
boolean |
uploadKB()
Upload the entire contents of the local knowledge base (OWL/DAML model) to the DIG reasoner, using a single large TELL verb. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final DIGProfile RACER_17_PROFILE
public static final DIGProfile PELLET_PROFILE
public static final java.lang.String ANON_MARKER
public static final java.util.List KNOWN_CONCEPTS
public static final java.util.List XSD_INT_TYPES
Constructor Detail |
---|
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. Allocates a new
DIG connection using the default connection URL (http://localhost:8081
).
spec
- An ont model spec encoding the ontology language of the source graphsource
- The graph that contains the source data on which the DIG reasoner
will operatepublic 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.
spec
- An ont model spec encoding the ontology language of the source graphsource
- The graph that contains the source data on which the DIG reasoner
will operateconnection
- A pre-configured DIG connection to use to communicate with the
external reasoneraxioms
- A model containing axioms appropriate to the ontology language
this adapter is processing. May be null.Method Detail |
---|
public DIGProfile getProfile()
Answer the DIG profile for the DIG interface this reasoner is attached to.
public void setProfile(DIGProfile profile)
Set the profile specifying the variable parts of the DIG profile that are being used in this instance.
profile
- The new DIG profilepublic Profile getOntLanguage()
Answer the ontology language profile we're assuming in this reasoner.
public DIGIdentifier getDigIdentifier()
Answer the DIG identification structure we obtain by querying the attached reasoner.
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.
getRecentWarnings()
DigReasonerException
- If the upload fails for any reason. The error message from
the DIG reasoner will be returned.public java.util.Iterator getRecentWarnings()
Answer an iterator over any recent warnings returned from from the remote DIG reasoner.
hasNext()
= false.public org.w3c.dom.Document translateKbToDig()
Answer an XML document that contains the DIG translation of the local graph, wrapped as a tell verb
public void resetKB()
Clear the old contents of the DIG knowledge base
public DIGConnection getConnection()
Answer this adapter's connection to the database.
public void close()
Close this adapter, and release the connector to the external DIG KB.
public ExtendedIterator find(TriplePattern pattern)
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.
pattern
- a TriplePattern to be matched against the data
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. Where possible, this query will first be given to the external reasoner, with the local graph used to generate supplemental bindings.
pattern
- a TriplePattern to be matched against the datapremises
- A model containing additional premises for the find query,
typically used to allow the subject and/or object to be an expression
rather than just a simple node
public DIGQueryTranslator getQueryTranslator(TriplePattern pattern, Model premises)
Answer the query translator that matches the given pattern, if any
pattern
- The triple pattern that has been receivedpremises
- A model containing the premises to a query (e.g. a class expression)
public Graph getGraph()
Answer the graph of local (source) data.
public java.lang.String getResourceID(Resource r)
Answer an identifier for a resource, named or bNode
r
- A resource
public java.lang.String getNodeID(Node n)
Answer an identifier for a node, named or anon
n
- An RDF node
public void addClassDescription(org.w3c.dom.Element elem, 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. 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.
elem
- The parent XML element to which the class description will be attachednode
- An RDF graph node representing a class we wish to describe.public void addClassDescription(org.w3c.dom.Element elem, 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. If the class is a named class, this will be
a <catom>
element, otherwise it will be a class description axiom.
elem
- The parent XML element to which the class description will be attachednode
- An RDF graph node representing a class we wish to describe.sourceData
- A model containing the statements about the given class description
resourcepublic void addClassDescription(org.w3c.dom.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. If the class is a named class, this will be
a <catom>
element, otherwise it will be a class description axiom.
elem
- The parent XML element to which the class description will be attachedres
- An RDF resource representing a class we wish to describe.sourceData
- A model containing the statements about the given class description
resourcepublic boolean isIndividual(Node node)
Answer true if the given node corresponds to one of the individuals known to the DIG reasoner.
node
- A node to test
node
is a known individualpublic boolean isRole(Node node, Model premises)
Answer true if the given node corresponds to one of the roles known to the DIG reasoner.
node
- A node to testpremises
- A model defining premises that may encode more information about
node, or may be null
node
is a known rolepublic boolean isConcept(Node node, Model premises)
Answer true if the given node corresponds to one of the concepts known to the DIG reasoner.
node
- A node to testpremises
- A model defining premises that may encode more information about
node, or may be null
node
is a known conceptpublic OntModelSpec getSourceSpecification()
Answer the ontology language specification for the source model underlying this DIG adapter.
public org.w3c.dom.Element createQueryElement(org.w3c.dom.Document query, java.lang.String elemName)
Create a new element to represent a query, adding to it a unique query ID.
query
- The query documentelemName
- The string name of the query element
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |