Skip to content

Commit

Permalink
added further aggregates tests
Browse files Browse the repository at this point in the history
  • Loading branch information
k00ni committed Dec 16, 2017
1 parent 6b3ff97 commit 8a1e551
Show file tree
Hide file tree
Showing 32 changed files with 526 additions and 0 deletions.
124 changes: 124 additions & 0 deletions tests/sparql11/AggregatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,128 @@ public function test_agg_max_02()
$this->makeQueryA1Liner($query)
);
}

public function test_agg_min_01()
{
$this->runTestFor('agg-min-01');
}

public function test_agg_min_02()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-min-02');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'Result is missing multiple entries.'
. PHP_EOL
. 'for query: '.
$this->makeQueryA1Liner($query)
);
}

public function test_agg_sample_01()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg-sample-01');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg_sum_01()
{
$this->markTestSkipped(
'Test skipped, because of rounding bug in SUM function. See https://github.com/semsol/arc2/issues/100'
);
}

public function test_agg01()
{
$this->markTestSkipped(
'Test skipped, because of COUNT function fails. '
. 'Maybe related to https://github.com/semsol/arc2/issues/100'
);
}

public function test_agg02()
{
$this->markTestSkipped(
'Test skipped, because of COUNT function fails. '
. 'Maybe related to https://github.com/semsol/arc2/issues/100'
);
}

public function test_agg03()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg03');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg04()
{
$this->markTestSkipped(
'Test skipped, because of COUNT function fails. '
. 'Maybe related to https://github.com/semsol/arc2/issues/100'
);
}

public function test_agg05()
{
$this->markTestSkipped(
'Test skipped, because of COUNT function fails. '
. 'Maybe related to https://github.com/semsol/arc2/issues/100'
);
}

public function test_agg06()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg06');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg07()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg07');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}

public function test_agg08()
{
$this->runTestFor('agg08');
}

