Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SPARQL 1.1 compliance tests (incomplete) #102

Merged
merged 20 commits into from
Jan 9, 2018
Merged

Added SPARQL 1.1 compliance tests (incomplete) #102

merged 20 commits into from
Jan 9, 2018

Conversation

k00ni
Copy link
Collaborator

@k00ni k00ni commented Dec 16, 2017

What do you do, if you have a cold and must stay at home? You write tests for ARC2! :trollface:

W3C test suite

There is a test suite for SPARQL 1.1 compliance provided by the W3C here: https://www.w3.org/2009/sparql/docs/tests/. It contains many tests for different types of queries. They range from simple SELECT queries over function-usage to graph management.

Goal and motivation

I want to know the current state of SPARQL 1.0/1.1 support of ARC2. Instead of using custom queries, i decided to use the official test suite. Their tests showed that ARC2 lacks major parts of SPARQL 1.0/1.1. Please do not understand that as blaming, but as a first step to define a basement for further development. With these tests, further changes on the query engine can be made without worrying about adding bugs or change expected behavior.

Tested ARC2 component

These new tests check the result from ARC2_Store::query for a given query.

Coverage

I picked mostly cases, which cover major functionality. In the following related folders from the test suite:

  • aggregates
  • construct
  • delete
  • drop
  • exists
  • grouping
  • move
  • syntax-update-1

Additionally, there a some cases which have exotic kinds of configuration (manifest.ttl). A few of those are also part of the list.

7 folders are covered, 22 folders are not covered yet.

Important: How to interpret the new tests

Don't get fooled, there are 2 different kinds of the tests:

  • First kind of tests actually test nothing, because i manually checked if the functionality is available. That is the case for instance for the MOVE command. Based on this wiki page. Nevertheless, i ran some tests, but they approved the wiki page information. I marked those tests as skipped on purpose, to signal lacks in the SPARQL support. If all these would be successful, one could get the impression, ARC2 has no lacks in SPARQL support.
  • The other kind of tests check the functionality. They setup the test environment based on a given manifest.ttl, load data etc. and run a W3C-provided query. A test is approved, if the expected result (given by the W3C) matches the actual result (returned from ARC2).

Every skipped test provides meaningful information. For instance Tests\sparql11\AggregatesTest::test_agg_avg_01 outputs:

Test skipped, because of rounding bug in AVG function. 
See https://github.com/semsol/arc2/issues/99

This way one can see the limitations of ARC2, sometimes also the reason. If one decides to extend/fix ARC2 SPARQL support, they can take the related test and change it.

Current output in PHPUnit

New PHPUnit output below. To see a full overview, you can look here.

.SS.SSSSSSS.SSS..S..SS.S....S.....SSSSSSSSSSSSSSSSSSSSSSS.SSSSS  63 / 171 ( 36%)
..SS...SSSSSSS..SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS......... 126 / 171 ( 73%)
.S.S.........................................                   171 / 171 (100%)


Time: 32 seconds, Memory: 12.00MB

There were 94 skipped tests:

1) Tests\sparql11\AggregatesTest::test_agg_avg_01

Test skipped, because of rounding bug in AVG function. 
See https://github.com/semsol/arc2/issues/99
/home/travis/build/k00ni/arc2/tests/sparql11/AggregatesTest.php:29
/home/travis/build/k00ni/arc2/vendor/phpunit/phpunit/phpunit:52


2) Tests\sparql11\AggregatesTest::test_agg_avg_02

This kind of query is currently not supported. ARC2_Store::query returns 0 for query: 
PREFIX : <http://www.example.org/>
SELECT ?s (AVG(?o) AS ?avg)
FROM <http://arc/data/> WHERE { ?s ?p ?o
}
GROUP BY ?s
HAVING (AVG(?o) <= 2.0)

/home/travis/build/k00ni/arc2/tests/sparql11/AggregatesTest.php:41
/home/travis/build/k00ni/arc2/vendor/phpunit/phpunit/phpunit:52

[...]

Further changes

Besides these new files in tests/sparql11, i changed the following files:

  • .travis.yml - added PHP 7.2 as further backend
  • composer.json - Changed some require-dev entries to fix failing tests in Travis.
  • phpunit.xml - Separated test suites, in case, one wants to run tests without compliance tests.
  • tests/ARC2_TestCase.php - Small refinements and further comments.
  • tests/bootstrap.php - Explicit force error_reporting(E_ALL)

Related issues

During this process, i opened the following issues:

its just for completeness, because we not really testing anything.
reason is, that based on ARC2 wiki, MOVE queries are not supported.
type hint problem (5.6 with symfony YAML) and count requires something which
implements Countable (php nightly)
reason: doctrine/instantiator#30

fix: lowering doctrine/instantiator version below 1.1
applied makeQueryA1Liner in tests to have a clean way to output
a query string.
there is bascially nothing to test, because ARC2 doesnt
support such queries at all.
a query is from now formated as given, expect spaces
…SyntaxUpdate1

DropTest, SyntaxUpdate1Test: changed meaning of many tests. instead of asserting
their result to 0, which means the given query failed, the test is
marked as skipped. that way its explicit and visible, that something
is not as it is supposed to be.

GroupingTest: provide more information for skipped tests.
@k00ni
Copy link
Collaborator Author

k00ni commented Jan 9, 2018

Ping @semsol :)

@semsol semsol merged commit 1bb23a0 into semsol:master Jan 9, 2018
@semsol
Copy link
Owner

semsol commented Jan 9, 2018

Cheers :-)

@johnss johnss mentioned this pull request Jan 22, 2018
@k00ni k00ni deleted the sparql11-compliance-tests branch May 6, 2018 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants