W3C home > Mailing lists > Public > w3c-rdfcore-wg@w3.org > May 2001

Re: Test cases: format of input and output

From: Dan Connolly <connolly@w3.org>
Date: Fri, 25 May 2001 14:50:55 -0500
Message-ID: <3B0EB79F.621C560@w3.org>
To: Jan Grant <Jan.Grant@bristol.ac.uk>
CC: RDFCore Working Group <w3c-rdfcore-wg@w3.org>
Jan Grant wrote:
[...]
> A triple is represented as:
> 
> triple(S, P, O)

I have a certain investment in

	S P O.

The SWAP code (cwm, notation3) groks that format.
  http://www.w3.org/2000/10/swap/

> where S, P, O are any of:
> 
>         r("URI")

There's precedent for <URI> in RFC2396; e.g.

   In many cases, different URI strings may actually identify the
   identical resource. For example, the host names used in URL are
   actually case insensitive, and the URL <http://www.XEROX.com> is
   equivalent to <http://www.xerox.com>.

	-- http://www.ietf.org/rfc/rfc2396.txt

>         a("ID")

The swap/cwm/n3 stuff doesn't have a syntax for this;
we've considered ?ID; I'd be willing to add code
for that.

>         l("literal")

How about just "literal"? There are a host of
quoting and unicode issues; swap/cwmp/n3 follows
python currently; I wonder how different it is
from the string literal formats in Java; I'd
be willing to go with that.

3.10.5 String Literals
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#101083

(does ANSI-C have a unicode-capable string
literal syntax? how about perl?)

Of course, any decision on how to represent
literals in expected results is also a decision
to a whole pile of actual RDF issues: xml:lang, etc.

> (with the usual rules about placement of literals). r("URI") is a normal
> resource. l("literal") is a literal; a("ID") is an anonymous resource,
> which I think (with an eye on the future) that we ought to make
> explicitly different from r("#genid").

Yes, it must be different. TimBL provided me with some convincing
examples... I should find those and/or write them up...

> Something conforms wrt the test case iff it interprets the RDF as
> producing* a set of triples identical with the sample output, up to
> reordering and the global renaming of anonymous resources.

Right.

It's too bad there's no way to reduce that to some sort/diff
thingy, but there just isn't. It's inherently a graph-matching
thing.

We've been coding it up, but I'm not sure it's debugged.
(see the includes built-in stuff
http://dev.w3.org/cvsweb/2000/10/swap/test/includes/t6.n3?rev=1.2&content-type=text/x-cvsweb-markup
)

Would an implementation in prolog fit on the front side
of one page?

> Re: anon resources - two elements a(X) and a(Y) should be considered to
> represent "the same anon resource" iff X=Y (lexically)

that's if X=Y, not iff.

If X<>Y, they could still represent the same resource.
Yes, they're still distinct terms, which is the relevant
point for this excersise, but to persue the diversion,
consider:

	<mailto:connolly@w3.org> <http://example/vocab#ownedBy> ?x1.
	<mailto:connolly@w3.org> <http://example/vocab#ownedBy> ?x2.

If ownedBy is functional/unique/many-to-one, then ?x1 and
?x2 represent/denote the same resource/object/thing.


> - and the scope
> of the identity of an anon resource is the single test output
> attachment.
> 
> Clear as mud of course - any real objections?

No real objections.... I'm just exploring alternatives
that are grounded in running code...

And actually, now that I think about this a("ID") vs ?id
stuff... we could actually use KIF syntax:

	(exists (?x1)
	(mailto\:connolly\@w3\.org http\:\/\/example/vocab\#ownedBy ?x1)
	)

I wrote a KIF parser a while ago...
  http://www.w3.org/2000/10/n3/KIFSyntax.py
that code is pretty ugly; but it does
have the relevant reference:

[KIF] 
     Knowledge Interchange Format draft proposed American National
Standard (dpANS)
     NCITS.T2/98-004
     Last Modified: Thursday, 25-Jun-98 22:31:37 GMT 
http://logic.stanford.edu/kif/dpans.html

There are other dialects of KIF; my notes on ANSI KIF
and KIF v3 are in

  KIF as an RDF Schema (in progress Aug 2000) 
  http://www.w3.org/2000/07/hs78/KIF

There are a few nitty gritty issues... some versions
of KIF are case-insensitive, and they don't grok
Unicode. I gather from Pay Hayes that those are
being fixed, and we could anticipate those fixes.


And while I'm on that train of thought, I could
go with your triple(P, S, O) format, provided
the details are consistent with real prolog
implementations. Open source, easy-to-install-and-use
implementations, like swi-prolog.


Oh! I would, of course, be remiss if I did not propose and
XML-based format. Perhaps we could implement
the compare-expected-results thingy in XSLT...

I was just playing around with Brian McBride's
executable grammar;
  http://www.w3.org/2001/04rs22/spec.xsl
It produces:

<?xml version="1.0" encoding="utf-8"?>
<model>
<statement subjURI="http://example/someThing"
ns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" localname="type"
objURI="http://example/someClass"/>
</model>


I don't like the term 'model' any more. I think
what we've got here is abstract syntax. But
you get the idea.

(Brian: spec.xsl was missing a whole bunch
of <xsl:param/>s. Did it work without those
somehow for you? what XSLT processor did you use?)

-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
Received on Friday, 25 May 2001 15:51:03 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 3 September 2003 09:35:52 EDT