Discussion:
Super classes/Sub classes in Jena rules
tina sani
2016-11-22 10:12:51 UTC
Permalink
[image: Inline image 1]

I have this ontology: Now if I want to use some rules like

if x rdf:type Employee and ?x salary>Euro10,000. then ?x QualifiedEmployee.

My question here is should I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee or PermanantEmployee

ContractEmployee or PermanantEmployee does not have any instances, all
instances will be either FinanceManager, ITManager, Developer or Analyst..
Dave Reynolds
2016-11-22 14:30:23 UTC
Permalink
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't come through.

However, I'm guessing it included a class Employee with sub-classes
ContractEmployee and PermanantEmployee.
Post by tina sani
I have this ontology: Now if I want to use some rules like
if x rdf:type Employee and ?x salary>Euro10,000. then ?x QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee or PermanantEmployee
Depends on your set up.

You could have an inference model with the appropriate configuration to
deduce membership of employee and then query that with SPARQL or with a
second inference model with your own rules in.

If you want just one layer of rules and want to combine OWL/RDFS with
your custom rules then that's possible (so long as you set all the
appropriate flags, see documentation) but make sure that your own rules
are backward not forward rules. [The default Jena rule sets for RDFS and
OWL are hybrid rules so some of the inferences are only available to
backward rules in the same rule set.]

Or if you don't want the cost of full inference then you can indeed
rewrite the "natural" query to explicitly check for the base memberships.

Dave
tina sani
2016-11-22 14:56:28 UTC
Permalink
Let me explain a bit.

String rule = "[rule1:(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary ?salary )"
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"


Classes in my ontology are

Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer

In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager , ITManager
or Analyst, Programmer*

*Is it must that if I use ?x rdf:type Employee, then FinanceManager &
ITManager should also be sub classes of general super class "Employee" ?*
Post by Dave Reynolds
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't come through.
However, I'm guessing it included a class Employee with sub-classes
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate configuration to
deduce membership of employee and then query that with SPARQL or with a
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS with your
custom rules then that's possible (so long as you set all the appropriate
flags, see documentation) but make sure that your own rules are backward
not forward rules. [The default Jena rule sets for RDFS and OWL are hybrid
rules so some of the inferences are only available to backward rules in the
same rule set.]
Or if you don't want the cost of full inference then you can indeed
rewrite the "natural" query to explicitly check for the base memberships.
Dave
Dave Reynolds
2016-11-22 15:03:14 UTC
Permalink
Post by tina sani
Let me explain a bit.
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary ?salary )"
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager , ITManager
or Analyst, Programmer*
*Is it must that if I use ?x rdf:type Employee, then FinanceManager &
ITManager should also be sub classes of general super class "Employee" ?*
I don't think any of these details change my earlier answer, quoted below.

Dave
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't come through.
However, I'm guessing it included a class Employee with sub-classes
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate configuration to
deduce membership of employee and then query that with SPARQL or with a
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS with your
custom rules then that's possible (so long as you set all the appropriate
flags, see documentation) but make sure that your own rules are backward
not forward rules. [The default Jena rule sets for RDFS and OWL are hybrid
rules so some of the inferences are only available to backward rules in the
same rule set.]
Or if you don't want the cost of full inference then you can indeed
rewrite the "natural" query to explicitly check for the base memberships.
Dave
tina sani
2016-11-22 15:15:24 UTC
Permalink
Ok sorry Dave, actually I did not completely understand your answer.

"You could have an inference model with the appropriate configuration to
deduce membership of employee"

Yes I have the inference model:
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner, model);

Query query = QueryFactory.create(queryString);

QueryExecution qe = QueryExecutionFactory.create(query, infer);

What additionally I have to do apart from my Jena rule (Forward Chain)
mentioned in previous email and the inference model.

And of course, I will have a SPARQL query :
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
Post by Dave Reynolds
Post by tina sani
Let me explain a bit.
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary ?salary )"
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager , ITManager
or Analyst, Programmer*
*Is it must that if I use ?x rdf:type Employee, then FinanceManager &
ITManager should also be sub classes of general super class "Employee" ?*
I don't think any of these details change my earlier answer, quoted below.
Dave
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't come through.
However, I'm guessing it included a class Employee with sub-classes
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate configuration to
deduce membership of employee and then query that with SPARQL or with a
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS with your
custom rules then that's possible (so long as you set all the appropriate
flags, see documentation) but make sure that your own rules are backward
not forward rules. [The default Jena rule sets for RDFS and OWL are hybrid
rules so some of the inferences are only available to backward rules in the
same rule set.]
Or if you don't want the cost of full inference then you can indeed
rewrite the "natural" query to explicitly check for the base memberships.
Dave
Lorenz B.
2016-11-23 08:50:08 UTC
Permalink
Dave meant that you need an additional layer of reasoning like RDFS or
even less to get the inferences that you describe.
This can be done by

a) nesting two InfModels one that works on your specific rules and one
that uses some kind of RDFS or
b) adding the particular rules to your set of rules
Post by tina sani
Ok sorry Dave, actually I did not completely understand your answer.
"You could have an inference model with the appropriate configuration to
deduce membership of employee"
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner, model);
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query, infer);
What additionally I have to do apart from my Jena rule (Forward Chain)
mentioned in previous email and the inference model.
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
Post by Dave Reynolds
Post by tina sani
Let me explain a bit.
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary ?salary )"
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager , ITManager
or Analyst, Programmer*
*Is it must that if I use ?x rdf:type Employee, then FinanceManager &
ITManager should also be sub classes of general super class "Employee" ?*
I don't think any of these details change my earlier answer, quoted below.
Dave
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't come through.
However, I'm guessing it included a class Employee with sub-classes
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate configuration to
deduce membership of employee and then query that with SPARQL or with a
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS with your
custom rules then that's possible (so long as you set all the appropriate
flags, see documentation) but make sure that your own rules are backward
not forward rules. [The default Jena rule sets for RDFS and OWL are hybrid
rules so some of the inferences are only available to backward rules in the
same rule set.]
Or if you don't want the cost of full inference then you can indeed
rewrite the "natural" query to explicitly check for the base memberships.
Dave
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
tina sani
2016-11-23 12:50:39 UTC
Permalink
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel, will it do
the RDFS reasoning?

b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email. You means
rules other than that?

