SQWRL Query to a specific instance

4 messages Options
Embed this post
Permalink
Myrrdin

SQWRL Query to a specific instance

Reply Threaded More More options
Print post
Permalink
Helo everyone.

   I create an instance of one of my OWL Class Patient. I do not save the instance that is I simply write

OWLModel owlmodel = ProtegeOWL.createJenaOWLModelFromURI(uri);
OWLNamedClass patientClass = owlmodel.getOWLNamedClass("Patient");
RDFIndividual patientIndividual = patientClass.createRDFIndividual(patientObj.getPatientName());


The instance exists but  is not saved in the OWL file and I DO NOT WANT THAT

 What I need is to execute all SWRL and SQWRL rules in the OWL file(apart from 2 rules) for this specific instance and then get the relative result. I guess with getSQWRLResult() function. Any ideas? Any example that I missed on the web?

 Thank you.
Martin O'Connor

Re: SQWRL Query to a specific instance

Reply Threaded More More options
Print post
Permalink
If you use the SQWRLQueryAPI you can execute SQWRL queries and SWRL
rules without persisting any inferences. You can then use getSQWRLResult
to get specific results of SQWRL queries.

Martin

[1] http://protege.cim3.net/cgi-bin/wiki.pl?SQWRLQueryAPI

Myrrdin wrote:

> Helo everyone.
>
>    I create an instance of one of my OWL Class Patient. I do not save the
> instance that is I simply write
>
> OWLModel owlmodel = ProtegeOWL.createJenaOWLModelFromURI(uri);
> OWLNamedClass patientClass = owlmodel.getOWLNamedClass("Patient");
> RDFIndividual patientIndividual =
> patientClass.createRDFIndividual(patientObj.getPatientName());
>
>
> The instance exists but  is not saved in the OWL file and I DO NOT WANT THAT
>
>  What I need is to execute all SWRL and SQWRL rules in the OWL file(apart
> from 2 rules) for this specific instance and then get the relative result. I
> guess with getSQWRLResult() function. Any ideas? Any example that I missed
> on the web?
>
>  Thank you.
>  

_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
Myrrdin

Re: SQWRL Query to a specific instance

Reply Threaded More More options
Print post
Permalink
Thank you Martin,

I already know that getSQWRLResult() will return the result if any. My problem is
after the code I wrote in the firt post

"
> OWLModel owlmodel = ProtegeOWL.createJenaOWLModelFromURI(uri);
> OWLNamedClass patientClass = owlmodel.getOWLNamedClass("Patient");
> RDFIndividual patientIndividual =patientClass.createRDFIndividual(patientObj.getPatientName());
"

How can I run all rules (beside 2) that are already defined in the ontology for this specific instance the RDFIndividual patientIndivindual.

What I do is:

SQWRLQueryEngine queryEngine = SQWRLQueryEngineFactory.create(owlmodel);
SQWRLResult sqwrlResult = queryEngine.getSQWRLResult(query_name);

where owlmodel is my OWLModel and query_name is the name of one single query already in the ontology.

1)How can I use MORE THAN ONE query(rule)?
2)How can I run these rules ONLY for patientIndividual?

Thank you!

Martin O'Connor wrote:
If you use the SQWRLQueryAPI you can execute SQWRL queries and SWRL
rules without persisting any inferences. You can then use getSQWRLResult
to get specific results of SQWRL queries.

Martin

[1] http://protege.cim3.net/cgi-bin/wiki.pl?SQWRLQueryAPI

Myrrdin wrote:
> Helo everyone.
>
>    I create an instance of one of my OWL Class Patient. I do not save the
> instance that is I simply write
>
> OWLModel owlmodel = ProtegeOWL.createJenaOWLModelFromURI(uri);
> OWLNamedClass patientClass = owlmodel.getOWLNamedClass("Patient");
> RDFIndividual patientIndividual =
> patientClass.createRDFIndividual(patientObj.getPatientName());
>
>
> The instance exists but  is not saved in the OWL file and I DO NOT WANT THAT
>
>  What I need is to execute all SWRL and SQWRL rules in the OWL file(apart
> from 2 rules) for this specific instance and then get the relative result. I
> guess with getSQWRLResult() function. Any ideas? Any example that I missed
> on the web?
>
>  Thank you.
>  

_______________________________________________
protege-owl mailing list
protege-owl@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
Martin O'Connor

Re: SQWRL Query to a specific instance

Reply Threaded More More options
Print post
Permalink
Myrrdin wrote:
> already in the ontology.
>
> 1)How can I use MORE THAN ONE query(rule)?
>  
You can run as many queries as you would like. (All enabled queries are
effectively run at once). The result of each query can be retrieved
using the name of the query:

 http://protege.cim3.net/cgi-bin/wiki.pl?SQWRLQueryAPI#nidAER

> 2)How can I run these rules ONLY for patientIndividual?
>
>  
If you want to run a rule or query for a specific individual only you
will need to use the individual name in the rule or query.

e.g., http://protege.cim3.net/cgi-bin/wiki.pl?SWRLLanguageFAQ#nid8IG

Martin
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03