From: John V. <ja...@gm...> - 2006-01-26 09:46:41
|
Hi, I am trying to select a set of data out of a Mozilla extension install.rdf file. I am using SPARQL because it will be easy for developers to pick up and learn. My problem is that when an optional entry doesnt exist (iconURL), none of the fields are returned. This is the query I was trying to perform. SELECT ?version, ?name, ?description, ?creator, ?icon WHERE (?x, <em:version>, ?version), (?x, <em:name>, ?name), (?x, <em:description>, ?description), (?x, <em:creator>, ?creator), (?x, <em:iconURL>, ?icon) USING em FOR <http://www.mozilla.org/2004/em-rdf#> To work around this, I am individually selecting each optional piece of data. Can this be improved on? -- John |
From: Seaborne, A. <and...@hp...> - 2006-01-26 09:58:26
|
John Vandenberg wrote: > Hi, > > I am trying to select a set of data out of a Mozilla extension > install.rdf file. I am using SPARQL because it will be easy for > developers to pick up and learn. > > My problem is that when an optional entry doesnt exist (iconURL), none > of the fields are returned. This is the query I was trying to > perform. > > SELECT ?version, ?name, ?description, ?creator, ?icon > WHERE (?x, <em:version>, ?version), > (?x, <em:name>, ?name), > (?x, <em:description>, ?description), > (?x, <em:creator>, ?creator), > (?x, <em:iconURL>, ?icon) > USING em FOR <http://www.mozilla.org/2004/em-rdf#> > > To work around this, I am individually selecting each optional piece > of data. Can this be improved on? > > -- > John That syntax is RDQL not SPARQL. That query exactly translated is: PREFIX em: <http://www.mozilla.org/2004/em-rdf#> SELECT ?version ?name ?description ?creator ?icon WHERE { ?x em:version ?version ; em:name ?name ; em:description ?description ; em:creator ?creator ; em:iconURL ?icon . } (Mechanical translation by program - but not a PHP program :-() and adding optional for iconURL: PREFIX em: <http://www.mozilla.org/2004/em-rdf#> SELECT ?version ?name ?description ?creator ?icon WHERE { ?x em:version ?version . ?x em:name ?name . ?x em:description ?description . ?x em:creator ?creator . OPTIONAL { ?x em:iconURL ?icon . } } a little more neatly that is: PREFIX em: <http://www.mozilla.org/2004/em-rdf#> SELECT ?version ?name ?description ?creator ?icon WHERE { ?x em:version ?version ; em:name ?name ; em:description ?description ; em:creator ?creator . OPTIONAL { ?x em:iconURL ?icon .} } Hope that helps, Andy |
From: John V. <ja...@gm...> - 2006-01-26 11:50:09
|
On 26/01/06, Seaborne, Andy <and...@hp...> wrote: > > > John Vandenberg wrote: > > Hi, > > > > I am trying to select a set of data out of a Mozilla extension > > install.rdf file. I am using SPARQL because it will be easy for > > developers to pick up and learn. > > > > My problem is that when an optional entry doesnt exist (iconURL), none > > of the fields are returned. This is the query I was trying to > > perform. > > > > SELECT ?version, ?name, ?description, ?creator, ?icon > > WHERE (?x, <em:version>, ?version), > > (?x, <em:name>, ?name), > > (?x, <em:description>, ?description), > > (?x, <em:creator>, ?creator), > > (?x, <em:iconURL>, ?icon) > > USING em FOR <http://www.mozilla.org/2004/em-rdf#> > > > > To work around this, I am individually selecting each optional piece > > of data. Can this be improved on? > > > > -- > > John > > > That syntax is RDQL not SPARQL. Sorry for the confusion; I am in the process of converting to SPARQL. > That query exactly translated is: > > PREFIX em: <http://www.mozilla.org/2004/em-rdf#> > > SELECT ?version ?name ?description ?creator ?icon > WHERE > { ?x em:version ?version ; > em:name ?name ; > em:description ?description ; > em:creator ?creator ; > em:iconURL ?icon . > } > > (Mechanical translation by program - but not a PHP program :-() > > and adding optional for iconURL: > > PREFIX em: <http://www.mozilla.org/2004/em-rdf#> > > SELECT ?version ?name ?description ?creator ?icon > WHERE > { ?x em:version ?version . > ?x em:name ?name . > ?x em:description ?description . > ?x em:creator ?creator . > OPTIONAL { ?x em:iconURL ?icon . } > } > > a little more neatly that is: > > PREFIX em: <http://www.mozilla.org/2004/em-rdf#> > SELECT ?version ?name ?description ?creator ?icon > WHERE > { ?x em:version ?version ; > em:name ?name ; > em:description ?description ; > em:creator ?creator . > OPTIONAL > { ?x em:iconURL ?icon .} > } > > Hope that helps, Yes, thanks. Am I right that RDQL does not offer similar functionality? Also, the docs say that SPARQL support in rdfapi-php requires php 5.1; are there specific problems that can be fixed or avoided in order to run it on a locked down Redhat ES3 box with php 4.3.2 ? -- John |