On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Post by Lorenz B.
Dave meant that you need an additional layer of reasoning like RDFS or
even less to get the inferences that you describe.
This can be done by
a) nesting two InfModels one that works on your specific rules and one
that uses some kind of RDFS or
b) adding the particular rules to your set of rules
Post by tina sani
Ok sorry Dave, actually I did not completely understand your answer.
"You could have an inference model with the appropriate configuration to
deduce membership of employee"
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner, model);
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query, infer);
What additionally I have to do apart from my Jena rule (Forward Chain)
mentioned in previous email and the inference model.
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by Dave Reynolds
Post by tina sani
Let me explain a bit.
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
Post by tina sani
Post by Dave Reynolds
Post by tina sani
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary ?salary )"
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager ,
ITManager
Post by tina sani
Post by Dave Reynolds
Post by tina sani
or Analyst, Programmer*
*Is it must that if I use ?x rdf:type Employee, then FinanceManager &
ITManager should also be sub classes of general super class "Employee"
?*
Post by tina sani
Post by Dave Reynolds
I don't think any of these details change my earlier answer, quoted
below.
Post by tina sani
Post by Dave Reynolds
Dave
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't come through.
However, I'm guessing it included a class Employee with sub-classes
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate configuration
to
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
deduce membership of employee and then query that with SPARQL or with
a
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS with your
custom rules then that's possible (so long as you set all the
appropriate
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
flags, see documentation) but make sure that your own rules are
backward
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
not forward rules. [The default Jena rule sets for RDFS and OWL are hybrid
rules so some of the inferences are only available to backward rules
in
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
the
same rule set.]
Or if you don't want the cost of full inference then you can indeed
rewrite the "natural" query to explicitly check for the base
memberships.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Dave
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Lorenz B.
2016-11-24 08:39:13 UTC
Permalink
Post by tina sani
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel, will it do
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup an
RDFS reasoner

InfModel inf = ModelFactory.createRDFSModel(rdfsExample);

or

Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);

[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
Post by tina sani
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email. You means
rules other than that?
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would have to
add the rules that do the rdfs:subClass/rdf:type inference.
Post by tina sani
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Post by Lorenz B.
Dave meant that you need an additional layer of reasoning like RDFS or
even less to get the inferences that you describe.
This can be done by
a) nesting two InfModels one that works on your specific rules and one
that uses some kind of RDFS or
b) adding the particular rules to your set of rules
Post by tina sani
Ok sorry Dave, actually I did not completely understand your answer.
"You could have an inference model with the appropriate configuration to
deduce membership of employee"
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner, model);
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query, infer);
What additionally I have to do apart from my Jena rule (Forward Chain)
mentioned in previous email and the inference model.
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by Dave Reynolds
Post by tina sani
Let me explain a bit.
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
Post by tina sani
Post by Dave Reynolds
Post by tina sani
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary ?salary )"
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager ,
ITManager
Post by tina sani
Post by Dave Reynolds
Post by tina sani
or Analyst, Programmer*
*Is it must that if I use ?x rdf:type Employee, then FinanceManager &
ITManager should also be sub classes of general super class "Employee"
?*
Post by tina sani
Post by Dave Reynolds
I don't think any of these details change my earlier answer, quoted
below.
Post by tina sani
Post by Dave Reynolds
Dave
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't come through.
However, I'm guessing it included a class Employee with sub-classes
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate configuration
to
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
deduce membership of employee and then query that with SPARQL or with
a
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS with your
custom rules then that's possible (so long as you set all the
appropriate
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
flags, see documentation) but make sure that your own rules are
backward
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
not forward rules. [The default Jena rule sets for RDFS and OWL are hybrid
rules so some of the inferences are only available to backward rules
in
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
the
same rule set.]
Or if you don't want the cost of full inference then you can indeed
rewrite the "natural" query to explicitly check for the base
memberships.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Dave
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
tina sani
2016-11-25 11:17:53 UTC
Permalink
Yes I use GenericRuleReasoner, so using the following rules along with my
own rules will solve the problem?

?x rdfs:subClassOf emp:ContractEmployee--> ?x rdfs:subClassOf emp:Employee
?x rdfs:subClassOf emp:PermanantEmployee--> ?x rdfs:subClassOf emp:Employee

On Thu, Nov 24, 2016 at 11:39 AM, Lorenz B. <
Post by Lorenz B.
Post by tina sani
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel, will
it do
Post by tina sani
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup an
RDFS reasoner
InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
or
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);
[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
Post by tina sani
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email. You means
rules other than that?
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would have to
add the rules that do the rdfs:subClass/rdf:type inference.
Post by tina sani
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Post by Lorenz B.
Dave meant that you need an additional layer of reasoning like RDFS or
even less to get the inferences that you describe.
This can be done by
a) nesting two InfModels one that works on your specific rules and one
that uses some kind of RDFS or
b) adding the particular rules to your set of rules
Post by tina sani
Ok sorry Dave, actually I did not completely understand your answer.
"You could have an inference model with the appropriate configuration
to
Post by tina sani
Post by Lorenz B.
Post by tina sani
deduce membership of employee"
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner, model);
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query, infer);
What additionally I have to do apart from my Jena rule (Forward Chain)
mentioned in previous email and the inference model.
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by Dave Reynolds
Post by tina sani
Let me explain a bit.
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
Post by tina sani
Post by Dave Reynolds
Post by tina sani
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary ?salary
)"
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager ,
ITManager
Post by tina sani
Post by Dave Reynolds
Post by tina sani
or Analyst, Programmer*
*Is it must that if I use ?x rdf:type Employee, then FinanceManager &
ITManager should also be sub classes of general super class
"Employee"
Post by tina sani
Post by Lorenz B.
?*
Post by tina sani
Post by Dave Reynolds
I don't think any of these details change my earlier answer, quoted
below.
Post by tina sani
Post by Dave Reynolds
Dave
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't come through.
However, I'm guessing it included a class Employee with sub-classes
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x
rdf:type
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate configuration
to
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
deduce membership of employee and then query that with SPARQL or
with
Post by tina sani
Post by Lorenz B.
a
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS
with
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
your
custom rules then that's possible (so long as you set all the
appropriate
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
flags, see documentation) but make sure that your own rules are
backward
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
not forward rules. [The default Jena rule sets for RDFS and OWL are hybrid
rules so some of the inferences are only available to backward rules
in
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
the
same rule set.]
Or if you don't want the cost of full inference then you can indeed
rewrite the "natural" query to explicitly check for the base
memberships.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Dave
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Lorenz B.
2016-11-25 12:59:42 UTC
Permalink
Post by tina sani
Yes I use GenericRuleReasoner, so using the following rules along with my
own rules will solve the problem?
?x rdfs:subClassOf emp:ContractEmployee--> ?x rdfs:subClassOf emp:Employee
?x rdfs:subClassOf emp:PermanantEmployee--> ?x rdfs:subClassOf emp:Employee
That might be incomplete as rdfs:subClassOf is transitive. Simply use
the RDFS reasoning.
Post by tina sani
On Thu, Nov 24, 2016 at 11:39 AM, Lorenz B. <
Post by Lorenz B.
Post by tina sani
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel, will
it do
Post by tina sani
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup an
RDFS reasoner
InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
or
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);
[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
Post by tina sani
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email. You means
rules other than that?
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would have to
add the rules that do the rdfs:subClass/rdf:type inference.
Post by tina sani
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Post by Lorenz B.
Dave meant that you need an additional layer of reasoning like RDFS or
even less to get the inferences that you describe.
This can be done by
a) nesting two InfModels one that works on your specific rules and one
that uses some kind of RDFS or
b) adding the particular rules to your set of rules
Post by tina sani
Ok sorry Dave, actually I did not completely understand your answer.
"You could have an inference model with the appropriate configuration
to
Post by tina sani
Post by Lorenz B.
Post by tina sani
deduce membership of employee"
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner, model);
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query, infer);
What additionally I have to do apart from my Jena rule (Forward Chain)
mentioned in previous email and the inference model.
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by Dave Reynolds
Post by tina sani
Let me explain a bit.
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
Post by tina sani
Post by Dave Reynolds
Post by tina sani
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary ?salary
)"
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager ,
ITManager
Post by tina sani
Post by Dave Reynolds
Post by tina sani
or Analyst, Programmer*
*Is it must that if I use ?x rdf:type Employee, then FinanceManager &
ITManager should also be sub classes of general super class
"Employee"
Post by tina sani
Post by Lorenz B.
?*
Post by tina sani
Post by Dave Reynolds
I don't think any of these details change my earlier answer, quoted
below.
Post by tina sani
Post by Dave Reynolds
Dave
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't come through.
However, I'm guessing it included a class Employee with sub-classes
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x
rdf:type
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate configuration
to
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
deduce membership of employee and then query that with SPARQL or
with
Post by tina sani
Post by Lorenz B.
a
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS
with
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
your
custom rules then that's possible (so long as you set all the
appropriate
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
flags, see documentation) but make sure that your own rules are
backward
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
not forward rules. [The default Jena rule sets for RDFS and OWL are hybrid
rules so some of the inferences are only available to backward rules
in
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
the
same rule set.]
Or if you don't want the cost of full inference then you can indeed
rewrite the "natural" query to explicitly check for the base
memberships.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Dave
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
tina sani
2016-11-25 13:46:30 UTC
Permalink
So all I should so is to create rdfs model:

