Package virtuoso.jena.driver
Class VirtInfGraph
- java.lang.Object
-
- org.apache.jena.graph.impl.GraphBase
-
- virtuoso.jena.driver.VirtGraph
-
- virtuoso.jena.driver.VirtInfGraph
-
- All Implemented Interfaces:
org.apache.jena.graph.Graph
,org.apache.jena.graph.impl.GraphWithPerform
,org.apache.jena.reasoner.InfGraph
public class VirtInfGraph extends VirtGraph implements org.apache.jena.reasoner.InfGraph
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
recordDerivations
-
Fields inherited from class virtuoso.jena.driver.VirtGraph
BATCH_SIZE, batchSize, CONCUR_DEFAULT, CONCUR_OPTIMISTIC, CONCUR_PESSIMISTIC, concurencyMode, connection, DEFAULT, graphName, insertBNodeAsVirtuosoIRI, insertStringLiteralAsSimple, isXA, m_prefixMapping, macroLib, MAX_CMD_SIZE, parent_dataset, password, prefetchSize, queryTimeout, readFromAllGraphs, resetBNodesDictAfterCall, resetBNodesDictAfterCommit, roundrobin, ruleSet, S_BATCH_INSERT, sparqlPrefix, tranHandler, url_hostlist, user, useReprepare, useSameAs
-
-
Constructor Summary
Constructors Constructor Description VirtInfGraph(java.lang.String _ruleSet, boolean useSameAs, java.lang.String graphName)
VirtInfGraph(java.lang.String _ruleSet, boolean useSameAs, java.lang.String graphName, java.lang.String url_hostlist, java.lang.String user, java.lang.String password)
VirtInfGraph(java.lang.String _ruleSet, boolean useSameAs, java.lang.String graphName, java.lang.String url_hostlist, java.lang.String user, java.lang.String password, boolean roundrobin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.jena.graph.Graph
cloneWithPremises(org.apache.jena.graph.Graph premises)
Return a new inference graph which is a clone of the current graph together with an additional set of data premises.org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Triple>
find(org.apache.jena.graph.Node subject, org.apache.jena.graph.Node property, org.apache.jena.graph.Node object, org.apache.jena.graph.Graph param)
An extension of the Graph.find interface which allows the caller to encode complex expressions in RDF and then refer to those expressions within the query triple.org.apache.jena.graph.Graph
getDeductionsGraph()
Returns a derivations graph.java.util.Iterator<org.apache.jena.reasoner.Derivation>
getDerivation(org.apache.jena.graph.Triple triple)
Return the derivation of the given triple (which is the result of some previous find operation).org.apache.jena.graph.Node
getGlobalProperty(org.apache.jena.graph.Node property)
Test a global boolean property of the graph.org.apache.jena.graph.Graph
getRawGraph()
Return the raw RDF data Graph being processed (i.e.org.apache.jena.reasoner.Reasoner
getReasoner()
Return the Reasoner which is being used to answer queries to this graph.void
prepare()
Perform any initial processing and caching.void
rebind()
Cause the inference graph to reconsult the underlying graph to take into account changes.void
rebind(org.apache.jena.graph.Graph data)
Replace the underlying data graph for this inference graph and start any inferences over again.void
reset()
Reset any internal caches.void
setDerivationLogging(boolean logOn)
Switch on/off drivation loggingboolean
testGlobalProperty(org.apache.jena.graph.Node property)
A convenience version of getGlobalProperty which can only return a boolean result.org.apache.jena.reasoner.ValidityReport
validate()
Test the consistency of the bound data.-
Methods inherited from class virtuoso.jena.driver.VirtGraph
add, appendSparqlPrefixes, bindBatchParams, clear, clear, close, createBNodesDict, createRuleSet, createStatement, delete, dropBNodesDict, getBatchSize, getConcurrencyMode, getConnection, getCount, getDataSource, getFetchSize, getGraphName, getGraphPassword, getGraphUrl, getGraphUser, getInsertBNodeAsVirtuosoIRI, getInsertStringLiteralAsSimple, getJdbcConcurrency, getMacroLib, getPrefixMapping, getQueryTimeout, getReadFromAllGraphs, getResetBNodesDictAfterCall, getResetBNodesDictAfterCommit, getRuleSet, getSameAs, getSparqlPrefix, getTransactionHandler, getXAResource, graphBaseContains, graphBaseContains, graphBaseFind, graphBaseFind, graphBaseSize, md_delete_Model, Node2Str, Node2Str_add, Object2Node, performAdd, performAdd, performAdd, performDelete, performDelete, prepareStatement, read, reifierSize, reifierTriples, remove, remove, removeRuleSet, setBatchSize, setConcurrencyMode, setFetchSize, setGraphName, setInsertBNodeAsVirtuosoIRI, setInsertStringLiteralAsSimple, setMacroLib, setQueryTimeout, setReadFromAllGraphs, setResetBNodesDictAfterCall, setResetBNodesDictAfterCommit, setRuleSet, setSameAs, setSparqlPrefix, startBatchAdd, stopBatchAdd
-
Methods inherited from class org.apache.jena.graph.impl.GraphBase
add, checkOpen, contains, contains, containsByFind, createPrefixMapping, createStatisticsHandler, delete, dependsOn, find, find, forTestingOnly_graphBaseFind, getCapabilities, getEventManager, getStatisticsHandler, graphBaseFind, isClosed, isEmpty, isIsomorphicWith, notifyAdd, notifyDelete, remove, size, toString, toString
-
-
-
-
Constructor Detail
-
VirtInfGraph
public VirtInfGraph(java.lang.String _ruleSet, boolean useSameAs, java.lang.String graphName)
-
VirtInfGraph
public VirtInfGraph(java.lang.String _ruleSet, boolean useSameAs, java.lang.String graphName, java.lang.String url_hostlist, java.lang.String user, java.lang.String password)
-
VirtInfGraph
public VirtInfGraph(java.lang.String _ruleSet, boolean useSameAs, java.lang.String graphName, java.lang.String url_hostlist, java.lang.String user, java.lang.String password, boolean roundrobin)
-
-
Method Detail
-
getRawGraph
public org.apache.jena.graph.Graph getRawGraph()
Return the raw RDF data Graph being processed (i.e. the argument to the Reasonder.bind call that created this InfGraph).- Specified by:
getRawGraph
in interfaceorg.apache.jena.reasoner.InfGraph
-
getReasoner
public org.apache.jena.reasoner.Reasoner getReasoner()
Return the Reasoner which is being used to answer queries to this graph.- Specified by:
getReasoner
in interfaceorg.apache.jena.reasoner.InfGraph
-
rebind
public void rebind(org.apache.jena.graph.Graph data)
Replace the underlying data graph for this inference graph and start any inferences over again. This is primarily using in setting up ontology imports processing to allow an imports multiunion graph to be inserted between the inference graph and the raw data, before processing.- Specified by:
rebind
in interfaceorg.apache.jena.reasoner.InfGraph
- Parameters:
data
- the new raw data graph
-
rebind
public void rebind()
Cause the inference graph to reconsult the underlying graph to take into account changes. Normally changes are made through the InfGraph's add and remove calls are will be handled appropriately. However, in some cases changes are made "behind the InfGraph's back" and this forces a full reconsult of the changed data.- Specified by:
rebind
in interfaceorg.apache.jena.reasoner.InfGraph
-
prepare
public void prepare()
Perform any initial processing and caching. This call is optional. Most engines either have negligable set up work or will perform an implicit "prepare" if necessary. The call is provided for those occasions where substantial preparation work is possible (e.g. running a forward chaining rule system) and where an application might wish greater control over when this prepration is done.- Specified by:
prepare
in interfaceorg.apache.jena.reasoner.InfGraph
-
reset
public void reset()
Reset any internal caches. Some systems, such as the tabled backchainer, retain information after each query. A reset will wipe this information preventing unbounded memory use at the expense of more expensive future queries. A reset does not cause the raw data to be reconsulted and so is less expensive than a rebind.- Specified by:
reset
in interfaceorg.apache.jena.reasoner.InfGraph
-
getGlobalProperty
public org.apache.jena.graph.Node getGlobalProperty(org.apache.jena.graph.Node property)
Test a global boolean property of the graph. This might included properties like consistency, OWLSyntacticValidity etc. It remains to be seen what level of generality is needed here. We could replace this by a small number of specific tests for common concepts.- Specified by:
getGlobalProperty
in interfaceorg.apache.jena.reasoner.InfGraph
- Parameters:
property
- the URI of the property to be tested- Returns:
- a Node giving the value of the global property, this may be a boolean literal, some other literal value (e.g. a size).
-
testGlobalProperty
public boolean testGlobalProperty(org.apache.jena.graph.Node property)
A convenience version of getGlobalProperty which can only return a boolean result.- Specified by:
testGlobalProperty
in interfaceorg.apache.jena.reasoner.InfGraph
-
validate
public org.apache.jena.reasoner.ValidityReport validate()
Test the consistency of the bound data. This normally tests the validity of the bound instance data against the bound schema data.- Specified by:
validate
in interfaceorg.apache.jena.reasoner.InfGraph
- Returns:
- a ValidityReport structure
-
find
public org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Triple> find(org.apache.jena.graph.Node subject, org.apache.jena.graph.Node property, org.apache.jena.graph.Node object, org.apache.jena.graph.Graph param)
An extension of the Graph.find interface which allows the caller to encode complex expressions in RDF and then refer to those expressions within the query triple. For example, one might encode a class expression and then ask if there are any instances of this class expression in the InfGraph.- Specified by:
find
in interfaceorg.apache.jena.reasoner.InfGraph
- Parameters:
subject
- the subject Node of the query triple, may be a Node in the graph or a node in the parameter micro-graph or nullproperty
- the property to be retrieved or nullobject
- the object Node of the query triple, may be a Node in the graph or a node in the parameter micro-graph.param
- a small graph encoding an expression which the subject and/or object nodes refer.
-
cloneWithPremises
public org.apache.jena.graph.Graph cloneWithPremises(org.apache.jena.graph.Graph premises)
Return a new inference graph which is a clone of the current graph together with an additional set of data premises. The default implementation loses ALL partial deductions so far. Some subclasses may be able to a more efficient job.
-
setDerivationLogging
public void setDerivationLogging(boolean logOn)
Switch on/off drivation logging- Specified by:
setDerivationLogging
in interfaceorg.apache.jena.reasoner.InfGraph
-
getDerivation
public java.util.Iterator<org.apache.jena.reasoner.Derivation> getDerivation(org.apache.jena.graph.Triple triple)
Return the derivation of the given triple (which is the result of some previous find operation). Not all reasoneers will support derivations.- Specified by:
getDerivation
in interfaceorg.apache.jena.reasoner.InfGraph
- Returns:
- an iterator over Derivation records or null if there is no derivation information available for this triple.
-
getDeductionsGraph
public org.apache.jena.graph.Graph getDeductionsGraph()
Returns a derivations graph. The rule reasoners typically create a graph containing those triples added to the base graph due to rule firings. In some applications it can useful to be able to access those deductions directly, without seeing the raw data which triggered them. In particular, this allows the forward rules to be used as if they were rewrite transformation rules.- Specified by:
getDeductionsGraph
in interfaceorg.apache.jena.reasoner.InfGraph
- Returns:
- the deductions graph, if relevant for this class of inference engine or null if not.
-
-