Re: jena and sparql reg
Timothy Redmond <[email protected]>
| Newsgroups | gmane.comp.misc.ontology.protege.general |
|---|---|
| Message-ID | <[email protected]> |
On 11/06/2012 10:48 PM, kala devi ramar wrote: > hello all > As per your suggestion i have used > > http://protegewiki.stanford.edu/wiki/CompileProtege4InEclipseFromSvn > > to link protege with eclipse. now i want to know how can i write jena > rules and sparql queries for my imported protege files (RDF, OWL) with > eclipse.Please give your suggestion as early as possible > For Jena questions, I would suggest that you ask questions on the Jena mailing lists (jena.apache.org). If you have a SPARQL query that you want to run then you can use the SPARQL query tab (click Window->Tabs->SPARQL Query) in the latest Protege 4.2. As for writing SPARQL queries, I have found that I can usually find simple answers through google. -Timothy > thank you > R.kaladevi > > > Hello > i have used the URL > http://protegewiki.stanford.edu/wiki/CompileProtege4InEclipseFromSvn > to compile and run protege 4.1 in eclipse. i want know how to write > jena rules and sparql queries for my protege RDF files available with > eclipse > > > > Hello > i have used the URL > http://protegewiki.stanford.edu/wiki/CompileProtege4InEclipseFromSvn > to compile and run protege 4.1 in eclipse. i want know how to write > jena rules and sparql queries for my protege RDF files available with > eclipse > > > > Hello > i have used the URL > http://protegewiki.stanford.edu/wiki/CompileProtege4InEclipseFromSvn > to compile and run protege 4.1 in eclipse. i want know how to write > jena rules and sparql queries for my protege RDF files available with > eclipse > > > > --- On *Mon, 10/29/12, [email protected] > /<[email protected]>/* wrote: > > > From: [email protected] > <[email protected]> > Subject: protege-discussion Digest, Vol 75, Issue 30 > To: [email protected] > Date: Monday, October 29, 2012, 12:35 PM > > Send protege-discussion mailing list submissions to > [email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]> > > To subscribe or unsubscribe via the World Wide Web, visit > https://mailman.stanford.edu/mailman/listinfo/protege-discussion > or, via email, send a message with subject or body 'help' to > [email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]> > > You can reach the person managing the list at > [email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]> > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of protege-discussion digest..." > > > Today's Topics: > > 1. Re: converting projects between OWL and Frames - Vice versa > (Timothy Redmond) > 2. Re: Jena and Complex SPARQL query (Timothy Redmond) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sun, 28 Oct 2012 23:45:17 -0700 > From: Timothy Redmond <[email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]>> > To: [email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]> > Subject: Re: [protege-discussion] converting projects between OWL and > Frames - Vice versa > Message-ID: <[email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]>> > Content-Type: text/plain; charset="utf-8"; Format="flowed" > > > > I thought convert to project format would solve my issue, even if > > ontologies are developed in two different formats. > > But it seems the conversion is not working properly, and we get so > > many errors like (no content displayed in the screen). > > The conversion between frames and OWL doesn't work well. > > > > > > We have a requirement to use both OWL and frames (since we need > some > > plugins which are developed solely for this) to develop ontologies. > > This is an awkward requirement. But you should investigate the > possibility that your frame based plugins will simply work in > Protege 3 > OWL. The Protege 3 OWL api is based on the Protege frames api. So > depending on the plugins you might be able to get them to work in > Protege 3 OWL. > > -Timothy > > > > On 10/26/2012 07:01 PM, Ganesh kumar wrote: > > > > Hi All, > > > > I am using prot?g? 3.4.8 to develop ontologies. > > > > We have a requirement to use both OWL and frames (since we need > some > > plugins which are developed solely for this) to develop ontologies. > > > > I thought convert to project format would solve my issue, even if > > ontologies are developed in two different formats. > > But it seems the conversion is not working properly, and we get so > > many errors like (no content displayed in the screen). > > > > Is there a way I could convert my project between frames and OWL? > > > > Thanks > > Ganesh > > > > > > > > _______________________________________________ > > protege-discussion mailing list > > [email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]> > > https://mailman.stanford.edu/mailman/listinfo/protege-discussion > > > > Instructions for unsubscribing: > http://protege.stanford.edu/doc/faq.html#01a.03 > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20121028/19e20970/attachment-0001.html> > > ------------------------------ > > Message: 2 > Date: Mon, 29 Oct 2012 00:05:09 -0700 > From: Timothy Redmond <[email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]>> > To: [email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]> > Subject: Re: [protege-discussion] Jena and Complex SPARQL query > Message-ID: <[email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]>> > Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" > > On 10/22/2012 05:56 AM, Gabriela Medina wrote: > > Hello, > > > > I've been recently using Jena and SPARQL and I have one question. > > For any jena questions I would suggest the mailing list at > jena.sourceforge.net. > > > I tried to make a query in which ONE variable (in my case named > > "Process") is linked to TWO other variables (both are variables > of the > > same class. In my case this class is called Symptoms). > > Your example looked a bit complicated so I simplified it to see if I > understand your issue. I made a small ontology (attached that > includes > the following abox assertions: > > Individual: x > Types: > A > Facts: > p y, > p z > > Individual: y > Types: > B > Facts: > q 1 > > Individual: z > Types: > B > Facts: > q 2 > > > I then ran the following sparql query > > PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> > PREFIX owl: <http://www.w3.org/2002/07/owl#> > PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> > PREFIX : <http://protege.org/ontologies/TwoVariables#> > SELECT ?a ?b ?c > WHERE { > ?a :p ?b. > ?b :q "1"^^xsd:integer. > ?a :p ?c. > ?c :q "2"^^xsd:integer. > } > > > and got one resulting row consisting of "x, y, z". This seems to be > what you are looking for? > > -Timothy > > > I need to describe some characteristics or some relations that > Process > > have with other classes and at the same time I have to describe > > characteristics or some relations that each of the Symptoms have. > > > > To perform this query I have tried two alternatives but I have no > > success. Here I present the two alternatives: > > 1.The first alternative is a SELECT Query written as follow: > > > > String queryString = > > "PREFIX ONTO: http://www.owl-ontologies.com/Ontology1326704817.owl# > > PREFIX owl: <http://www.w3.org/2002/07/owl#> > > PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> > > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> > > SELECT ?Symptome1 ?Symptome2 ?Deviation1 ?Deviation2 ?Flux1 ?Flux2 > > ?Propriete1 ?Propriete2 ?Process > > {{?Process rdf:type ONTO:MoteurDiesel . > > ?Process ONTO:presente ?Symptome1 . > > ?Symptome1 rdf:type ONTO:Symptome . > > ?Symptome1 ONTO:possedeCaracteristiqueDeviation?Deviation1 . > > FILTER regex(str(?Deviation1), > > 'http://www.owl-ontologies.com/Ontology1326704817.owl#Moins' > <http://www.owl-ontologies.com/Ontology1326704817.owl#Moins%27>) . > > ?Symptome1 ONTO:possedeCaracteristiqueFlux?Flux1 . > > ?Flux1 rdf:type ONTO:Huile . > > ?Symptome1 ONTO:possedeCaracteristiquePropriete ?Propriete1 . > > ?Propriete1 rdf:type ONTO:PressionFonctionnement} . > > {?Process ONTO:presente ?Symptome2. > > ?Symptome2 rdf:type ONTO:Symptome . > > ?Symptome2 ONTO:possedeCaracteristiqueDeviation?Deviation2 . > > FILTER regex(str(?Deviation), > > 'http://www.owl-ontologies.com/Ontology1326704817.owl#Plus' > <http://www.owl-ontologies.com/Ontology1326704817.owl#Plus%27>) . > > ?Symptome2 ONTO:possedeCaracteristiqueFlux?Flux2 . > > ?Flux2 rdf:type ONTO:Huile . > > ?Symptome2 ONTO:possedeCaracteristiquePropriete ?Propriete2 . > > ?Propriete2 rdf:type ONTO:Temperature}}"; > > *try*{ > > Query query = QueryFactory./create/(queryString); > > QueryExecution qexecRule = QueryExecutionFactory./create/(query, > > infmodel); > > ResultSet resultset = qexecRule.execSelect(); > > Model _result_ = qexecRule.execConstruct(); > > *for*(; resultset.hasNext() ; ) { > > QuerySolution soln= resultset.nextSolution(); > > RDFNode x = soln.getResource("Process"); > > RDFNode y = soln.getResource("Symptome1"); > > RDFNode z = soln.getResource("Symptome2"); > > System./out/.println(x.toString()+ " "+ y.toString()+ " "+ > z.toString()); > > } > > The result of this query is an error saying: "Insufficient > memory..." > > 2.The second alternative is a CONSTRUCT Query: > > String queryString = > > "PREFIX ONTO: > <http://www.owl-ontologies.com/Ontology1326704817.owl#> > > PREFIX owl: <http://www.w3.org/2002/07/owl#> > > PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> > > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> > > CONSTRUCT {?Process ONTO:presente ?Symptome1; ONTO:presente > ?Symptome2} > > WHERE{ > > {?Process rdf:type ONTO:MoteurDiesel . > > ?Process ONTO:presente ?Symptome1 . > > ?Symptome1 rdf:type ONTO:Symptome . > > ?Symptome1 ONTO:possedeCaracteristiqueDeviation?Deviation1 . > > FILTER regex(str(?Deviation1), > > 'http://www.owl-ontologies.com/Ontology1326704817.owl#Moins' > <http://www.owl-ontologies.com/Ontology1326704817.owl#Moins%27>) . > > ?Symptome1 ONTO:possedeCaracteristiqueFlux?Flux1 . > > ?Flux1 rdf:type ONTO:Huile . > > ?Symptome1 ONTO:possedeCaracteristiquePropriete ?Propriete1 . > > ?Propriete1 rdf:type ONTO:PressionFonctionnement} . > > {?Process ONTO:presente ?Symptome2. > > ?Symptome2 rdf:type ONTO:Symptome . > > ?Symptome2 ONTO:possedeCaracteristiqueDeviation?Deviation2 . > > FILTER regex(str(?Deviation), > > 'http://www.owl-ontologies.com/Ontology1326704817.owl#Plus' > <http://www.owl-ontologies.com/Ontology1326704817.owl#Plus%27>) . > > ?Symptome2 ONTO:possedeCaracteristiqueFlux?Flux2 . > > ?Flux2 rdf:type ONTO:Huile . > > ?Symptome2 ONTO:possedeCaracteristiquePropriete ?Propriete2 . > > ?Propriete2 rdf:type ONTO:Temperature}}"; > > *try*{ > > Query query = QueryFactory./create/(queryString); > > QueryExecution qexecRule = QueryExecutionFactory./create/(query, > > infmodel); > > Model result = qexecRule.execConstruct(); > > {result.write(System./out/, "Result"); > > } > > The result of this query is: "Attempt to have ResultSet from a > > CONSTRUCT query" > > Do you have any suggestion to obtain the correct query for ONE > > VARIABLE link to TWO OTHERS each one with their relations? > > > > Thanks in advanced for your reply and for your help, > > Kind regards, > > Gabriela > > > > > > _______________________________________________ > > protege-discussion mailing list > > [email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]> > > https://mailman.stanford.edu/mailman/listinfo/protege-discussion > > > > Instructions for unsubscribing: > http://protege.stanford.edu/doc/faq.html#01a.03 > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20121029/1c14392f/attachment.html> > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: TwoVariables.owl > Type: application/rdf+xml > Size: 3598 bytes > Desc: not available > URL: > <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20121029/1c14392f/attachment.owl> > > ------------------------------ > > _______________________________________________ > protege-discussion mailing list > [email protected] > <http://us.mc1625.mail.yahoo.com/mc/[email protected]> > https://mailman.stanford.edu/mailman/listinfo/protege-discussion > > > End of protege-discussion Digest, Vol 75, Issue 30 > ************************************************** > > > > _______________________________________________ > protege-discussion mailing list > [email protected] > https://mailman.stanford.edu/mailman/listinfo/protege-discussion > > Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 _______________________________________________ protege-discussion mailing list [email protected] https://mailman.stanford.edu/mailman/listinfo/protege-discussion Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03