InfModel inf2 = ModelFactory.createRDFSModel();

What would be the arguments of the ModelFactory.createRDFSModel(). I
have two models here, one the simple non inference model and other the
inference model : InfModel inf = ModelFactory.createInfModel(reasoner,
model);




On Fri, Nov 25, 2016 at 3:59 PM, Lorenz B. <
Post by tina sani
Post by tina sani
Yes I use GenericRuleReasoner, so using the following rules along with my
own rules will solve the problem?
?x rdfs:subClassOf emp:ContractEmployee--> ?x rdfs:subClassOf
emp:Employee
Post by tina sani
?x rdfs:subClassOf emp:PermanantEmployee--> ?x rdfs:subClassOf
emp:Employee
That might be incomplete as rdfs:subClassOf is transitive. Simply use
the RDFS reasoning.
Post by tina sani
On Thu, Nov 24, 2016 at 11:39 AM, Lorenz B. <
Post by Lorenz B.
Post by tina sani
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel, will
it do
Post by tina sani
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup an
RDFS reasoner
InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
or
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);
[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
Post by tina sani
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email. You
means
Post by tina sani
Post by Lorenz B.
Post by tina sani
rules other than that?
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would have to
add the rules that do the rdfs:subClass/rdf:type inference.
Post by tina sani
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Post by Lorenz B.
Dave meant that you need an additional layer of reasoning like RDFS or
even less to get the inferences that you describe.
This can be done by
a) nesting two InfModels one that works on your specific rules and one
that uses some kind of RDFS or
b) adding the particular rules to your set of rules
Post by tina sani
Ok sorry Dave, actually I did not completely understand your answer.
"You could have an inference model with the appropriate configuration
to
Post by tina sani
Post by Lorenz B.
Post by tina sani
deduce membership of employee"
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner,
model);
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query, infer);
What additionally I have to do apart from my Jena rule (Forward
Chain)
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
mentioned in previous email and the inference model.
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by Dave Reynolds
Post by tina sani
Let me explain a bit.
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
Post by tina sani
Post by Dave Reynolds
Post by tina sani
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary ?salary
)"
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager ,
ITManager
Post by tina sani
Post by Dave Reynolds
Post by tina sani
or Analyst, Programmer*
*Is it must that if I use ?x rdf:type Employee, then
FinanceManager &
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
ITManager should also be sub classes of general super class
"Employee"
Post by tina sani
Post by Lorenz B.
?*
Post by tina sani
Post by Dave Reynolds
I don't think any of these details change my earlier answer, quoted
below.
Post by tina sani
Post by Dave Reynolds
Dave
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't come
through.
However, I'm guessing it included a class Employee with
sub-classes
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x
rdf:type
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate
configuration
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
to
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
deduce membership of employee and then query that with SPARQL or
with
Post by tina sani
Post by Lorenz B.
a
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS
with
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
your
custom rules then that's possible (so long as you set all the
appropriate
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
flags, see documentation) but make sure that your own rules are
backward
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
not forward rules. [The default Jena rule sets for RDFS and OWL
are
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
hybrid
rules so some of the inferences are only available to backward
rules
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
in
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
the
same rule set.]
Or if you don't want the cost of full inference then you can
indeed
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
rewrite the "natural" query to explicitly check for the base
memberships.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Dave
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
tina sani
2016-11-25 13:54:50 UTC
Permalink
I have something like this after my Jena forward chain rules and SPARQL
query:

Reasoner reasoner1 = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel inf = ModelFactory.createInfModel(reasoner1, model);

Reasoner reasoner2 = ReasonerRegistry.getRDFSReasoner();

