W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2006

Re: Open world value tests

From: Eric Prud'hommeaux <eric@w3.org>
Date: Sat, 28 Oct 2006 10:50:31 +0200
To: "Seaborne, Andy" <andy.seaborne@hp.com>
Cc: 'RDF Data Access Working Group' <public-rdf-dawg@w3.org>
Message-ID: <20061028085031.GA4200@w3.org>
I have defined and implemented extensions that produce the same
results at AndyS's reported results. The manifest file I used
(attached) has 6 extensions that I have isolated:

  xsd:date — comparison support for xsd:date .
┏━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┓
┃A = B │xsd:date│xsd:date│op:date-equal(A, B)               │xsd:boolean┃
┃A != B│xsd:date│xsd:date│fn:not(op:date-equal(A, B))       │xsd:boolean┃
┃A < B │xsd:date│xsd:date│op:date-less-than(A, B)           │xsd:boolean┃
┃A > B │xsd:date│xsd:date│op:date-greater-than(A, B)        │xsd:boolean┃
┃A <= B│xsd:date│xsd:date│fn:not(op:date-greater-than(A, B))│xsd:boolean┃
┃A >= B│xsd:date│xsd:date│fn:not(op:date-less-than(A, B))   │xsd:boolean┃
┗━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┛
  "2006-08-23+00:00"^^<http://www.w3.org/2001/XMLSchema#date>" = "2006-08-23"^^xsd:date

  mfx:xsd-date-eq-xsd-dateTime — allow dates to be compared with
  dateTimes (not in XPath http://www.w3.org/TR/xpath20/#mapping).
┏━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┓
┃A = B │xsd:date    │xsd:dateTime│my:dateDatetime-equal(A, B)               │xsd:boolean┃
┃A = B │xsd:dateTime│xsd:date    │my:datetimeDate-equal(A, B)               │xsd:boolean┃
┃A != B│xsd:date    │xsd:dateTime│fn:not(my:dateDatetime-equal(A, B))       │xsd:boolean┃
┃A != B│xsd:dateTime│xsd:date    │fn:not(my:datetimeDate-equal(A, B))       │xsd:boolean┃
┃A < B │xsd:date    │xsd:dateTime│my:dateDatetime-less-than(A, B)           │xsd:boolean┃
┃A < B │xsd:dateTime│xsd:date    │my:datetimeDate-less-than(A, B)           │xsd:boolean┃
┃A > B │xsd:date    │xsd:dateTime│my:dateDatetime-greater-than(A, B)        │xsd:boolean┃
┃A > B │xsd:dateTime│xsd:date    │my:datetimeDate-greater-than(A, B)        │xsd:boolean┃
┃A <= B│xsd:date    │xsd:dateTime│fn:not(my:dateDatetime-greater-than(A, B))│xsd:boolean┃
┃A <= B│xsd:dateTime│xsd:date    │fn:not(my:datetimeDate-greater-than(A, B))│xsd:boolean┃
┃A >= B│xsd:date    │xsd:dateTime│fn:not(my:dateDatetime-less-than(A, B))   │xsd:boolean┃
┃A >= B│xsd:dateTime│xsd:date    │fn:not(my:datetimeDate-less-than(A, B))   │xsd:boolean┃
┗━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┛
  "2006-08-23T09:00:00+01:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> != "2006-08-23"^^xsd:date

  mfx:StringSimpleLiteralCmp — allow simple literal and xsd:strings to
  be compared
┏━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┓
┃A = B │xsd:string    │simple literal│op:numeric-equal(fn:compare(STR(A), B), 0)        │xsd:boolean┃
┃A = B │simple literal│xsd:string    │op:numeric-equal(fn:compare(A, STR(B)), 0)        │xsd:boolean┃
┃A != B│xsd:string    │simple literal│fn:not(op:numeric-equal(fn:compare(STR(A), B), 0))│xsd:boolean┃
┃A != B│simple literal│xsd:string    │fn:not(op:numeric-equal(fn:compare(A, STR(B)), 0))│xsd:boolean┃
┃A < B │xsd:string    │simple literal│op:numeric-equal(fn:compare(STR(A), B), -1)       │xsd:boolean┃
┃A < B │simple literal│xsd:string    │op:numeric-equal(fn:compare(A, STR(B)), -1)       │xsd:boolean┃
┃A > B │xsd:string    │simple literal│op:numeric-equal(fn:compare(STR(A), B), 1)        │xsd:boolean┃
┃A > B │simple literal│xsd:string    │op:numeric-equal(fn:compare(A, STR(B)), 1)        │xsd:boolean┃
┃A <= B│xsd:string    │simple literal│fn:not(op:numeric-equal(fn:compare(STR(A), B, 1)) │xsd:boolean┃
┃A <= B│simple literal│xsd:string    │fn:not(op:numeric-equal(fn:compare(A, STR(B), 1)) │xsd:boolean┃
┃A >= B│xsd:string    │simple literal│fn:not(op:numeric-equal(fn:compare(STR(A), B, -1))│xsd:boolean┃
┃A >= B│simple literal│xsd:string    │fn:not(op:numeric-equal(fn:compare(A, STR(B), -1))│xsd:boolean┃
┗━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┛
  "xyz"^^<http://www.w3.org/2001/XMLSchema#string> = "xyz"

  mfx:LeGeIncludeEq — '<=' and '>=' operators on unknown types are
  true if they are the same term
┏━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┓
┃A <= B│typed literal│typed literal│logical-or(RDFterm-equal(A, B), type error)│xsd:boolean┃
┃A >= B│typed literal│typed literal│logical-or(RDFterm-equal(A, B), type error)│xsd:boolean┃
┗━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┛
  x"^^<http://example/unknown> <= "x"^^<http://example/unknown>"

  mfx:LangCaseInsensitivity — plain literals with different
  capitolizations of the language can be tested for equivalence.
  (Assuming here that this does not include lessThan/greaterThan.)
┏━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┓
┃A < B│plain literal│plain literal│logical-and(                                             │           ┃
┃     │             │             │  logical-or(                                            │           ┃
┃     │             │             │    op:numeric-equal(fn:compare(my:toupper(LANG(A)),     │           ┃
┃     │             │             │                                my:toupper(LANG(B))), 0),│           ┃
┃     │             │             │    type error),                                         │           ┃
┃     │             │             │  op:numeric-equal(fn:compare(STR(A), STR(B)), -1)       │xsd:boolean┃
┗━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┛
  "xyz"@EN = "xyz"@en

  mfx:KnownTypesDefault2Neq — fill out operator mapping with all
  combinations of argument types so that all known but non-compatible
  types are considered != .
┏━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━┯━━━━━━━━━━━┓
┃A = B │xsd:boolean│numeric      │false│xsd:boolean┃
┃A = B │xsd:boolean│xsd:dateTime │false│xsd:boolean┃
┃A = B │xsd:boolean│plain literal│false│xsd:boolean┃
┃A = B │xsd:boolean│URI          │false│xsd:boolean┃
┃A = B │xsd:boolean│blank node   │false│xsd:boolean┃
┃A = B │numeric    │xsd:boolean  │false│xsd:boolean┃
...
┃A != B│xsd:boolean│numeric      │false│xsd:boolean┃
┃A != B│xsd:boolean│xsd:dateTime │false│xsd:boolean┃
...
┗━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━┷━━━━━━━━━━━┛
  "xyz"^^<http://www.w3.org/2001/XMLSchema#integer> != "xyz"@EN

The attached algae-results.txt show what I got when I disabled all the
extensions. The '+'s in the error results of open-eq-12 concearn me as
that means that my implementation running in unextended mode got
answered that did not show up in the extended version. Someone needs
to look closely at this; me if noone else gets to it sooner. I won't
be back until just before the meeting on Tuesday.

Note that open-eq-12 only used mfx:KnownTypesDefault2Neq, which I
would have expected to be safe so long as one did not later add more
ways to discover equivalence between known types (as does, for
instance, mfx:xsd-date-eq-xsd-dateTime).


On Tue, Oct 17, 2006 at 12:42:21PM +0200, Eric Prud'hommeaux wrote:
> 
> On Thu, Aug 24, 2006 at 09:45:33PM +0100, Seaborne, Andy wrote:
> > 
> > """
> > ACTION AndyS:
> > Write some tests for value testing (unknown types and extensibility) to add 
> > to
> > 2006/JulSep0086
> > """
> > 
> > http://lists.w3.org/Archives/Public/public-rdf-dawg/2006JulSep/0086
> > http://lists.w3.org/Archives/Public/public-rdf-dawg/2006AprJun/0104
> > 
> > I added some tests and sorted out the existing ones.  They are split into 
> > sets
> > so can be considered separately if desired.
> > 
> > http://www.w3.org/2001/sw/DataAccess/tests/data/OpenWorld/
> > 
> > Tests open-eq-01 to open-eq-06 are the original ones from 2006AprJun/0104,
> > renamed.
> 
> I agree with these tests. These require no extension to SPARQL.
>   | "open-eq-01"|"passed"| "001"^^xsd:integer !≘ "01"^^xsd:integer
>   | "open-eq-02"|"passed"| "a"^^t:type1 ≘ "a"^^t:type1
>   | "open-eq-03"|"passed"| 1 = 1, "01"^^xsd:integer = 1
>   | "open-eq-04"|"passed"| 2 != 1, "02"^^xsd:integer != 1
>   | "open-eq-05"|"passed"| "a"^^t:type1 = "a"^^t:type1
>   | "open-eq-06"|"passed"| ∅ != "a"^^t:type1
> 
> I propose that the WG approve these tests.
> 
> > Tests open-eq-07 to open-eq-10 work by taking a list of all possible term
> > forms, forming the cross product and seeing which are value-equal and
> > value-not-equal.  This is done for data which contains the same compared
> > values and different by comparable values.  These tests are exhaustive and
> > include literals with lang tags - because lang tags are not case sensitive 
> > (nor is there a canonical form according to RFC3066) it seemed reasonable 
> > to be able equate "xyz"@EN with "xyz"@en. In effect, each lang tag defines 
> > a separate value space - can't compare or test for equality across them, 
> > but you can with the same language.
> > 
> > "abc"@en = "abc"@EN
> > "xyz"@en > "abc"@en
> > "xyz"@en > "abc"@EN
> 
> There is no current language for case-insensitive language tags in
> SPARQL presently. My implementation failed these both because of
> case-sensitive language matching, and because they employed extra
> operators not currently in SPARQL.



> open-eq-07:
>   A = B   xsd:string     simple literal  op:numeric-equal(fn:compare(STR(A), STR(B)), 0)
> 
> Mostly they lean on the (apparent) fact that in ARQ, all known types
> can be compared to other known types, as one can do with
> sameTerm. I'll persue this in a later mail.
> 
> 
> > Tests open-eq-11.rq and open-eq-12.rq look for pairs of terms that can be
> > compared and pairs that can't.
> > 
> > Tests open-cmp-01, open-cmp-02 look for pairs that can be compared, not 
> > just test for equality.  open-cmp-02 uses "<=" which can be implemented so 
> > that things can pass <= even if they are not comparable because they are 
> > unknown but pass equality test by sameTerm => sameValue.
> > 
> > These test work on pairs of literals in the data - if open-eq-07/10 are too
> > coarse grained, they could be broken up into this style.  I just wrote the
> > paired data later, but left the exhaustive approach of the earlier tests.
> > 
> > (sameTerm seems a slightly better name than sameNode because "RDF term" is
> > phrase used in SPARQL and because predicates aren't nodes in the 
> > graph-sense).
> > 
> > No sameTerm tests yet because they can't be written yet in pure SPARQL.
> > 
> > [[
> > aside: I realised that testing for plain literals vs xsd:string can be done
> > even if datatype("plain string") is xsd:string by a different route:
> > 
> >    sameTerm(?x, str(?x))
> > 
> > and this is the defining characteristic of plain literals.
> > ]]
> > 
> > Tests date-1 to date-4 are some tests involving an extension type (xsd:date)
> > including sorting.
> 
> Of these, I only passed date-4, which does not require any extension
> to the SPARQL language as specified.
> date-1:
>   passed: "2006-08-23"^^xsd:date       = "2006-08-23"^^xsd:date
>   failed: "2006-08-23Z"^^xsd:date      = "2006-08-23"^^xsd:date
>   failed: "2006-08-23+00:00"^^xsd:date = "2006-08-23"^^xsd:date
> 
> date-2:
>   failed: "2006-08-23"^^xsd:date       != "2006-08-23"^^xsd:date
>   failed: "2006-08-23Z"^^xsd:date      != "2006-08-23"^^xsd:date
>   failed: "2006-08-23+00:00"^^xsd:date != "2006-08-23"^^xsd:date
> 
> date-3:
>   failed: "2006-08-23"^^xsd:date       > "2006-08-22"^^xsd:date
>   failed: "2006-08-23Z"^^xsd:date      > "2006-08-22"^^xsd:date
>   failed: "2006-08-23+00:00"^^xsd:date > "2006-08-22"^^xsd:date
> 
> date-4:
>   passed: datatype("2006-08-23"^^xsd:date ) = xsd:date
>   passed: datatype("2006-08-24Z"^^xsd:date) = xsd:date
>   passed: datatype("2000-01-01"^^xsd:date ) = xsd:date
> 
> These tests bring up the issue of how we test extensions. I think all
> we can do is test the bare language, writing tests that appear to
> label an extended implementation as "failed".
> -- 
> -eric
> 
> home-office: +1.617.395.1213 (usually 900-2300 CET)
> 	    +33.1.45.35.62.14
> cell:       +33.6.73.84.87.26
> 
> (eric@w3.org)
> Feel free to forward this message to any list for any purpose other than
> email address distribution.

-- 
-eric

home-office: +1.617.395.1213 (usually 900-2300 CET)
	    +33.1.45.35.62.14
cell:       +33.6.73.84.87.26

(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.


Received on Saturday, 28 October 2006 08:49:46 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:27 GMT