public function test_agg08b()
{
// get failing query
$this->loadManifestFileIntoStore($this->w3cTestsFolderPath);
$query = $this->getTestQuery($this->testPref . 'agg08b');

$this->markTestSkipped(
'This kind of query is currently not supported. '
. 'ARC2_Store::query returns 0 for query: '. PHP_EOL . $this->makeQueryA1Liner($query)
);
}
}
5 changes: 5 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-min-01.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://www.example.org/>
SELECT (MIN(?o) AS ?min)
WHERE {
?s :dec ?o
}
13 changes: 13 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-min-01.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="min"/>
</head>
<results>
<result>
<binding name="min">
<literal datatype="http://www.w3.org/2001/XMLSchema#decimal">1.0</literal>
</binding>
</result>
</results>
</sparql>
6 changes: 6 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-min-02.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PREFIX : <http://www.example.org/>
SELECT ?s (MIN(?o) AS ?min)
WHERE {
?s ?p ?o
}
GROUP BY ?s
49 changes: 49 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-min-02.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="s"/>
<variable name="min"/>
</head>
<results>
<result>
<binding name="s">
<uri>http://www.example.org/ints</uri>
</binding>
<binding name="min">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
</binding>
</result>
<result>
<binding name="s">
<uri>http://www.example.org/decimals</uri>
</binding>
<binding name="min">
<literal datatype="http://www.w3.org/2001/XMLSchema#decimal">1.0</literal>
</binding>
</result>
<result>
<binding name="s">
<uri>http://www.example.org/doubles</uri>
</binding>
<binding name="min">
<literal datatype="http://www.w3.org/2001/XMLSchema#double">1.0E2</literal>
</binding>
</result>
<result>
<binding name="s">
<uri>http://www.example.org/mixed1</uri>
</binding>
<binding name="min">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
</binding>
</result>
<result>
<binding name="s">
<uri>http://www.example.org/mixed2</uri>
</binding>
<binding name="min">
<literal datatype="http://www.w3.org/2001/XMLSchema#double">2.0E-1</literal>
</binding>
</result>
</results>
</sparql>
8 changes: 8 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-numeric.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@prefix : <http://www.example.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:ints :int 1, 2, 3 .
:decimals :dec 1.0, 2.2, 3.5 .
:doubles :double 1.0E2, 2.0E3, 3.0E4 .
:mixed1 :int 1 ; :dec 2.2 .
:mixed2 :double 2E-1 ; :dec 2.2 .
8 changes: 8 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-numeric2.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@prefix : <http://www.example.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:ints :int 1, 2, 3 .
:decimals :dec 1.0, 2.2, 3.5 .
:doubles :double 1.0E2, 2.0E3, 3.0E4 .
:mixed1 :int 1 ; :dec 2.2 .
:mixed2 :double 2E-1 ; :dec 0.2 .
10 changes: 10 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-sample-01.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PREFIX : <http://www.example.org/>
ASK {
{
SELECT (SAMPLE(?o) AS ?sample)
WHERE {
?s :dec ?o
}
}
FILTER(?sample = 1.0 || ?sample = 2.2 || ?sample = 3.5)
}
5 changes: 5 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-sample-01.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head/>
<boolean>true</boolean>
</sparql>
5 changes: 5 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-sum-01.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://www.example.org/>
SELECT (SUM(?o) AS ?sum)
WHERE {
?s :dec ?o
}
13 changes: 13 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-sum-01.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="sum"/>
</head>
<results>
<result>
<binding name="sum">
<literal datatype="http://www.w3.org/2001/XMLSchema#decimal">11.1</literal>
</binding>
</result>
</results>
</sparql>
6 changes: 6 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-sum-02.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PREFIX : <http://www.example.org/>
SELECT ?s (SUM(?o) AS ?sum)
WHERE {
?s ?p ?o
}
GROUP BY ?s
49 changes: 49 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg-sum-02.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="s"/>
<variable name="sum"/>
</head>
<results>
<result>
<binding name="s">
<uri>http://www.example.org/ints</uri>
</binding>
<binding name="sum">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">6</literal>
</binding>
</result>
<result>
<binding name="s">
<uri>http://www.example.org/decimals</uri>
</binding>
<binding name="sum">
<literal datatype="http://www.w3.org/2001/XMLSchema#decimal">6.7</literal>
</binding>
</result>
<result>
<binding name="s">
<uri>http://www.example.org/doubles</uri>
</binding>
<binding name="sum">
<literal datatype="http://www.w3.org/2001/XMLSchema#double">3.21E4</literal>
</binding>
</result>
<result>
<binding name="s">
<uri>http://www.example.org/mixed1</uri>
</binding>
<binding name="sum">
<literal datatype="http://www.w3.org/2001/XMLSchema#decimal">3.2</literal>
</binding>
</result>
<result>
<binding name="s">
<uri>http://www.example.org/mixed2</uri>
</binding>
<binding name="sum">
<literal datatype="http://www.w3.org/2001/XMLSchema#double">4.0E-1</literal>
</binding>
</result>
</results>
</sparql>
4 changes: 4 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg01.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PREFIX : <http://www.example.org>

SELECT (COUNT(?O) AS ?C)
WHERE { ?S ?P ?O }
13 changes: 13 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg01.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="C"/>
</head>
<results>
<result>
<binding name="C">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">5</literal>
</binding>
</result>
</results>
</sparql>
4 changes: 4 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg01.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@prefix : <http://www.example.org/> .

:s :p1 :o1, :o2, :o3.
:s :p2 :o1, :o2.
5 changes: 5 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg02.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://www.example.org>

SELECT ?P (COUNT(?O) AS ?C)
WHERE { ?S ?P ?O }
GROUP BY ?P
25 changes: 25 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg02.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="P"/>
<variable name="C"/>
</head>
<results>
<result>
<binding name="P">
<uri>http://www.example.org/p1</uri>
</binding>
<binding name="C">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">3</literal>
</binding>
</result>
<result>
<binding name="P">
<uri>http://www.example.org/p2</uri>
</binding>
<binding name="C">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal>
</binding>
</result>
</results>
</sparql>
6 changes: 6 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg03.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PREFIX : <http://www.example.org>

SELECT ?P (COUNT(?O) AS ?C)
WHERE { ?S ?P ?O }
GROUP BY ?P
HAVING (COUNT(?O) > 2 )
17 changes: 17 additions & 0 deletions tests/sparql11/w3c-tests/aggregates/agg03.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="P"/>
<variable name="C"/>
</head>
<results>
<result>
<binding name="P">
<uri>http://www.example.org/p1</uri>
</binding>
<binding name="C">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">3</literal>
</binding>
</result>
</results>
</sparql>
Loading

0 comments on commit 8a1e551

Please sign in to comment.