InfModel inf2 = ModelFactory.createRDFSModel(model);
Post by tina sani
InfModel inf2 = ModelFactory.createRDFSModel();
What would be the arguments of the ModelFactory.createRDFSModel(). I have two models here, one the simple non inference model and other the inference model : InfModel inf = ModelFactory.createInfModel(reasoner, model);
Post by tina sani
Post by tina sani
Yes I use GenericRuleReasoner, so using the following rules along with
my
Post by tina sani
own rules will solve the problem?
?x rdfs:subClassOf emp:ContractEmployee--> ?x rdfs:subClassOf
emp:Employee
Post by tina sani
?x rdfs:subClassOf emp:PermanantEmployee--> ?x rdfs:subClassOf
emp:Employee
That might be incomplete as rdfs:subClassOf is transitive. Simply use
the RDFS reasoning.
Post by tina sani
On Thu, Nov 24, 2016 at 11:39 AM, Lorenz B. <
Post by Lorenz B.
Post by tina sani
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel, will
it do
Post by tina sani
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup an
RDFS reasoner
InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
or
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);
[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
Post by tina sani
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email. You
means
Post by tina sani
Post by Lorenz B.
Post by tina sani
rules other than that?
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would have to
add the rules that do the rdfs:subClass/rdf:type inference.
Post by tina sani
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Post by Lorenz B.
Dave meant that you need an additional layer of reasoning like RDFS
or
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
even less to get the inferences that you describe.
This can be done by
a) nesting two InfModels one that works on your specific rules and
one
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
that uses some kind of RDFS or
b) adding the particular rules to your set of rules
Post by tina sani
Ok sorry Dave, actually I did not completely understand your answer.
"You could have an inference model with the appropriate
configuration
Post by tina sani
Post by Lorenz B.
to
Post by tina sani
Post by Lorenz B.
Post by tina sani
deduce membership of employee"
Reasoner reasoner = new GenericRuleReasoner(Rule.parse
Rules(rule));
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
InfModel infer = ModelFactory.createInfModel(reasoner,
model);
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query,
infer);
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
What additionally I have to do apart from my Jena rule (Forward
Chain)
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
mentioned in previous email and the inference model.
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by Dave Reynolds
Post by tina sani
Let me explain a bit.
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
Post by tina sani
Post by Dave Reynolds
Post by tina sani
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary
?salary
Post by tina sani
Post by Lorenz B.
)"
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager ,
ITManager
Post by tina sani
Post by Dave Reynolds
Post by tina sani
or Analyst, Programmer*
*Is it must that if I use ?x rdf:type Employee, then
FinanceManager &
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
ITManager should also be sub classes of general super class
"Employee"
Post by tina sani
Post by Lorenz B.
?*
Post by tina sani
Post by Dave Reynolds
I don't think any of these details change my earlier answer, quoted
below.
Post by tina sani
Post by Dave Reynolds
Dave
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't
come
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
through.
However, I'm guessing it included a class Employee with
sub-classes
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x
rdf:type
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate
configuration
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
to
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
deduce membership of employee and then query that with SPARQL or
with
Post by tina sani
Post by Lorenz B.
a
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS
with
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
your
custom rules then that's possible (so long as you set all the
appropriate
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
flags, see documentation) but make sure that your own rules are
backward
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
not forward rules. [The default Jena rule sets for RDFS and OWL
are
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
hybrid
rules so some of the inferences are only available to backward
rules
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
in
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
the
same rule set.]
Or if you don't want the cost of full inference then you can
indeed
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
rewrite the "natural" query to explicitly check for the base
memberships.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Dave
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Dave Reynolds
2016-11-26 08:55:12 UTC
Permalink
Post by tina sani
I have something like this after my Jena forward chain rules and SPARQL
Reasoner reasoner1 = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel inf = ModelFactory.createInfModel(reasoner1, model);
Reasoner reasoner2 = ReasonerRegistry.getRDFSReasoner();
InfModel inf2 = ModelFactory.createRDFSModel(model);
If you want your rules to see the results of the RDFS closure then you
need something more like:

InfModel inf = ModelFactory.createRDFSModel(model);
Reasoner reasoner1 = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel inf2 = ModelFactory.createInfModel(reasoner1, inf);

Dave
Post by tina sani
Post by tina sani
InfModel inf2 = ModelFactory.createRDFSModel();
What would be the arguments of the ModelFactory.createRDFSModel(). I have two models here, one the simple non inference model and other the inference model : InfModel inf = ModelFactory.createInfModel(reasoner, model);
Post by tina sani
Post by tina sani
Yes I use GenericRuleReasoner, so using the following rules along with
my
Post by tina sani
own rules will solve the problem?
?x rdfs:subClassOf emp:ContractEmployee--> ?x rdfs:subClassOf
emp:Employee
Post by tina sani
?x rdfs:subClassOf emp:PermanantEmployee--> ?x rdfs:subClassOf
emp:Employee
That might be incomplete as rdfs:subClassOf is transitive. Simply use
the RDFS reasoning.
Post by tina sani
On Thu, Nov 24, 2016 at 11:39 AM, Lorenz B. <
Post by Lorenz B.
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel, will
it do
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup an
RDFS reasoner
InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
or
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);
[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email. You
means
Post by tina sani
Post by Lorenz B.
rules other than that?
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would have to
add the rules that do the rdfs:subClass/rdf:type inference.
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Post by Lorenz B.
Dave meant that you need an additional layer of reasoning like RDFS
or
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
even less to get the inferences that you describe.
This can be done by
a) nesting two InfModels one that works on your specific rules and
one
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
that uses some kind of RDFS or
b) adding the particular rules to your set of rules
Post by tina sani
Ok sorry Dave, actually I did not completely understand your answer.
"You could have an inference model with the appropriate
configuration
Post by tina sani
Post by Lorenz B.
to
Post by Lorenz B.
Post by tina sani
deduce membership of employee"
Reasoner reasoner = new GenericRuleReasoner(Rule.parse
Rules(rule));
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
Post by tina sani
InfModel infer = ModelFactory.createInfModel(reasoner,
model);
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
Post by tina sani
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query,
infer);
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
Post by tina sani
What additionally I have to do apart from my Jena rule (Forward
Chain)
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
Post by tina sani
mentioned in previous email and the inference model.
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by Dave Reynolds
Post by tina sani
Let me explain a bit.
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
Post by tina sani
Post by Dave Reynolds
Post by tina sani
http://www.semanticweb.org#Employee) "
+ "( ?x http://www.semanticweb.org#Salary
?salary
Post by tina sani
Post by Lorenz B.
)"
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
+ "greaterThan(?salary, 10,00) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager ,
ITManager
Post by tina sani
Post by Dave Reynolds
Post by tina sani
or Analyst, Programmer*
*Is it must that if I use ?x rdf:type Employee, then
FinanceManager &
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
ITManager should also be sub classes of general super class
"Employee"
Post by Lorenz B.
?*
Post by tina sani
Post by Dave Reynolds
I don't think any of these details change my earlier answer, quoted
below.
Post by tina sani
Post by Dave Reynolds
Dave
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't
come
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
through.
However, I'm guessing it included a class Employee with
sub-classes
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
ContractEmployee and PermanantEmployee.
I have this ontology: Now if I want to use some rules like
Post by tina sani
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x
rdf:type
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
ContractEmployee or PermanantEmployee
Depends on your set up.
You could have an inference model with the appropriate
configuration
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
to
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
deduce membership of employee and then query that with SPARQL or
with
Post by Lorenz B.
a
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
second inference model with your own rules in.
If you want just one layer of rules and want to combine OWL/RDFS
with
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
your
custom rules then that's possible (so long as you set all the
appropriate
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
flags, see documentation) but make sure that your own rules are
backward
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
not forward rules. [The default Jena rule sets for RDFS and OWL
are
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
hybrid
rules so some of the inferences are only available to backward
rules
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
in
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
the
same rule set.]
Or if you don't want the cost of full inference then you can
indeed
Post by tina sani
Post by Lorenz B.
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
rewrite the "natural" query to explicitly check for the base
memberships.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Dave
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
tina sani
2016-11-26 11:03:46 UTC
Permalink
Hi Dave,

