clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Minto van der Sluis <mi...@xup.nl>
Subject Re: Querying named graphs do not give the expected results
Date Wed, 08 May 2013 16:10:52 GMT
Hi Reto,

Thanks for pointing me in the right direction.

Indeed graphnames need to be correct urirefs. Using <urn:uuid:....>
solved my problems.

Thanks again.

Regards,

misl

Op 8-5-2013 9:19, Reto Bachmann-Gmür schreef:
> Hi Minto
>
> On Stanbol I've noticed that some graphs do not appear in
> TcManager.listTripleColletions. It might have to do something with an
> invalid URI used as graph named. In your example it seems to that you're
> nor using correct URIRefs. Could you try if it makes a difference using
> real uuid-uris?
>
> Cheers,
> Reto
>
>
> On Mon, May 6, 2013 at 1:29 PM, Minto van der Sluis <minto@xup.nl> wrote:
>
>> Hi folks,
>>
>> Not sure whether it is my (in)ability to write Sparql queries or
>> something odd is going  on. But I am having some trouble with querying
>> specific named graphs.
>>
>> To give some context before showing the queries. I have a situation
>> where I have 2 named graphs:
>>   1) Index named <http://digimelding.nl/AStore/stamIndex> containing
>> references to other named graphs.
>>   2) A named graph <7e72ff00-48f1-11e2-bcfd-0800200c9a66> containing
>> actual data. The graph name is a UUID.
>>
>> Querying the first gives expected results. But when querying the second
>> I do not get the results I expect.
>>
>> Query 1: Show all named graphs with actual content(triples).
>>  SELECT distinct ?g
>>   WHERE {
>>     GRAPH ?g {
>>       ?s ?p ?o .
>>     }
>>   }
>>
>>   Results in:
>>   +------------------------------------------+
>>   | g                                        |
>>   +------------------------------------------+
>>   | <7e72ff00-48f1-11e2-bcfd-0800200c9a66>   |
>>   | <http://digimelding.nl/AStore/stamIndex> |
>>   +------------------------------------------+
>>
>> Query 2: To show the total number of triples present in both named graphs:
>>  SELECT (COUNT(?s) as ?numberOfTriples)
>>   WHERE {
>>     GRAPH ?g {
>>       ?s ?p ?o .
>>     }
>>   }
>>
>>   Results in:
>>   +--------------------------------------------------+
>>   | numberOfTriples                                  |
>>   +--------------------------------------------------+
>>   | "29"^^<http://www.w3.org/2001/XMLSchema#integer> |
>>   +--------------------------------------------------+
>>
>> Query 3: Get the number of triples present in the index graph.
>>   SELECT (COUNT(?s) as ?numberOfTriples)
>>   WHERE {
>>     GRAPH <http://digimelding.nl/AStore/stamIndex> {
>>       ?s ?p ?o .
>>     }
>>   }
>>
>>   Results in:
>>   +-------------------------------------------------+
>>   | numberOfTriples                                 |
>>   +-------------------------------------------------+
>>   | "1"^^<http://www.w3.org/2001/XMLSchema#integer> |
>>   +-------------------------------------------------+
>>
>> Query 4: In my quest for the getting the results I wanted I played
>> around with various query forms. In my understanding thuis query should
>> yield the same results as the previous one. Unfortunately, it doesn't.
>>   SELECT (COUNT(?s) as ?numberOfTriples)
>>   FROM <http://digimelding.nl/AStore/stamIndex>
>>   WHERE {
>>       ?s ?p ?o .
>>   }
>>
>>   Results in:
>>   +-------------------------------------------------+
>>   | numberOfTriples                                 |
>>   +-------------------------------------------------+
>>   | "0"^^<http://www.w3.org/2001/XMLSchema#integer> |
>>   +-------------------------------------------------+
>>
>> Query 5: Every query targeted on a named graph (UUID) with the actual
>> content gives no results. Clearly this query should return ( total
>> triples 29 - index triples 1 =) 28 triples. Unfortunately it doesn't.
>>   SELECT (COUNT(?s) as ?numberOfTriples)
>>   WHERE {
>>     GRAPH <7e72ff00-48f1-11e2-bcfd-0800200c9a66> {
>>       ?s ?p ?o .
>>     }
>>   }
>>
>>   Results in:
>>   +-------------------------------------------------+
>>   | numberOfTriples                                 |
>>   +-------------------------------------------------+
>>   | "0"^^<http://www.w3.org/2001/XMLSchema#integer> |
>>   +-------------------------------------------------+
>>
>> My code to execute these queries on Clerezza is actually quite simple:
>>
>>     Object results = clerezzaManager.executeSparqlQuery( query, new
>> SimpleMGraph() );
>>
>> In here the query is just a string containing one of the queries as
>> shown above. Execution uses Clerezza from trunk with my committed
>> changes to the QueryEngine.
>>
>> Does anyone know why query 4 and 5 do not yield the expected outcome?
>>
>> Regards,
>>
>> misl


Mime
View raw message