Hi,
On 12/02/16 13:27, Valerio Belcastro wrote:
Hi guys,
I'm using Jena(v3.0.1) to build a sematic web application.
Suppose I need to query a Dataset
<https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/query/Dataset.html>
(which
can be stored in memory, on disk, or on a remote server). This dataset can
contain models with inferred statements. I know that it is possible to
retrieve statements from that dataset using QueryExecution
<https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/query/QueryExecution.html>
class,
but it also includes inferred statements.
My question is: is there a way to exclude inferred statements when querying
a Jena Dataset?
Depends on how you got those inferred statements in there.
In Jena inference only takes place over models not entire datasets. An
InfModel is a wrapper around some base model, which makes the inferences
"appear". So if you want to query without seeing inferences then you
just query the base model instead of the InfModel.
In moving to datasets then it is up to the application how it creates those.
What people sometimes do is create a Dataset where some graphs contain
base statements and others contain inferences that they have
materialized. In that case you simply choose which graph you query.
Other times people just store the data along with all the materialized
inferences in a single graph. In that case you no longer know which are
which.
Dave