So in that case we dont need to add non-inference model to the generic
reasoner because after all, our whole data is in the model.
Post by Dave Reynolds
Post by tina sani
I have something like this after my Jena forward chain rules and SPARQL
Reasoner reasoner1 = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel inf = ModelFactory.createInfModel(reasoner1, model);
Reasoner reasoner2 = ReasonerRegistry.getRDFSReasoner();
InfModel inf2 = ModelFactory.createRDFSModel(model);
If you want your rules to see the results of the RDFS closure then you
InfModel inf = ModelFactory.createRDFSModel(model);
Reasoner reasoner1 = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel inf2 = ModelFactory.createInfModel(reasoner1, inf);
Dave
Post by tina sani
Post by tina sani
InfModel inf2 = ModelFactory.createRDFSModel();
What would be the arguments of the ModelFactory.createRDFSModel(). I
have two models here, one the simple non inference model and other the
inference model : InfModel inf = ModelFactory.createInfModel(reasoner,
model);
Post by tina sani
Yes I use GenericRuleReasoner, so using the following rules along with
my
Post by tina sani
own rules will solve the problem?
?x rdfs:subClassOf emp:ContractEmployee--> ?x rdfs:subClassOf
emp:Employee
Post by tina sani
?x rdfs:subClassOf emp:PermanantEmployee--> ?x rdfs:subClassOf
emp:Employee
That might be incomplete as rdfs:subClassOf is transitive. Simply use
the RDFS reasoning.
Post by tina sani
On Thu, Nov 24, 2016 at 11:39 AM, Lorenz B. <
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel, will
Post by Lorenz B.
it do
Post by tina sani
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup an
RDFS reasoner
InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
or
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);
[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
Post by tina sani
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email. You
means
rules other than that?
Post by Lorenz B.
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would have to
add the rules that do the rdfs:subClass/rdf:type inference.
Post by tina sani
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Dave meant that you need an additional layer of reasoning like RDFS
or
even less to get the inferences that you describe.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
This can be done by
a) nesting two InfModels one that works on your specific rules and
one
that uses some kind of RDFS or
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
b) adding the particular rules to your set of rules
Ok sorry Dave, actually I did not completely understand your answer.
Post by tina sani
"You could have an inference model with the appropriate
configuration
to
Post by Lorenz B.
Post by tina sani
deduce membership of employee"
Post by Lorenz B.
Post by tina sani
Reasoner reasoner = new GenericRuleReasoner(Rule.parse
Rules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner,
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
model);
Post by tina sani
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query,
infer);
Post by tina sani
What additionally I have to do apart from my Jena rule (Forward
Chain)
mentioned in previous email and the inference model.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by tina sani
Let me explain a bit.
Post by tina sani
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
http://www.semanticweb.org#Employee) "
Post by tina sani
Post by tina sani
+ "( ?x http://www.semanticweb.org#Salary
?salary
)"
Post by Lorenz B.
Post by tina sani
+ "greaterThan(?salary, 10,00) "
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager ,
ITManager
or Analyst, Programmer*
Post by tina sani
Post by tina sani
*Is it must that if I use ?x rdf:type Employee, then
FinanceManager &
ITManager should also be sub classes of general super class
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
"Employee"
?*
Post by Lorenz B.
Post by tina sani
I don't think any of these details change my earlier answer, quoted
below.
Dave
Post by tina sani
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't
come
through.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
However, I'm guessing it included a class Employee with
sub-classes
ContractEmployee and PermanantEmployee.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
I have this ontology: Now if I want to use some rules like
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
Post by tina sani
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x
rdf:type
ContractEmployee or PermanantEmployee
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Depends on your set up.
You could have an inference model with the appropriate
configuration
to
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
deduce membership of employee and then query that with SPARQL or
Post by tina sani
Post by tina sani
with
a
Post by Lorenz B.
Post by tina sani
second inference model with your own rules in.
Post by tina sani
Post by tina sani
Post by tina sani
If you want just one layer of rules and want to combine OWL/RDFS
with
your
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
custom rules then that's possible (so long as you set all the
appropriate
flags, see documentation) but make sure that your own rules are
Post by tina sani
Post by tina sani
backward
not forward rules. [The default Jena rule sets for RDFS and OWL
Post by tina sani
Post by tina sani
are
hybrid
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
rules so some of the inferences are only available to backward
rules
in
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
the
Post by tina sani
Post by tina sani
Post by tina sani
same rule set.]
Or if you don't want the cost of full inference then you can
indeed
rewrite the "natural" query to explicitly check for the base
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
memberships.
Dave
Post by tina sani
Post by tina sani
Post by tina sani
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Lorenz B.
2016-11-27 11:59:46 UTC
Permalink
Post by tina sani
Hi Dave,
So in that case we dont need to add non-inference model to the generic
reasoner because after all, our whole data is in the model.
Yes, it is simply nested:
Raw model A is "contained" in the inferred RDFS model B.
B is "contained" in your user-defined rule model C.
Thus, A is "contained" in C.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
I have something like this after my Jena forward chain rules and SPARQL
Reasoner reasoner1 = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel inf = ModelFactory.createInfModel(reasoner1, model);
Reasoner reasoner2 = ReasonerRegistry.getRDFSReasoner();
InfModel inf2 = ModelFactory.createRDFSModel(model);
If you want your rules to see the results of the RDFS closure then you
InfModel inf = ModelFactory.createRDFSModel(model);
Reasoner reasoner1 = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel inf2 = ModelFactory.createInfModel(reasoner1, inf);
Dave
Post by tina sani
Post by tina sani
InfModel inf2 = ModelFactory.createRDFSModel();
What would be the arguments of the ModelFactory.createRDFSModel(). I
have two models here, one the simple non inference model and other the
inference model : InfModel inf = ModelFactory.createInfModel(reasoner,
model);
Post by tina sani
Yes I use GenericRuleReasoner, so using the following rules along with my
Post by tina sani
own rules will solve the problem?
?x rdfs:subClassOf emp:ContractEmployee--> ?x rdfs:subClassOf
emp:Employee
Post by tina sani
?x rdfs:subClassOf emp:PermanantEmployee--> ?x rdfs:subClassOf
emp:Employee
That might be incomplete as rdfs:subClassOf is transitive. Simply use
the RDFS reasoning.
Post by tina sani
On Thu, Nov 24, 2016 at 11:39 AM, Lorenz B. <
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel, will
Post by Lorenz B.
it do
Post by tina sani
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup an
RDFS reasoner
InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
or
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);
[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
Post by tina sani
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email. You
means
rules other than that?
Post by Lorenz B.
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would have to
add the rules that do the rdfs:subClass/rdf:type inference.
Post by tina sani
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Dave meant that you need an additional layer of reasoning like RDFS or
even less to get the inferences that you describe.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
This can be done by
a) nesting two InfModels one that works on your specific rules and
one
that uses some kind of RDFS or
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
b) adding the particular rules to your set of rules
Ok sorry Dave, actually I did not completely understand your answer.
Post by tina sani
"You could have an inference model with the appropriate
configuration
to
Post by Lorenz B.
Post by tina sani
deduce membership of employee"
Post by Lorenz B.
Post by tina sani
Reasoner reasoner = new GenericRuleReasoner(Rule.parse
Rules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner,
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
model);
Post by tina sani
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query,
infer);
Post by tina sani
What additionally I have to do apart from my Jena rule (Forward
Chain)
mentioned in previous email and the inference model.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by tina sani
Let me explain a bit.
Post by tina sani
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
http://www.semanticweb.org#Employee) "
Post by tina sani
Post by tina sani
+ "( ?x http://www.semanticweb.org#Salary
?salary
)"
Post by Lorenz B.
Post by tina sani
+ "greaterThan(?salary, 10,00) "
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of ContractEmployee)
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses * FinanceManager ,
ITManager
or Analyst, Programmer*
Post by tina sani
Post by tina sani
*Is it must that if I use ?x rdf:type Employee, then
FinanceManager &
ITManager should also be sub classes of general super class
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
"Employee"
?*
Post by Lorenz B.
Post by tina sani
I don't think any of these details change my earlier answer, quoted
below.
Dave
Post by tina sani
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't
come
through.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
However, I'm guessing it included a class Employee with
sub-classes
ContractEmployee and PermanantEmployee.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
I have this ontology: Now if I want to use some rules like
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
Post by tina sani
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x
rdf:type
ContractEmployee or PermanantEmployee
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Depends on your set up.
You could have an inference model with the appropriate
configuration
to
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
deduce membership of employee and then query that with SPARQL or
Post by tina sani
Post by tina sani
with
a
Post by Lorenz B.
Post by tina sani
second inference model with your own rules in.
Post by tina sani
Post by tina sani
Post by tina sani
If you want just one layer of rules and want to combine OWL/RDFS
with
your
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
custom rules then that's possible (so long as you set all the
appropriate
flags, see documentation) but make sure that your own rules are
Post by tina sani
Post by tina sani
backward
not forward rules. [The default Jena rule sets for RDFS and OWL
Post by tina sani
Post by tina sani
are
hybrid
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
rules so some of the inferences are only available to backward
rules
in
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
the
Post by tina sani
Post by tina sani
Post by tina sani
same rule set.]
Or if you don't want the cost of full inference then you can
indeed
rewrite the "natural" query to explicitly check for the base
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
memberships.
Dave
Post by tina sani
Post by tina sani
Post by tina sani
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
tina sani
2016-12-01 16:47:11 UTC
Permalink
Hello Lorenz, Dave, I have used the above method and suddenly I get this
exception:

