EmidioStani / rdfquery

Automatically exported from code.google.com/p/rdfquery
0 stars 0 forks source link

Can't work out how to query databank #40

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Okay, so this isn't a defect, or maybe it's a documentation issue, or a defect 
in my brain :-)

I'm really struggling to work out how to query a RDF databank.  The 
documentation is here:

https://code.google.com/p/rdfquery/wiki/RdfPlugin

but this is as far as I'm getting at the moment:

The databank store after a couple of statements in our faqbot project 
https://github.com/tansaku/faqbot is this:

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dc: 
<http://purl.org/dc/elements/1.1/> . @prefix dct: <http://purl.org/dc/terms/> . 
_:matilda a "horse" ; foaf:name "matilda" . _:SaaS a "course" ; foaf:name 
"SaaS" .

I've got as far as this in the chrome debugger

result = $.rdf({databank:databank}).where('_:matilda a ?').select()[0]

but the result is then an object like this

Object {: $.rdf.literal.fn.$.rdf.literal.init}

which I can inspect in the chrome developer toolbar and see the value "horse" 
is in there, but I cannot find a way to get that information out.

: $.rdf.literal.fn.$.rdf.literal.init
value: "horse"
__proto__: Object

I just want to be able to support a query that says something like "what is 
matilda?" and get the response "matilda is a horse", the data is there, but I 
can't access it at present ...

I think I am fundamentally missing something about this whole rdf databank 
thing.  Is there some simple mistake I'm making?

Many thanks in advance

CHEERS> SAM

Original issue reported on code.google.com by tans...@gmail.com on 7 Mar 2013 at 10:07