From: Marco R. <cre...@go...> - 2007-08-21 08:46:33
|
Hi! I have exported rdf-data from a mediawiki into a xml-file. Now I try to query by using the following query-statement: SELECT ?userstory WHERE { ?res rdfs:label ?userstory ?res rdf:type ?type ?type rdfs:label "Kategorie:User Story" } I get an error-message "Unbound prefix rdfs:". I have no clue why, because I have an older version of RAP where this kind of statement works. I also tried: PREFIX rdfs:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdf:<http://www.w3.org/2000/01/rdf-schema#> { ?res rdfs:label ?userstory ?res rdf:type ?type ?type rdfs:label "Kategorie:User Story" } But this doesn't work either. In my php-code, i am doing like in the rap-docu was shown: $base = $rdfFile; $model = ModelFactory::getDefaultModel(); $model->load($base); $model->sparqlQuery($query); Someone an idea? Thanks, Marco |
From: Christian W. <cw...@cw...> - 2007-08-21 11:13:08
Attachments:
signature.asc
|
Marco, > I get an error-message "Unbound prefix rdfs:". I have no clue why, > because I have an older version of RAP where this kind of statement > works. I also tried: >=20 > PREFIX rdfs:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> > PREFIX rdf:<http://www.w3.org/2000/01/rdf-schema#> Try a space between : and <. --=20 Regards/Mit freundlichen Gr=FC=DFen Christian Weiske |
From: P.L.Coetzee <P.L...@op...> - 2007-08-21 15:47:28
|
Hi Marco, Unless you've used them this way around in your instance data, you've = got the namespace prefix and URI swapped over for rdf: and rdfs: - as = you have them, you're asking for properties = <http://www.w3.org/1999/02/22-rdf-syntax-ns#label> and = <http://www.w3.org/2000/01/rdf-schema#type>, not = <http://www.w3.org/2000/01/rdf-schema#label> and = <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>. My guess is that the = query which will give you what you want is: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?userstory WHERE { ?res rdfs:label ?userstory . ?res rdf:type ?type . } Hope that helps your debugging :) Cheers, Peter -----Original Message----- From: rdf...@li... on behalf of = Marco Rieth Sent: Tue 21/08/2007 14:44 To: rdf...@li... Subject: Re: [Rdfapi-php-interest] Unbound Prefix =20 Ok, the space between : and < seems to work. The SparqlParser doesn't complain anymore. But now I have the problem, that no results are = returned, although there should be... Trying to select all triples works just fine: PREFIX rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdf: <http://www.w3.org/2000/01/rdf-schema#> SELECT * WHERE { ?res ?blah ?more } But as soon as I try to select a specific triple using the properties rdfs:label and rdf:type, the result is false: PREFIX rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdf: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?userstory WHERE { ?res rdfs:label ?userstory ?res rdf:type ?type } Could it be, that the rdf-export from the wiki (it's the rdf-export from semantic media wiki) is not compatible with RAP? Or is my query still = messed up? |
From: Marco R. <cre...@go...> - 2007-08-21 13:44:17
|
Ok, the space between : and < seems to work. The SparqlParser doesn't complain anymore. But now I have the problem, that no results are returned, although there should be... Trying to select all triples works just fine: PREFIX rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdf: <http://www.w3.org/2000/01/rdf-schema#> SELECT * WHERE { ?res ?blah ?more } But as soon as I try to select a specific triple using the properties rdfs:label and rdf:type, the result is false: PREFIX rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdf: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?userstory WHERE { ?res rdfs:label ?userstory ?res rdf:type ?type } Could it be, that the rdf-export from the wiki (it's the rdf-export from semantic media wiki) is not compatible with RAP? Or is my query still messed up? |
From: Tom H. <tom...@gm...> - 2007-08-21 15:40:07
|
Hi Marco, It might be the whole of the solution, but the triples patterns in your query should be delimited with full stops ('.'), e.g. PREFIX rdfs: < http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdf: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?userstory WHERE { ?res rdfs:label ?userstory . ?res rdf:type ?type . } (Optional on the last triple pattern IIRC, but I always find it useful for consistency). HTH, and good luck :) Tom. On 21/08/07, Marco Rieth <cre...@go...> wrote: > Ok, the space between : and < seems to work. The SparqlParser doesn't > complain anymore. But now I have the problem, that no results are returned, > although there should be... > > Trying to select all triples works just fine: > > PREFIX rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> > PREFIX rdf: <http://www.w3.org/2000/01/rdf-schema# > > SELECT * > WHERE { ?res ?blah ?more } > > > But as soon as I try to select a specific triple using the properties > rdfs:label and rdf:type, the result is false: > > PREFIX rdfs: < http://www.w3.org/1999/02/22-rdf-syntax-ns#> > PREFIX rdf: <http://www.w3.org/2000/01/rdf-schema#> > SELECT ?userstory > WHERE { > ?res rdfs:label ?userstory > ?res rdf:type ?type } > > Could it be, that the rdf-export from the wiki (it's the rdf-export from > semantic media wiki) is not compatible with RAP? Or is my query still messed > up? > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest > > |
From: Christian W. <cw...@cw...> - 2007-08-21 16:33:42
Attachments:
signature.asc
|
Tom, > It might be the whole of the solution, but the triples patterns in > your query should be delimited with full stops ('.'), e.g. The parser currently does not complain about that, but will as soon as someone takes time to fix the new DAWG tests that define very strict query parsing rules. --=20 Regards/Mit freundlichen Gr=FC=DFen Christian Weiske |
From: Marco R. <cre...@go...> - 2007-08-22 08:10:47
|
Thank you all! It looks like a classical human failure - problem to me :)) But it works just fine now. By declaring the right namespaces with the right URIs I even get the results I expect! While we are at it two more questions: 1.) Does RAP come along with a count-construct in the select-statement? I only found information, that count returns an integer, but nothing further more. So is it possible to use somelike prefix ... select count(?var) where {...} 2.) My rdf-dump declares namespaces with uris. Therefore shouldn't it possible to use my query-statements without using the PREFIX-constructs? The xml-file starts like this: <?xml version=" 1.0" encoding="UTF-8"?> <!DOCTYPE rdf:RDF[ <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'<http://www.w3.org/1999/02/22-rdf-syntax-ns#%27> > <!ENTITY rdfs ' http://www.w3.org/2000/01/rdf-schema#'<http://www.w3.org/2000/01/rdf-schema#%27> > <!ENTITY owl 'http://www.w3.org/2002/07/owl#'<http://www.w3.org/2002/07/owl#%27>> <!ENTITY smw 'http://smw.ontoware.org/2005/smw/'<http://smw.ontoware.org/2005/smw/%27> > <!ENTITY smwdt 'http://smw.ontoware.org/2005/smw-datatype#' <http://smw.ontoware.org/2005/smw-datatype#%27>> <!ENTITY wiki 'http://localhost/sop-2Ddev/index.php/'<http://localhost/sop-2Ddev/index.php/%27> > <!ENTITY thing ' http://localhost/sop-2Ddev/index.php/_'<http://localhost/sop-2Ddev/index.php/_%27> > <!ENTITY relation 'http://localhost/sop-2Ddev/index.php/_Relation-3A'<http://localhost/sop-2Ddev/index.php/_Relation-3A%27> > <!ENTITY attribute ' http://localhost/sop-2Ddev/index.php/_Attribut-3A'<http://localhost/sop-2Ddev/index.php/_Attribut-3A%27> > <!ENTITY dc 'http://purl.org/dc/elements/1.1/' <http://purl.org/dc/elements/1.1/%27>> <!ENTITY wikiurl 'http://localhost/sop-dev/index.php/'<http://localhost/sop-dev/index.php/%27> > ]> <rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:owl ="&owl;" xmlns:smw="&smw;" xmlns:wiki="&wiki;" xmlns:thing="&thing;" xmlns:relation="&relation;" xmlns:attribute="&attribute;" xmlns:dc="&dc;" xmlns:foaf="http://xmlns.com/foaf/0.1/"> <!-- reference to the Semantic MediaWiki schema --> <owl:AnnotationProperty rdf:about="&smw;hasArticle"> <rdfs:isDefinedBy rdf:resource="http://smw.ontoware.org/2005/smw"/> </owl:AnnotationProperty> <owl:AnnotationProperty rdf:about="&smw;hasType"> <rdfs:isDefinedBy rdf:resource="http://smw.ontoware.org/2005/smw"/> </owl:AnnotationProperty> <owl:Class rdf:about="&smw;Thing"> <rdfs:isDefinedBy rdf:resource="http://smw.ontoware.org/2005/smw"/> </owl:Class> <!-- exported page data --> Thanks again and I appreciate your help! Marco |