WARN [AWT-EventQueue-0] (Rule.java:947) - Rule references unimplemented
functor: ^

Where it comes from?

On Sun, Nov 27, 2016 at 2:59 PM, Lorenz B. <
Post by Lorenz B.
Post by tina sani
Hi Dave,
So in that case we dont need to add non-inference model to the generic
reasoner because after all, our whole data is in the model.
Raw model A is "contained" in the inferred RDFS model B.
B is "contained" in your user-defined rule model C.
Thus, A is "contained" in C.
Post by tina sani
On Sat, Nov 26, 2016 at 11:55 AM, Dave Reynolds <
Post by Dave Reynolds
Post by tina sani
I have something like this after my Jena forward chain rules and SPARQL
Reasoner reasoner1 = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel inf = ModelFactory.createInfModel(reasoner1, model);
Reasoner reasoner2 = ReasonerRegistry.getRDFSReasoner();
InfModel inf2 = ModelFactory.createRDFSModel(model);
If you want your rules to see the results of the RDFS closure then you
InfModel inf = ModelFactory.createRDFSModel(model);
Reasoner reasoner1 = new GenericRuleReasoner(Rule.
parseRules(rule));
Post by tina sani
Post by Dave Reynolds
InfModel inf2 = ModelFactory.createInfModel(reasoner1, inf);
Dave
Post by tina sani
Post by tina sani
InfModel inf2 = ModelFactory.createRDFSModel();
What would be the arguments of the ModelFactory.createRDFSModel(). I
have two models here, one the simple non inference model and other the
inference model : InfModel inf = ModelFactory.createInfModel(
reasoner,
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
model);
Post by tina sani
Yes I use GenericRuleReasoner, so using the following rules along
with
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
my
Post by tina sani
own rules will solve the problem?
?x rdfs:subClassOf emp:ContractEmployee--> ?x rdfs:subClassOf
emp:Employee
Post by tina sani
?x rdfs:subClassOf emp:PermanantEmployee--> ?x rdfs:subClassOf
emp:Employee
That might be incomplete as rdfs:subClassOf is transitive. Simply use
the RDFS reasoning.
Post by tina sani
On Thu, Nov 24, 2016 at 11:39 AM, Lorenz B. <
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel,
will
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
it do
Post by tina sani
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup
an
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
RDFS reasoner
InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
or
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);
[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
Post by tina sani
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email.
You
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
means
rules other than that?
Post by Lorenz B.
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would
have
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
to
add the rules that do the rdfs:subClass/rdf:type inference.
Post by tina sani
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Dave meant that you need an additional layer of reasoning like
RDFS
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
or
even less to get the inferences that you describe.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
This can be done by
a) nesting two InfModels one that works on your specific rules
and
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
one
that uses some kind of RDFS or
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
b) adding the particular rules to your set of rules
Ok sorry Dave, actually I did not completely understand your
answer.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
"You could have an inference model with the appropriate
configuration
to
Post by Lorenz B.
Post by tina sani
deduce membership of employee"
Post by Lorenz B.
Post by tina sani
Reasoner reasoner = new GenericRuleReasoner(Rule.parse
Rules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner,
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
model);
Post by tina sani
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query,
infer);
Post by tina sani
What additionally I have to do apart from my Jena rule (Forward
Chain)
mentioned in previous email and the inference model.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by tina sani
Let me explain a bit.
Post by tina sani
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
http://www.semanticweb.org#Employee) "
Post by tina sani
Post by tina sani
+ "( ?x http://www.semanticweb.org#Salary
?salary
)"
Post by Lorenz B.
Post by tina sani
+ "greaterThan(?salary, 10,00) "
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of
ContractEmployee)
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses *
FinanceManager ,
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
ITManager
or Analyst, Programmer*
Post by tina sani
Post by tina sani
*Is it must that if I use ?x rdf:type Employee, then
FinanceManager &
ITManager should also be sub classes of general super class
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
"Employee"
?*
Post by Lorenz B.
Post by tina sani
I don't think any of these details change my earlier answer,
quoted
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
below.
Dave
Post by tina sani
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't
come
through.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
However, I'm guessing it included a class Employee with
sub-classes
ContractEmployee and PermanantEmployee.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
I have this ontology: Now if I want to use some rules like
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
Post by tina sani
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x
rdf:type
ContractEmployee or PermanantEmployee
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Depends on your set up.
You could have an inference model with the appropriate
configuration
to
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
deduce membership of employee and then query that with SPARQL or
Post by tina sani
Post by tina sani
with
a
Post by Lorenz B.
Post by tina sani
second inference model with your own rules in.
Post by tina sani
Post by tina sani
Post by tina sani
If you want just one layer of rules and want to combine
OWL/RDFS
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
with
your
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
custom rules then that's possible (so long as you set all the
appropriate
flags, see documentation) but make sure that your own rules are
Post by tina sani
Post by tina sani
backward
not forward rules. [The default Jena rule sets for RDFS and OWL
Post by tina sani
Post by tina sani
are
hybrid
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
rules so some of the inferences are only available to
backward
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
rules
in
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
the
Post by tina sani
Post by tina sani
Post by tina sani
same rule set.]
Or if you don't want the cost of full inference then you can
indeed
rewrite the "natural" query to explicitly check for the base
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
memberships.
Dave
Post by tina sani
Post by tina sani
Post by tina sani
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Lorenz B.
2016-12-02 08:16:07 UTC
Permalink
I don't understand why people think that "^" is the conjunction of rule
atoms? The documentation [1] says "," has to be used as functor in
Jena. Note, that this is just implementation dependent and other
frameworks might use a different symbol.

