Hi!

I've been working to simplify some of our queries (really!) and I have this 
query:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dct: <http://purl.org/dc/terms/>

CONSTRUCT { 
  ?resource a ?type ; 
            rdfs:label ?title . 
} 
FROM <http://msone.computas.no/graphs>  
FROM NAMED <http://msone.computas.no/graphs/inferred/mo/agent-realisation1>
FROM NAMED <http://msone.computas.no/graphs/inferred/nfi/realisation1>
FROM NAMED <http://msone.computas.no/graphs/inferred/bildetest/realisation1>
FROM NAMED 
<http://msone.computas.no/graphs/inferred/bildetest/agent-realisation1>
FROM NAMED <http://msone.computas.no/graphs/inferred/nfi/agent-realisation1>
FROM NAMED <http://msone.computas.no/graphs/inferred/mo/realisation1>
FROM NAMED <http://msone.computas.no/graphs/instance/bildetest>
FROM NAMED <http://msone.computas.no/graphs/instance/nfi>
FROM NAMED <http://msone.computas.no/graphs/instance/mo>
WHERE {  
  ?realizations a <http://msone.computas.no/graphs#RealisationAllGraph> .  
  GRAPH ?realizations {
    ?resource a <http://www.computas.com/mediasone-ontologi#Aktoer> . 
  }  
  ?instances a <http://msone.computas.no/graphs#InstanceGraph> .  
  GRAPH ?instances   {  
    ?resource a ?type .  
    FILTER (?type = <http://creativecommons.org/ns#Work> ) . 
    ?resource dct:title ?title . 
  } 
  FILTER regex(?title, "kje", "i")   
}
ORDER BY ?title LIMIT 18 OFFSET 0

And I can't see anything wrong with it, nor can Jena, but I get the following 
error:

37000 Error SQ150: Column 'S' is invalid in the select list because it is not 
contained in either an aggregate function or the GROUP BY clause.

This happens both on 5.0.11 and today's snapshot.

Now, it works if I remove the line ORDER BY ?title LIMIT 18 OFFSET 0
That's not correct, is it? 

I get the same error message when running explain on the query, and I didn't 
remember how I would get the whole thing dumped, but here is what appears to 
be an excerpt:

SELECT TOP 1 DB.DBA.SPARQL_CONSTRUCT (
         vector (
             vector (
                 1,
                 0,
                 3,
                 __i2id ( 
UNAME'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' ),
                 1,
                 2),
             vector (
                 1,
                 0,
                 3,
                 __i2id ( UNAME'http://www.w3.org/2000/01/rdf-schema#label' ),
                 1,
                 1)),
         "limofs"."ctor-1",
         vector (),
         1) AS "callret-0"
FROM (SELECT TOP 18 vector (
         "s-1-11-t6"."S" ,
         __ro2lo ( "s-1-11-t6"."O" ),
         MAX (
             iri_to_id ( UNAME'http://creativecommons.org/ns#Work' ))) 
AS "ctor-1"
    FROM DB.DBA.RDF_QUAD AS "s-1-6-t2",
        DB.DBA.RDF_QUAD AS "s-1-8-t3",
        DB.DBA.RDF_QUAD AS "s-1-6-t4",
        DB.DBA.RDF_QUAD AS "s-1-11-t5",
        DB.DBA.RDF_QUAD AS "s-1-11-t6"
    WHERE "s-1-6-t2"."G" = __i2idn ( 
__bft( 'http://msone.computas.no/graphs' , 1))
        AND  ( "s-1-6-t2"."S" < min_bnode_iri_id ())
        AND  "s-1-6-t2"."P" = __i2idn ( 
__bft( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' , 1))
        AND  isiri_id ( "s-1-6-t2"."O")
        AND  "s-1-6-t2"."O" = __i2idn ( 
__bft( 'http://msone.computas.no/graphs#RealisationAllGraph' , 1))
        AND  "s-1-8-t3"."P" = __i2idn ( 
__bft( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' , 1))
        AND  isiri_id ( "s-1-8-t3"."O")
        AND  "s-1-8-t3"."O" = __i2idn ( 
__bft( 'http://www.computas.com/mediasone-ontologi#Aktoer' , 1))
        AND  "s-1-6-t4"."G" = __i2idn ( 
__bft( 'http://msone.computas.no/graphs' , 1))
        AND  ( "s-1-6-t4"."S" < min_bnode_iri_id ())
        AND  "s-1-6-t4"."P" = __i2idn ( 
__bft( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' , 1))
        AND  isiri_id ( "s-1-6-t4"."O")
        AND  "s-1-6-t4"."O" = __i2idn ( 
__bft( 'http://msone.computas.no/graphs#InstanceGraph' , 1))
        AND  "s-1-11-t5"."P" = __i2idn ( __bft( 'ht

Kind regards 

Kjetil Kjernsmo
-- 
Senior Knowledge Engineer
Mobile: +47 986 48 234
Email: kjetil.kjern...@computas.com   
Web: http://www.computas.com/

|  SHARE YOUR KNOWLEDGE  |

Computas AS  PO Box 482, N-1327 Lysaker | Phone:+47 6783 1000 | Fax:+47 6783 
1001


Reply via email to