[ValueTesting] Open world value tests

ACTION AndyS: draft some open-world tests
   http://www.w3.org/2006/05/09-dawg-minutes.html#action07

Tests in:
http://www.w3.org/2001/sw/DataAccess/tests/data/OpenWorld/

Notes:

A/ test 1 is a strict test of graph matching - no D-entailment

B/ test 6 tests open world and !=  Nothing is matched because nothing is
positively known to have a different value from the unknown type.  Because the
value space of the datatype is unknown, and value spaces of different
datatypes can overlap, all that is positively known for an unknown type is
when it is RDf-term-equal with the same datatype and same lexical form.  It is
never != to anything unknown.

C/ No tests of datatypes

See also the ValueTesting/roman test (not approved):

"XXI"^^roman:Numeral is value-equal to 21


==== data (same for all tests)

@prefix t: <http://example/t#> .
@prefix :  <http://example/ns#> .
@prefix xsd:    <http://www.w3.org/2001/XMLSchema#> .

:x1 :p "a"^^t:type1 .
:x2 :p "b"^^t:type1 .

:y1 :p "a"^^t:type2 .
:y2 :p "b"^^t:type2 .

:z1 :p 1 .
:z2 :p "01"^^xsd:integer .
:z3 :p 2 .
:z4 :p "02"^^xsd:integer .

==== test 1

# SPARQL is defined over simple entailment so
# only syntactic matches show.
# (Some systems may match because they do
# value-based matching in the graph (D-entailment))

# Does not strictly match "1"^xsd:integer

PREFIX  :       <http://example/ns#>
PREFIX  t:      <http://example/t#>
PREFIX  xsd:    <http://www.w3.org/2001/XMLSchema#>

SELECT *
{ ?x :p "001"^^xsd:integer }

-----
| x |
=====

==== test 2

# Test matching in a graph pattern
# Unknown type

PREFIX  :       <http://example/ns#>
PREFIX  t:      <http://example/t#>

SELECT *
{ ?x :p "a"^^t:type1 }

--------------------------
| x                      |
==========================
| <http://example/ns#x1> |
--------------------------

==== test 3

# SPARQL FILTER test by value.
# A processor knows about XSD integer
# so 1 and 01 pass the filter

PREFIX  :       <http://example/ns#>
PREFIX  t:      <http://example/t#>
PREFIX  rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  xsd:    <http://www.w3.org/2001/XMLSchema#>

SELECT *
{ ?x :p ?v
     FILTER ( ?v = 1 )
}

-------------------------------
| x                      | v  |
===============================
| <http://example/ns#z2> | 01 |
| <http://example/ns#z1> | 1  |
-------------------------------

==== test 4

# SPARQL FILTER test by value.
# A processor knows about XSD integer
# so 1 and 01 are excluded by the filter

PREFIX  :       <http://example/ns#>
PREFIX  t:      <http://example/t#>
PREFIX  rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  xsd:    <http://www.w3.org/2001/XMLSchema#>

SELECT *
{ ?x :p ?v
     FILTER ( ?v != 1 )
}

-------------------------------
| x                      | v  |
===============================
| <http://example/ns#z4> | 02 |
| <http://example/ns#z3> | 2  |
-------------------------------

==== test 5

# SPARQL FILTER test by value.
# Only one valus is known to be "a"^^t:type1
# (others maybe but the processor does not positively know this)

PREFIX  :       <http://example/ns#>
PREFIX  t:      <http://example/t#>

SELECT *
{ ?x :p ?v
     FILTER ( ?v = "a"^^t:type1 )
}
----------------------------------------------------------
| x                      | v                             |
==========================================================
| <http://example/ns#x1> | "a"^^<http://example/t#type1> |
----------------------------------------------------------

==== test 6

# SPARQL FILTER test by value for known types.
# Nothing is known to be not the same value as  "a"^^t:type1
#  "b"^^t:type1 might be a different lexical form for the same value
#  "a"^^t:type2 might have overlapping value spaces for this lexicial form.

PREFIX  :       <http://example/ns#>
PREFIX  t:      <http://example/t#>

SELECT *
{ ?x :p ?v
     FILTER ( ?v != "a"^^t:type1 )
}
---------
| x | v |
=========
---------

Received on Monday, 5 June 2006 09:23:08 UTC