One question from my side:
Somebody else was asking the same quite recently [2]. Is it some
exercise of a computer science lecture at your university? If so, people
should try to work together and share there experience and knowledge. At
least that's how we did it during studies.


[1] https://jena.apache.org/documentation/inference/#rules
[2]
http://jena.markmail.org/search/#query:+page:1+mid:azf7ksmpxnhlzdrp+state:results

Lorenz
Post by tina sani
Hello Lorenz, Dave, I have used the above method and suddenly I get this
WARN [AWT-EventQueue-0] (Rule.java:947) - Rule references unimplemented
functor: ^
Where it comes from?
On Sun, Nov 27, 2016 at 2:59 PM, Lorenz B. <
Post by Lorenz B.
Post by tina sani
Hi Dave,
So in that case we dont need to add non-inference model to the generic
reasoner because after all, our whole data is in the model.
Raw model A is "contained" in the inferred RDFS model B.
B is "contained" in your user-defined rule model C.
Thus, A is "contained" in C.
Post by tina sani
On Sat, Nov 26, 2016 at 11:55 AM, Dave Reynolds <
Post by Dave Reynolds
Post by tina sani
I have something like this after my Jena forward chain rules and SPARQL
Reasoner reasoner1 = new GenericRuleReasoner(Rule.parseRules(rule));
InfModel inf = ModelFactory.createInfModel(reasoner1, model);
Reasoner reasoner2 = ReasonerRegistry.getRDFSReasoner();
InfModel inf2 = ModelFactory.createRDFSModel(model);
If you want your rules to see the results of the RDFS closure then you
InfModel inf = ModelFactory.createRDFSModel(model);
Reasoner reasoner1 = new GenericRuleReasoner(Rule.
parseRules(rule));
Post by tina sani
Post by Dave Reynolds
InfModel inf2 = ModelFactory.createInfModel(reasoner1, inf);
Dave
Post by tina sani
Post by tina sani
InfModel inf2 = ModelFactory.createRDFSModel();
What would be the arguments of the ModelFactory.createRDFSModel(). I
have two models here, one the simple non inference model and other the
inference model : InfModel inf = ModelFactory.createInfModel(
reasoner,
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
model);
Post by tina sani
Yes I use GenericRuleReasoner, so using the following rules along
with
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
my
Post by tina sani
own rules will solve the problem?
?x rdfs:subClassOf emp:ContractEmployee--> ?x rdfs:subClassOf
emp:Employee
Post by tina sani
?x rdfs:subClassOf emp:PermanantEmployee--> ?x rdfs:subClassOf
emp:Employee
That might be incomplete as rdfs:subClassOf is transitive. Simply use
the RDFS reasoning.
Post by tina sani
On Thu, Nov 24, 2016 at 11:39 AM, Lorenz B. <
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel,
will
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
it do
Post by tina sani
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup
an
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
RDFS reasoner
InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
or
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, rdfsExample);
[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
Post by tina sani
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email.
You
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
means
rules other than that?
Post by Lorenz B.
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would
have
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
to
add the rules that do the rdfs:subClass/rdf:type inference.
Post by tina sani
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Dave meant that you need an additional layer of reasoning like
RDFS
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
or
even less to get the inferences that you describe.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
This can be done by
a) nesting two InfModels one that works on your specific rules
and
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
one
that uses some kind of RDFS or
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
b) adding the particular rules to your set of rules
Ok sorry Dave, actually I did not completely understand your
answer.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
"You could have an inference model with the appropriate
configuration
to
Post by Lorenz B.
Post by tina sani
deduce membership of employee"
Post by Lorenz B.
Post by tina sani
Reasoner reasoner = new GenericRuleReasoner(Rule.parse
Rules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner,
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
model);
Post by tina sani
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query,
infer);
Post by tina sani
What additionally I have to do apart from my Jena rule (Forward
Chain)
mentioned in previous email and the inference model.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by tina sani
Let me explain a bit.
Post by tina sani
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
http://www.semanticweb.org#Employee) "
Post by tina sani
Post by tina sani
+ "( ?x http://www.semanticweb.org#Salary
?salary
)"
Post by Lorenz B.
Post by tina sani
+ "greaterThan(?salary, 10,00) "
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of
ContractEmployee)
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x rdf:type
ContractEmployee
All the instances are either from subclasses *
FinanceManager ,
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
ITManager
or Analyst, Programmer*
Post by tina sani
Post by tina sani
*Is it must that if I use ?x rdf:type Employee, then
FinanceManager &
ITManager should also be sub classes of general super class
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
"Employee"
?*
Post by Lorenz B.
Post by tina sani
I don't think any of these details change my earlier answer,
quoted
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
below.
Dave
Post by tina sani
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image didn't
come
through.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
However, I'm guessing it included a class Employee with
sub-classes
ContractEmployee and PermanantEmployee.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
I have this ontology: Now if I want to use some rules like
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
Post by tina sani
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or ?x
rdf:type
ContractEmployee or PermanantEmployee
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Depends on your set up.
You could have an inference model with the appropriate
configuration
to
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
deduce membership of employee and then query that with SPARQL or
Post by tina sani
Post by tina sani
with
a
Post by Lorenz B.
Post by tina sani
second inference model with your own rules in.
Post by tina sani
Post by tina sani
Post by tina sani
If you want just one layer of rules and want to combine
OWL/RDFS
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
with
your
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
custom rules then that's possible (so long as you set all the
appropriate
flags, see documentation) but make sure that your own rules are
Post by tina sani
Post by tina sani
backward
not forward rules. [The default Jena rule sets for RDFS and OWL
Post by tina sani
Post by tina sani
are
hybrid
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
rules so some of the inferences are only available to
backward
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
rules
in
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
the
Post by tina sani
Post by tina sani
Post by tina sani
same rule set.]
Or if you don't want the cost of full inference then you can
indeed
rewrite the "natural" query to explicitly check for the base
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
memberships.
Dave
Post by tina sani
Post by tina sani
Post by tina sani
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
tina sani
2016-12-02 11:14:05 UTC
Permalink
Thanks Lorenz I have fixed it. Yes its projects of last semester, but each
have different domain. The complexity of the project increases each month
as our adviser demands for more and more.

