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 }
On Tue, Nov 22, 2016 at 6:03 PM, Dave Reynolds <[email protected]>
wrote:
>
>
> On 22/11/16 14:56, tina sani wrote:
>
>> 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
>
>
> On Tue, Nov 22, 2016 at 5:30 PM, Dave Reynolds <[email protected]>
>> wrote:
>>
>> On 22/11/16 10:12, tina sani wrote:
>>>
>>> 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
>>>
>>>>
>>>> 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
>>>
>>>
>>