Cesbron, Brice wrote:
> Hello,
>  
> For now I'm using Virtuoso Open Source on an Ubuntu and I'm trying to do
> some Sparql queries over my database.
> Some are ok but I've an error with this one :
>  
> PREFIX rdfs: <http://www.w3.org/200/01/rdf-schema#>
> SPARQL SELECT ?s  from <http://iaf-dl> WHERE { ?s rdfs:subClassOf ?o };
>  
> I took a look on tutorials but I didn't see examples...Maybe I have read
> too fast.
> Can you explain me what happens please?
> Because if there is an error I don't know what is that error....

Hi,

The above confuses two ways of performing the sparql query.

First way: in isql or the Conductor's isql window, if you want to do
sparql-within-sql then you prefix the whole sparql bit with the keyword
"sparql". You've got a prefix statement which the sql engine will not
understand, before you tell it you're talking sparql.

Hence solution #1: move `sparql' to immediately before `prefix' and the
above will work in isql:

> sparql PREFIX rdfs: <http://www.w3.org/200/01/rdf-schema#>
> SELECT ?s  from <http://iaf-dl> WHERE { ?s rdfs:subClassOf ?o };


Second way: if you're using the /isparql interface (`advanced' tab) then
you're already talking sparql and `sparql' is not a valid sparql keyword.

Hence solution #2: remove `sparql' altogether and the trailing semicolon
and it'll work in isparql:

> PREFIX rdfs: <http://www.w3.org/200/01/rdf-schema#>
> SELECT ?s  from <http://iaf-dl> WHERE { ?s rdfs:subClassOf ?o }


For development purposes, I would use the #2 approach, isparql, to build my
sparql queries; if you're subsequently embedding them in sql code for an
application (eg in a VSP page or somesuch) then take the working sparql
query, stick the word `sparql' in front of it and off you go.

Have you seen http://virtuoso.openlinksw.com/wiki/main/Main/VOSSPARQL ,
particularly the list of example queries linked at
http://virtuoso.openlinksw.com/wiki/main/Main/VOSODSSparqlSamples ? They
might help somewhat.

HTH,

~Tim
-- 
Tim Haynes
Product Development Consultant
OpenLink Software
<http://www.openlinksw.com/>

Reply via email to