On Fri, Dec 2, 2016 at 11:16 AM, Lorenz B. <
Post by Lorenz B.
I don't understand why people think that "^" is the conjunction of rule
atoms? The documentation [1] says "," has to be used as functor in
Jena. Note, that this is just implementation dependent and other
frameworks might use a different symbol.
Somebody else was asking the same quite recently [2]. Is it some
exercise of a computer science lecture at your university? If so, people
should try to work together and share there experience and knowledge. At
least that's how we did it during studies.
[1] https://jena.apache.org/documentation/inference/#rules
[2]
azf7ksmpxnhlzdrp+state:results
Lorenz
Post by tina sani
Hello Lorenz, Dave, I have used the above method and suddenly I get this
WARN [AWT-EventQueue-0] (Rule.java:947) - Rule references unimplemented
functor: ^
Where it comes from?
On Sun, Nov 27, 2016 at 2:59 PM, Lorenz B. <
Post by Lorenz B.
Post by tina sani
Hi Dave,
So in that case we dont need to add non-inference model to the generic
reasoner because after all, our whole data is in the model.
Raw model A is "contained" in the inferred RDFS model B.
B is "contained" in your user-defined rule model C.
Thus, A is "contained" in C.
Post by tina sani
On Sat, Nov 26, 2016 at 11:55 AM, Dave Reynolds <
Post by Dave Reynolds
Post by tina sani
I have something like this after my Jena forward chain rules and
SPARQL
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Reasoner reasoner1 = new GenericRuleReasoner(Rule.
parseRules(rule));
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
InfModel inf = ModelFactory.createInfModel(reasoner1,
model);
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Reasoner reasoner2 = ReasonerRegistry.getRDFSReasoner();
InfModel inf2 = ModelFactory.createRDFSModel(model);
If you want your rules to see the results of the RDFS closure then you
InfModel inf = ModelFactory.createRDFSModel(model);
Reasoner reasoner1 = new GenericRuleReasoner(Rule.
parseRules(rule));
Post by tina sani
Post by Dave Reynolds
InfModel inf2 = ModelFactory.createInfModel(reasoner1, inf);
Dave
Post by tina sani
Post by tina sani
InfModel inf2 = ModelFactory.createRDFSModel();
What would be the arguments of the ModelFactory.createRDFSModel().
I
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
have two models here, one the simple non inference model and other
the
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
inference model : InfModel inf = ModelFactory.createInfModel(
reasoner,
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
model);
Post by tina sani
Yes I use GenericRuleReasoner, so using the following rules along
with
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
my
Post by tina sani
own rules will solve the problem?
?x rdfs:subClassOf emp:ContractEmployee--> ?x rdfs:subClassOf
emp:Employee
Post by tina sani
?x rdfs:subClassOf emp:PermanantEmployee--> ?x rdfs:subClassOf
emp:Employee
That might be incomplete as rdfs:subClassOf is transitive. Simply
use
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
the RDFS reasoning.
Post by tina sani
On Thu, Nov 24, 2016 at 11:39 AM, Lorenz B. <
If I pass OntModelSpec.OWL_MEM_MICRO_RULE_INF” to the OntModel,
will
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
it do
Post by tina sani
the RDFS reasoning?
See [1] in general and in particular [2] which shows how to setup
an
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
RDFS reasoner
InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
or
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner,
rdfsExample);
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
[1] https://jena.apache.org/documentation/inference/ [2]
https://jena.apache.org/documentation/inference/#generalExamples
Post by tina sani
b) adding the particular rules to your set of rules
I have already created the rules, mentioned in my first email.
You
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
means
rules other than that?
Post by Lorenz B.
I don't know how you setup your rules, but if you use the
GenericRuleReasoner it does only apply your rules and you would
have
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
to
add the rules that do the rdfs:subClass/rdf:type inference.
Post by tina sani
On Wed, Nov 23, 2016 at 11:50 AM, Lorenz B. <
Dave meant that you need an additional layer of reasoning like
RDFS
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
or
even less to get the inferences that you describe.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
This can be done by
a) nesting two InfModels one that works on your specific rules
and
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
one
that uses some kind of RDFS or
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
b) adding the particular rules to your set of rules
Ok sorry Dave, actually I did not completely understand your
answer.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
"You could have an inference model with the appropriate
configuration
to
Post by Lorenz B.
Post by tina sani
deduce membership of employee"
Post by Lorenz B.
Post by tina sani
Reasoner reasoner = new GenericRuleReasoner(Rule.parse
Rules(rule));
InfModel infer = ModelFactory.createInfModel(reasoner,
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
model);
Post by tina sani
Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query,
infer);
Post by tina sani
What additionally I have to do apart from my Jena rule
(Forward
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Chain)
mentioned in previous email and the inference model.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Select *
where{ ?x rdf:type emp:QualifiedEmployee }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <
Post by tina sani
Let me explain a bit.
Post by tina sani
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
http://www.semanticweb.org#Employee) "
Post by tina sani
Post by tina sani
+ "( ?x http://www.semanticweb.org#Salary
?salary
)"
Post by Lorenz B.
Post by tina sani
+ "greaterThan(?salary, 10,00) "
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
+ " -> (?x http://www.w3.org/1999/02/22-r
df-syntax-ns#type
http://www.semanticweb.org#QualifiedEmployee. )]"
Classes in my ontology are
Employee (Super class of all employees)
* ContractEmployee* (Subclass of Employee)
FinanceManager
ITManager (Subclasses of
ContractEmployee)
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
* PermanantEmployee *(Subclass of Employee)
Analyst
Programmer
In this case, will I use ?x rdf:type Employee or ?x
rdf:type
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
ContractEmployee
All the instances are either from subclasses *
FinanceManager ,
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
ITManager
or Analyst, Programmer*
Post by tina sani
Post by tina sani
*Is it must that if I use ?x rdf:type Employee, then
FinanceManager &
ITManager should also be sub classes of general super class
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
"Employee"
?*
Post by Lorenz B.
Post by tina sani
I don't think any of these details change my earlier answer,
quoted
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
below.
Dave
Post by tina sani
On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <
Post by tina sani
Post by tina sani
Inline image 1
The mail list doesn't support attachments so the image
didn't
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
come
through.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
However, I'm guessing it included a class Employee with
sub-classes
ContractEmployee and PermanantEmployee.
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
I have this ontology: Now if I want to use some rules like
if x rdf:type Employee and ?x salary>Euro10,000. then ?x
Post by tina sani
QualifiedEmployee.
My question here is should I use ?x rdf:type Employee or
?x
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
rdf:type
ContractEmployee or PermanantEmployee
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Depends on your set up.
You could have an inference model with the appropriate
configuration
to
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
deduce membership of employee and then query that with SPARQL
or
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
with
a
Post by Lorenz B.
Post by tina sani
second inference model with your own rules in.
Post by tina sani
Post by tina sani
Post by tina sani
If you want just one layer of rules and want to combine
OWL/RDFS
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
with
your
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
custom rules then that's possible (so long as you set all
the
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
appropriate
flags, see documentation) but make sure that your own rules
are
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
backward
not forward rules. [The default Jena rule sets for RDFS and
OWL
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
are
hybrid
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
rules so some of the inferences are only available to
backward
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
rules
in
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
the
Post by tina sani
Post by tina sani
Post by tina sani
same rule set.]
Or if you don't want the cost of full inference then you
can
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Dave Reynolds
Post by tina sani
Post by tina sani
Post by tina sani
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
indeed
rewrite the "natural" query to explicitly check for the base
Post by Lorenz B.
Post by tina sani
Post by Lorenz B.
Post by tina sani
Post by tina sani
Post by tina sani
memberships.
Dave
Post by tina sani
Post by tina sani
Post by tina sani
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Continue reading on narkive:
Search results for 'Super classes/Sub classes in Jena rules' (Questions and Answers)
12
replies
Know ANy LDS Rock Bands???
started 2006-09-24 17:05:38 UTC
music
Loading...