From: GSO <gs...@ya...> - 2006-11-28 17:36:10
|
A basic test statement - this works fine without the FILTER added, but returns a boolean false as a result with: PREFIX ll: <http://www.gsowww.uklinux.net/librarylinks/vocabulary#> SELECT * WHERE { ?url ll:title ?title . ?url ll:abstract ?abstract . ?url ll:date ?date . ?url ll:publisher ?publisher . FILTER ?date >= 0 } ORDER BY DESC(?date) '?date' is a number created with mktime(), e.g., Literal: 1112486400. If anyone can figure the bug in this I'd very much appreciate it. Thanks GSO http://www.gsowww.uklinux.net/pub |
From: Seaborne, A. <and...@hp...> - 2006-11-28 20:17:42
|
GSO wrote: > A basic test statement - this works fine without the FILTER added, but > returns a boolean false as a result with: > > PREFIX ll: <http://www.gsowww.uklinux.net/librarylinks/vocabulary#> > SELECT * > WHERE { ?url ll:title ?title . > ?url ll:abstract ?abstract . > ?url ll:date ?date . > ?url ll:publisher ?publisher . > FILTER ?date >= 0 Firstly, that isn't valid SPARQL syntax - should be FILTER (?date >= 0). May be that is confusing it. Assuming, it's not that, if ?date is a string, then it is false (it's a type error). Literals obey datatyping. In SPARQL, you can cast to an integer with xsd:integer(?date). Andy > } > ORDER BY DESC(?date) > > '?date' is a number created with mktime(), e.g., Literal: 1112486400. > > If anyone can figure the bug in this I'd very much appreciate it. > > Thanks > > GSO > http://www.gsowww.uklinux.net/pub > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest |
From: GSO <gs...@ya...> - 2006-11-28 21:56:27
|
OK, you're right by the looks about not using valid syntax, however the problem changes when I use parentheses, I then get the following error: <quote> SPARQL PARSER ERROR: ) is neither a valid rdf- node nor a variable. In Query: PREFIX ll: <http://www.gsowww.uklinux.net/librarylinks/vocabulary#> SELECT * WHERE { ?url ll:title ?title . ?url ll:abstract ?abstract . ?url ll:date ?date . ?url ll:publisher ?publisher . FILTER (?date >= 0->)<- Fatal error: Call to a member function getFromNamedPart() on a non-object in /opt/lampp/htdocs/rdfapi-php/api/sparql/SparqlEngine.php on line 417 </quote> The closing/right parenthesis causes an error. GSO On 28/11/06, Seaborne, Andy <and...@hp...> wrote: > > > GSO wrote: > > A basic test statement - this works fine without the FILTER added, but > > returns a boolean false as a result with: > > > > PREFIX ll: <http://www.gsowww.uklinux.net/librarylinks/vocabulary#> > > SELECT * > > WHERE { ?url ll:title ?title . > > ?url ll:abstract ?abstract . > > ?url ll:date ?date . > > ?url ll:publisher ?publisher . > > FILTER ?date >= 0 > > Firstly, that isn't valid SPARQL syntax - should be FILTER (?date >= 0). May > be that is confusing it. > > Assuming, it's not that, if ?date is a string, then it is false (it's a type > error). Literals obey datatyping. > > In SPARQL, you can cast to an integer with xsd:integer(?date). > > Andy > > > } > > ORDER BY DESC(?date) > > > > '?date' is a number created with mktime(), e.g., Literal: 1112486400. > > > > If anyone can figure the bug in this I'd very much appreciate it. > > > > Thanks > > > > GSO > > http://www.gsowww.uklinux.net/pub > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share your > > opinions on IT & business topics through brief surveys - and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Rdfapi-php-interest mailing list > > Rdf...@li... > > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest > |
From: Seaborne, A. <and...@hp...> - 2006-11-28 22:52:51
|
GSO wrote: > OK, you're right by the looks about not using valid syntax, however > the problem changes when I use parentheses, I then get the following > error: > > <quote> > SPARQL PARSER ERROR: ) is neither a valid rdf- node nor a variable. > In Query: > > PREFIX ll: <http://www.gsowww.uklinux.net/librarylinks/vocabulary#> > SELECT * > WHERE { ?url ll:title ?title . > ?url ll:abstract ?abstract . > ?url ll:date ?date . > ?url ll:publisher ?publisher . > FILTER (?date >= 0->)<- > > Fatal error: Call to a member function getFromNamedPart() on a > non-object in /opt/lampp/htdocs/rdfapi-php/api/sparql/SparqlEngine.php > on line 417 That looks like bad news. > </quote> > > The closing/right parenthesis causes an error. > > GSO There's a SPARQL valdiator at: http://www.sparql.org/validator.html which is running a parser derived from the master version of the SPARQL grammar (in fact, the javacc grammar it works from is the input to making the HTML in the spec via perl script). It passes the query: PREFIX ll: <http://www.gsowww.uklinux.net/librarylinks/vocabulary#> SELECT * WHERE { ?url ll:title ?title . ?url ll:abstract ?abstract . ?url ll:date ?date . ?url ll:publisher ?publisher . FILTER (?date >= 0 ) } ORDER BY DESC(?date) While the SPARQL grammar has changed, the language accepted by the grammar has not in some while. The grammar changes to better reflect the rest of the SPARQL design. I wonder if the parser is off a little, whether it is correctly gathering up the expression. Andy |