SPARQL queries and XPath

2 views
Skip to first unread message

Terry Brooks

unread,
May 23, 2009, 4:50:38 PM5/23/09
to greasemon...@googlegroups.com
Does anyone have an example of making a GM_xmlhttpRequest to DBPedia with the mime type 'application/sparql-results+xml'? The payload is recognized as an XML object, but I can't seem to make a successful XPath query into this object. All resulting nodelists following the directions of "Using the Mozilla JavaScript Interface to XPath" (http://www-xray.ast.cam.ac.uk/~jgraham/mozilla/xpath-tutorial.html) are zero length.

Has anyone received an XML payload from DBPedia and be able to unpack it with XPath?

Thanks, Terry

Terrence Brooks
Information School
University of Washington
Voice: 206 543-2646
Fax: 206 616-3152
E-mail: tabr...@u.washington.edu
Web: http://faculty.washington.edu/tabrooks/


Matěj Cepl

unread,
May 24, 2009, 8:18:59 AM5/24/09
to greasemon...@googlegroups.com
Terry Brooks píše v So 23. 05. 2009 v 13:50 -0700:

> Does anyone have an example of making a GM_xmlhttpRequest to DBPedia
> with the mime type 'application/sparql-results+xml'? The payload is
> recognized as an XML object, but I can't seem to make a successful
> XPath query into this object. All resulting nodelists following the
> directions of "Using the Mozilla JavaScript Interface to XPath"
> (http://www-xray.ast.cam.ac.uk/~jgraham/mozilla/xpath-tutorial.html)
> are zero length.

It would be really much more useful if you could show us whole script
which doesn't work, so that we have something more tangible to work
with.

Matěj

pjohans

unread,
Jul 3, 2009, 7:07:50 AM7/3/09
to greasemonkey-users
I Had the same problem.
Solved it by registering the namespace; http://www.w3.org/2005/sparql-results#.
like this :
$xp->registerNamespace("wtf","http://www.w3.org/2005/sparql-
results#");
$query="/wtf:sparql/wtf:results .... etc


On May 23, 10:50 pm, Terry Brooks <tabro...@u.washington.edu> wrote:
> Does anyone have an example of making a GM_xmlhttpRequest to DBPedia with the mime type 'application/sparql-results+xml'?  The payload is recognized as an XML object, but I can't seem to make a successfulXPathqueryinto this object.  All resulting nodelists following the directions of "Using the Mozilla JavaScript Interface toXPath" (http://www-xray.ast.cam.ac.uk/~jgraham/mozilla/xpath-tutorial.html) are zero length.
>
> Has anyone received an XML payload from DBPedia and be able to unpack it withXPath?
>
> Thanks, Terry
>
> Terrence Brooks
> Information School
> University of Washington
> Voice: 206 543-2646
> Fax: 206 616-3152
> E-mail: tabro...@u.washington.edu
> Web:http://faculty.washington.edu/tabrooks/
Reply all
Reply to author
Forward
0 new messages