Permalink
Browse files

functional test for group with join combination that makes binding _o…

…rd to be empty in results.c
  • Loading branch information...
1 parent b3ffe61 commit 2c6675919ac9cc370710bb65688f105122ee4bd1 @msalvadores msalvadores committed Mar 5, 2012
Showing with 92 additions and 0 deletions.
  1. +50 −0 data/group-by.ttl
  2. +21 −0 tests/httpd/exemplar/groupby-multiple-joins
  3. +21 −0 tests/httpd/scripts/groupby-multiple-joins
View
@@ -0,0 +1,50 @@
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
+@prefix owl: <http://www.w3.org/2002/07/owl#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+<http://foaf.qdos.com/a> a <http://foaf.qdos.com/something>.
+<http://foaf.qdos.com/b> a <http://foaf.qdos.com/something> .
+<http://foaf.qdos.com/c> a <http://foaf.qdos.com/something> .
+<http://foaf.qdos.com/d> a <http://foaf.qdos.com/something> .
+<http://foaf.qdos.com/e> a <http://foaf.qdos.com/something> .
+
+<http://foaf.qdos.com/1> a owl:Class;
+ rdfs:subClassOf <http://foaf.qdos.com/0>;
+ skos:prefLabel "class 1";
+.
+
+<http://foaf.qdos.com/11> a owl:Class;
+ rdfs:subClassOf <http://foaf.qdos.com/1>;
+ skos:prefLabel "class 11";
+.
+
+<http://foaf.qdos.com/12> a owl:Class;
+ rdfs:subClassOf <http://foaf.qdos.com/1>;
+ skos:prefLabel "class 12";
+.
+
+<http://foaf.qdos.com/13> a owl:Class;
+ rdfs:subClassOf <http://foaf.qdos.com/1>;
+ skos:prefLabel "class 13";
+.
+
+<http://foaf.qdos.com/2> a owl:Class;
+ rdfs:subClassOf <http://foaf.qdos.com/0>;
+ skos:prefLabel "class 2";
+.
+
+<http://foaf.qdos.com/21> a owl:Class;
+ rdfs:subClassOf <http://foaf.qdos.com/2>;
+ skos:prefLabel "class 21";
+.
+
+<http://foaf.qdos.com/3> a owl:Class;
+ rdfs:subClassOf <http://foaf.qdos.com/0>;
+ skos:prefLabel "class 3";
+.
+
+<http://foaf.qdos.com/0> a owl:Class;
+ skos:prefLabel "class 0";
+.
+
@@ -0,0 +1,21 @@
+201 imported successfully
+This is a 4store SPARQL server [VERSION]
+Query:
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+
+SELECT DISTINCT ?child (COUNT(?sub_child) as ?c)
+FROM <http://example.com/group-by.ttl>
+WHERE {
+ ?child a owl:Class .
+ ?child rdfs:subClassOf <http://foaf.qdos.com/0> .
+ OPTIONAL { ?sub_child rdfs:subClassOf ?child . }
+} GROUP BY ?child ORDER BY ASC(xsd:integer(?c))
+
+?child ?c
+<http://foaf.qdos.com/3> 0
+<http://foaf.qdos.com/2> 1
+<http://foaf.qdos.com/1> 3
+200 deleted successfully
+This is a 4store SPARQL server [VERSION]
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+source sparql.sh
+
+put "$EPR" ../../data/group-by.ttl 'text/turtle' 'http://example.com/group-by.ttl'
+
+sparql "$EPR" '
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+
+SELECT DISTINCT ?child (COUNT(?sub_child) as ?c)
+FROM <http://example.com/group-by.ttl>
+WHERE {
+ ?child a owl:Class .
+ ?child rdfs:subClassOf <http://foaf.qdos.com/0> .
+ OPTIONAL { ?sub_child rdfs:subClassOf ?child . }
+} GROUP BY ?child ORDER BY ASC(xsd:integer(?c))
+'
+
+delete "$EPR" 'http://example.com/group-by.ttl'

0 comments on commit 2c66759

Please sign in to comment.