[redland-dev] Querying using SPARQL - misc questions
Anahide Tchertchian
at at nuxeo.com
Wed Feb 8 20:35:04 GMT 2006
> So what should I understand about this constraint? Are literals without
> a datatype considered to be strings, and only strings can have a
> language set? (?)
I've got my answers, sorry I missed one chapter about RDF concepts :)
> By "reuse" I mean using a node from the results to create a statement
> that I will then delete from the graph.
> It turns out I only have the problem with a mysql storage (and not
> memory), and I suspect this only happens with "invalid" literals (with
> both language and datatypes set).
> I'll see if I still have the problem after correction.
I confirm I do not have this problem anymore using "valid" literal nodes.
I still have problems querying my graph, though. I've been trying to get
a hierarchy of objects, and I'm getting inconsistant results.
Imagine I've got an object 'root', with subobjects 'subob1' and
'subob2'. 'subob1' also has a subobject named 'subsubob1'. This is
described using an 'isPartOf' relation.
I'd like to get this hierarchy, and tried to use two different SPARQL
queries.
The first one does not give me the 'subob2' node although I'm using
OPTIONAL:
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT ?node1, ?node2
WHERE {
?node1 dcterms:isPartOf <root> .
OPTIONAL { ?node2 dcterms:isPartOf ?node1 }
}
The second one, that I thought would be equivalent, gives inconsistant
results:
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT ?node1, ?node2
WHERE {
OPTIONAL { ?node2 dcterms:isPartOf ?node1 }
?node1 dcterms:isPartOf <root>
}
'root' is returned as 'node1' values although I did not state it is a
part of itself, and I still dont get the 'subob2' result.
Attached is a python script reproducing what I'm saying (sorry for the
raw output).
Am I doing something wrong? Is this a know bug? Is there another way to
achieve that?
Thanks for any clues,
anahide.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: redland_optional_query.py
Type: text/x-python
Size: 2236 bytes
Desc: not available
Url : http://lists.gnomehack.com/pipermail/redland-dev/attachments/20060208/8e41f458/redland_optional_query.py
More information about the redland-dev
mailing list