You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@marmotta.apache.org by "Sebastian Schaffert (JIRA)" <ji...@apache.org> on 2014/10/15 17:15:33 UTC
[jira] [Commented] (MARMOTTA-552) Sparql Query for Dataset View
fails
[ https://issues.apache.org/jira/browse/MARMOTTA-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14172462#comment-14172462 ]
Sebastian Schaffert commented on MARMOTTA-552:
----------------------------------------------
The problem here is the SELECT in the second UNION part (which is actually not really needed anyways). The SQL generated looks like this:
{code}
SELECT U1.U2 AS V4, COUNT(U1_V2.id) AS V5
FROM ((SELECT NULL AS U4, NULL AS U3, P1.object AS U2, P1.subject AS U1
FROM triples P1
INNER JOIN nodes AS P1_subject_V1 ON P1.subject = P1_subject_V1.id
INNER JOIN nodes AS P1_object_V2 ON P1.object = P1_object_V2.id
WHERE P1.deleted = false
AND P1.predicate = 520225347082346498
) UNION (SELECT NULL AS U2, S1.V1 AS U1
FROM (SELECT P1.subject AS V1
FROM triples P1
INNER JOIN nodes AS P1_subject_V1 ON P1.subject = P1_subject_V1.id
INNER JOIN nodes AS P1_predicate_V2 ON P1.predicate = P1_predicate_V2.id
INNER JOIN nodes AS P1_object_V3 ON P1.object = P1_object_V3.id
WHERE P1.deleted = false
AND NOT (EXISTS (SELECT _P1.object AS V1, P1.subject AS V1
FROM triples _P1
INNER JOIN nodes AS _P1_subject_V1 ON _P1.subject = _P1_subject_V1.id
INNER JOIN nodes AS _P1_object_V1 ON _P1.object = _P1_object_V1.id
WHERE _P1.deleted = false
AND P1.subject = _P1.subject
AND _P1.predicate = 520225347082346498
))
GROUP BY P1.subject
) AS S1
)) AS U1 LEFT JOIN nodes AS U1_V2 ON U1.U1 = U1_V2.id
GROUP BY U1.U2
{code}
The problem is that the second part of the UNION has a different number of columns. This is caused by the SQLUnion implementation collecting all variables contained in the subquery instead of only considering those of the projection.
> Sparql Query for Dataset View fails
> -----------------------------------
>
> Key: MARMOTTA-552
> URL: https://issues.apache.org/jira/browse/MARMOTTA-552
> Project: Marmotta
> Issue Type: Bug
> Reporter: Thomas Kurz
> Labels: SPARQL
>
> The dataset view tries to list classes with a SPARQL query that fails:
> {code}
> SELECT ?class (count(?s) AS ?count)
> WHERE
> { { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?class }
> UNION
> { SELECT ?s
> WHERE
> { ?s ?a ?b
> FILTER NOT EXISTS {?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?class }
> }
> GROUP BY ?s
> }
> }
> GROUP BY ?class
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)