- From: Jon Crump <jjcrump@myuw.net>
- Date: Mon, 27 Oct 2008 11:19:11 -0700 (PDT)
- To: public-cwm-talk@w3.org
dear all,
[cwm 1.2.1 on Mac intel OS X 10.5.4]
Some things I don't understand about the implementation of sparql in cwm:
With a testGraph.rdf (appended), the following query returns the expected
results:
PREFIX ex: <http://temp.example.org/terms/>
PREFIX loc: <http://simile.mit.edu/2005/05/ontologies/location#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?event ?place
WHERE {{?event ex:date ?date .
FILTER (?date >= "2008-01-04"^^xsd:date && ?date <=
"2008-01-08"^^xsd:date)}
UNION {?event ex:starts ?start; ex:finishes ?end.
FILTER ((?start >= "2008-01-04"^^xsd:date && ?end <=
"2008-01-08"^^xsd:date)
|| (?start <= "2008-01-04"^^xsd:date && ?end >=
"2008-01-04"^^xsd:date)
|| (?start <= "2008-01-08"^^xsd:date && ?end >=
"2008-01-08"^^xsd:date)
)
}
OPTIONAL { ?event loc:place ?place .}
}
However, If I modify the SELECT clause thus:
SELECT *
I get the following traceback and runtime error:
Traceback (most recent call last):
File "/Applications/RDFapps/cwm-1.2.1/cwm", line 750, in <module>
doCommand()
File "/Applications/RDFapps/cwm-1.2.1/cwm", line 741, in doCommand
flags=option_flags[option_format])
File "/Applications/RDFapps/cwm-1.2.1/swap/llyn.py", line 1872, in
dumpNested
pp. dumpNested()
File "/Applications/RDFapps/cwm-1.2.1/swap/pretty.py", line 524, in
dumpNested
self.selectDefaultPrefix(Serializer.dumpNested)
File "/Applications/RDFapps/cwm-1.2.1/swap/pretty.py", line 114, in
selectDefaultPrefix
printFunction(dummySerializer)
File "/Applications/RDFapps/cwm-1.2.1/swap/pretty.py", line 525, in
dumpNested
self.dumpFormulaContents(context, self.sink, sorting=1, equals=1)
File "/Applications/RDFapps/cwm-1.2.1/swap/pretty.py", line 600, in
dumpFormulaContents
self._dumpSubject(currentSubject, context, sink, sorting, statements)
File "/Applications/RDFapps/cwm-1.2.1/swap/pretty.py", line 632, in
_dumpSubject
self.dumpFormulaContents(subj, sink, sorting)
File "/Applications/RDFapps/cwm-1.2.1/swap/pretty.py", line 600, in
dumpFormulaContents
self._dumpSubject(currentSubject, context, sink, sorting, statements)
File "/Applications/RDFapps/cwm-1.2.1/swap/pretty.py", line 697, in
_dumpSubject
self.dumpStatement(sink, s.quad, sorting)
File "/Applications/RDFapps/cwm-1.2.1/swap/pretty.py", line 707, in
dumpStatement
self._outputStatement(sink, triple) # Do 1-loops simply
File "/Applications/RDFapps/cwm-1.2.1/swap/pretty.py", line 280, in
_outputStatement
sink.makeStatement(auxPairs(quad), aIsPossible=aWorks)
File "/Applications/RDFapps/cwm-1.2.1/swap/toXML.py", line 328, in
makeStatement
raise RuntimeError("Unexpected subject", `subj`)
RuntimeError: ('Unexpected subject', "(21, ('2008-01-04',
u'http://www.w3.org/2001/XMLSchema#date'))")
I get the same error if the SELECT clause is anything like this:
SELECT ?event ?date
or
SELECT ?event ?start
or
SELECT ?event ?date ?start ?end ?place
Something not implemented yet? Or something I don't understand about how
sparql is implemented in cwm?
Grateful for any illumination,
Jon
PS.
Also, in a (not related?) issue:
following the sparql query, include --sparqlResults
Results in the following error:
Traceback (most recent call last):
File "/Applications/RDFapps/cwm-1.2.1/cwm", line 750, in <module>
doCommand()
File "/Applications/RDFapps/cwm-1.2.1/cwm", line 698, in doCommand
from cwm_sparql import outputString, SPARQL_NS
ImportError: No module named cwm_sparql
===============
testGraph.rdf follows:
===============
<rdf:RDF xmlns:ex="http://temp.example.org/terms/"
xmlns:loc="http://simile.mit.edu/2005/05/ontologies/location#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<ex:Event rdf:about="http://temp.example.org/terms/Event#case0">
<ex:date
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-03</ex:date>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case0_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case1">
<ex:starts
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-01</ex:starts>
<ex:finishes
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-03</ex:finishes>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case1_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case2">
<ex:starts
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-02</ex:starts>
<ex:finishes
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-04</ex:finishes>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case2_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case3">
<ex:starts
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-03</ex:starts>
<ex:finishes
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-05</ex:finishes>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case3_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case4">
<ex:starts
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-05</ex:starts>
<ex:finishes
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-07</ex:finishes>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case4_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case5">
<ex:starts
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-03</ex:starts>
<ex:finishes
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-09</ex:finishes>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case5_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case6">
<ex:date
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-04</ex:date>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case6_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case7">
<ex:date
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-06</ex:date>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case7_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case8">
<ex:date
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-08</ex:date>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case8_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case9">
<ex:starts
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-08</ex:starts>
<ex:finishes
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-10</ex:finishes>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case9_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case10">
<ex:starts
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-09</ex:starts>
<ex:finishes
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-11</ex:finishes>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case10_place" />
</ex:Event>
<ex:Event rdf:about="http://temp.example.org/terms/Event#case11">
<ex:date
rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-01-09</ex:date>
<loc:place
rdf:resource="http://temp.example.org/terms/Place#case11_place" />
</ex:Event>
</rdf:RDF>
Received on Monday, 27 October 2008 22:08:31 UTC