From: Seaborne, A. <and...@hp...> - 2006-01-26 11:58:56
|
-------- Original Message -------- > From: John Vandenberg <mailto:ja...@gm...> > Date: 26 January 2006 11:50 >=20 > On 26/01/06, Seaborne, Andy <and...@hp...> wrote: > >=20 > >=20 > > John Vandenberg wrote: > > > Hi, > > >=20 > > > 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. > > >=20 > > > 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.=20 > > >=20 > > > 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#> > > >=20 > > > To work around this, I am individually selecting each optional piece > > > of data. Can this be improved on? > > >=20 > > > -- > > > John > >=20 > >=20 > > That syntax is RDQL not SPARQL. >=20 > Sorry for the confusion; I am in the process of converting to SPARQL. :-) >=20 > > That query exactly translated is: > >=20 > > PREFIX em: <http://www.mozilla.org/2004/em-rdf#> > >=20 > > SELECT ?version ?name ?description ?creator ?icon WHERE > > { ?x em:version ?version ; > > em:name ?name ; > > em:description ?description ; > > em:creator ?creator ; > > em:iconURL ?icon . > > } > >=20 > > (Mechanical translation by program - but not a PHP program :-() > >=20 > > and adding optional for iconURL: > >=20 > > PREFIX em: <http://www.mozilla.org/2004/em-rdf#> > >=20 > > 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 . } > > } > >=20 > > a little more neatly that is: > >=20 > > 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 .} > > } > >=20 > > Hope that helps, >=20 > Yes, thanks. Am I right that RDQL does not offer similar functionality? RDQL does not offer such functionality. >=20 > 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 ? =20 Sorry - I don't know. I can only answer SPARQL general questions. Andy >=20 > -- > John |