Discussion:
Queries against rules
tina sani
2016-11-08 16:31:51 UTC
Permalink
Hello
I have a text file, having more than twenty Jena rules. Usually we need
SPARQL queries to execute and display the inference results.

For my twenty rules, I need more or less ten queries, so what will be the
sequence and proper way to use SPARQL queries?
I have some inverse property rules, symmetric, transitive and most are Jena
generic rules used in the text file.

Thanks a lot.
David Moss
2016-11-08 17:16:42 UTC
Permalink
It is my understanding that you use OWL rules in your model to create relationships between objects.
You can then query the model using SPARQL and a reasoner.
The SPARQL will then not only return the triples explicitly matched, but those that can be inferred using the rules too.

See https://jena.apache.org/documentation/inference/





On 9/11/16, 2:31 am, "tina sani" <***@gmail.com> wrote:

Hello
I have a text file, having more than twenty Jena rules. Usually we need
SPARQL queries to execute and display the inference results.

For my twenty rules, I need more or less ten queries, so what will be the
sequence and proper way to use SPARQL queries?
I have some inverse property rules, symmetric, transitive and most are Jena
generic rules used in the text file.

Thanks a lot.
tina sani
2016-11-08 17:24:30 UTC
Permalink
Hello David, I am sorry but I did not understand "use OWL rules in your
model to create relationships between objects"

The Jena rules we use are not OWL specific? You mean rules in the Protege?
Post by David Moss
It is my understanding that you use OWL rules in your model to create
relationships between objects.
You can then query the model using SPARQL and a reasoner.
The SPARQL will then not only return the triples explicitly matched, but
those that can be inferred using the rules too.
See https://jena.apache.org/documentation/inference/
Hello
I have a text file, having more than twenty Jena rules. Usually we need
SPARQL queries to execute and display the inference results.
For my twenty rules, I need more or less ten queries, so what will be the
sequence and proper way to use SPARQL queries?
I have some inverse property rules, symmetric, transitive and most are Jena
generic rules used in the text file.
Thanks a lot.
David Moss
2016-11-08 17:36:32 UTC
Permalink
OWL is just one way of specifying relationships. When you build relationships in Protégé you end up with a .owl file that can be imported into Fuseki.
The triple-store will then contain triples describing your objects and their relationships. Some of the relationships stored as triples will be those you set up in Protégé.
Domain and range information for instance. Subclass and superclass. Same-as.Disjoint-with etc. All this is stored in the triple store along with your objects and explicit relationships.

You create an inference model from the data using Jena, then query the inference model.
The reasoner you use on the model will parse the rules and make inferences.
So if you make cats and dog each a subclass-of mammal and mammal a same-as of animal, a SPARQL query listing all animals will find dog and cat.

Read the link I provided for more.

DM


On 9/11/16, 3:24 am, "tina sani" <***@gmail.com> wrote:

Hello David, I am sorry but I did not understand "use OWL rules in your
model to create relationships between objects"
for instance.
The Jena rules we use are not OWL specific? You mean rules in the Protege?
Post by David Moss
It is my understanding that you use OWL rules in your model to create
relationships between objects.
You can then query the model using SPARQL and a reasoner.
The SPARQL will then not only return the triples explicitly matched, but
those that can be inferred using the rules too.
See https://jena.apache.org/documentation/inference/
Hello
I have a text file, having more than twenty Jena rules. Usually we need
SPARQL queries to execute and display the inference results.
For my twenty rules, I need more or less ten queries, so what will be the
sequence and proper way to use SPARQL queries?
I have some inverse property rules, symmetric, transitive and most are Jena
generic rules used in the text file.
Thanks a lot.
Lorenz B.
2016-11-09 08:37:35 UTC
Permalink
Post by tina sani
Hello
I have a text file, having more than twenty Jena rules. Usually we need
SPARQL queries to execute and display the inference results.
For my twenty rules, I need more or less ten queries, so what will be the
sequence and proper way to use SPARQL queries?
What means "query for a rule"?
Rules are used to infer(generate) additional data based on existing data.

1) Load all rules into a the GenericRuleReasoner and apply it on the
original data -> you get a new model

Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules));
InfModel inf = ModelFactory.createInfModel(reasoner, rawData);


2) execute the SPARQL query against the new model which contains all the
data

Lorenz
Post by tina sani
I have some inverse property rules, symmetric, transitive and most are Jena
generic rules used in the text file.
Thanks a lot.
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
tina sani
2016-11-09 13:18:31 UTC
Permalink
Hello Lorenz, I know rules generate new tripls based on existed data, but I
have to questions:

(1) We have a model i-e model before Jena rules executes and then after
inference/rules, our model will be inf, right? If we want to write a model,
we will use inf.write()?

(2) My second query is, after rules, I will have several SPARQL queries run
against the rules so what will be the order in which we write/run queries.
It will be like queryString, execute query, then another queryString,
execute query?

Regards

On Wed, Nov 9, 2016 at 10:37 AM, Lorenz B. <
Post by Lorenz B.
Post by tina sani
Hello
I have a text file, having more than twenty Jena rules. Usually we need
SPARQL queries to execute and display the inference results.
For my twenty rules, I need more or less ten queries, so what will be the
sequence and proper way to use SPARQL queries?
What means "query for a rule"?
Rules are used to infer(generate) additional data based on existing data.
1) Load all rules into a the GenericRuleReasoner and apply it on the
original data -> you get a new model
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules));
InfModel inf = ModelFactory.createInfModel(reasoner, rawData);
2) execute the SPARQL query against the new model which contains all the
data
Lorenz
Post by tina sani
I have some inverse property rules, symmetric, transitive and most are
Jena
Post by tina sani
generic rules used in the text file.
Thanks a lot.
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Lorenz Buehmann
2016-11-09 14:50:38 UTC
Permalink
Post by tina sani
Hello Lorenz, I know rules generate new tripls based on existed data, but I
(1) We have a model i-e model before Jena rules executes and then after
inference/rules, our model will be inf, right? If we want to write a model,
we will use inf.write()?
Yes.
Post by tina sani
(2) My second query is, after rules, I will have several SPARQL queries run
against the rules so what will be the order in which we write/run queries.
It will be like queryString, execute query, then another queryString,
execute query?
What means "query against rule"? That's totally unclear. You run the
SPARQL query on the inferred model.

And why should the order in which you run the SPARQL queries matter?
What would be the difference if you first run

SELECT * {?s a :cls}

and then

SELECT * {?s ?p ?o}

or vice versa?
Post by tina sani
Regards
On Wed, Nov 9, 2016 at 10:37 AM, Lorenz B. <
Post by Lorenz B.
Post by tina sani
Hello
I have a text file, having more than twenty Jena rules. Usually we need
SPARQL queries to execute and display the inference results.
For my twenty rules, I need more or less ten queries, so what will be the
sequence and proper way to use SPARQL queries?
What means "query for a rule"?
Rules are used to infer(generate) additional data based on existing data.
1) Load all rules into a the GenericRuleReasoner and apply it on the
original data -> you get a new model
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules));
InfModel inf = ModelFactory.createInfModel(reasoner, rawData);
2) execute the SPARQL query against the new model which contains all the
data
Lorenz
Post by tina sani
I have some inverse property rules, symmetric, transitive and most are
Jena
Post by tina sani
generic rules used in the text file.
Thanks a lot.
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Continue reading on narkive:
Loading...