- From: Alberto Reggiori <alberto@asemantics.com>
- Date: Tue, 26 Oct 2004 16:28:40 +0200
- To: Kendall Grant Clark <kendall@monkeyfist.com>
- Cc: RDF Data Access Working Group <public-rdf-dawg@w3.org>
some more thoughts about SOURCE and how to inline more than one graph into the same URI source... On Oct 19, 2004, at 4:49 PM, Kendall Clark wrote: > > On Tue, Oct 19, 2004 at 03:33:30PM +0100, Seaborne, Andy wrote: > >> A Named Container (of triples) is part of the overall collection and >> has a >> a name. The collection is all the triplesand also the way to view >> all the >> triples. > > Uh... Hmm, still lost. Must just be me. I'll keep at it. > >> I don't think anyone has proposed a syntax for a single file >> containing >> multiple graphs. > > TriX doesn't do this? From the DTD: > > <!ELEMENT TriX (graph*)> > > Did you mean some other kind of syntax? we got some other syntax http://lists.w3.org/Archives/Public/www-rdf-interest/2004Feb/0209.html in other words, our software given a foo3.rdf data file like <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foo="http://foo.com/foo/" xmlns:rdfstore="http://rdfstore.sourceforge.net/contexts/" > <rdf:Description rdf:ID="graph1" foo:title="foo1" /> <rdf:Description rdf:ID="graph2" foo:title="foo2" /> <rdf:Description rdf:ID="foo" foo:foo1="title" rdfstore:context="#graph1" /> <rdf:Description rdf:ID="foo" foo:foo1="title" rdfstore:context="#graph2" /> </rdf:RDF> it can run SPARQL queries like PREFIX baz: <http://foo.com/foo/> SELECT DISTINCT ?s ?p ?o FROM <foo3.rdf> WHERE SOURCE ?src (?s ?p ?o) (?src baz:title ?kk) and get results ?s = file:/foo3.rdf#foo ?p = http://foo.com/foo/foo1 ?o = title Matched: 1 rows the SELECT DISTINCT is needed to remove duplicates as a quads model is being used - a rule to address the 'distinct' (bug) issue for the example about could be (i.e. to remove duplicates and show an RDF-merged view over triples): - make results implicitly DISTINCT if not ?src if being mentioned into the SELECT part - if not ?src info requested into SELECT just show the RDF-merge view of the quads (merge) In fact the modified query PREFIX baz: <http://foo.com/foo/> SELECT ?src ?s ?p ?o FROM <foo3.rdf> WHERE SOURCE ?src (?s ?p ?o) (?src baz:title ?kk) gives ?p = http://foo.com/foo/foo1 ?src = file:/foo3.rdf#graph1 ?o = title ?s = file:/foo3.rdf#foo ?p = http://foo.com/foo/foo1 ?src = file:/foo3.rdf#graph2 ?o = title ?s = file:/foo3.rdf#foo Matched: 2 rows and the more general query PREFIX baz: <http://foo.com/foo/> SELECT ?src ?s ?p ?o FROM <foo3.rdf> WHERE SOURCE ?src (?s ?p ?o) gives (note the empty/NULL ?src for the first two matches) ?src = ?s = file:/foo3.rdf#graph1 ?o = foo1 ?p = http://foo.com/foo/title ?src = ?s = file:/foo3.rdf#graph2 ?o = foo2 ?p = http://foo.com/foo/title ?src = file:/foo3.rdf#graph1 ?s = file:/foo3.rdf#foo ?o = title ?p = http://foo.com/foo/foo1 ?src = file:/foo3.rdf#graph2 ?s = file:/foo3.rdf#foo ?o = title ?p = http://foo.com/foo/foo1 Matched: 4 rows (the above queries can be directly tried at http://demo2.asemantics.com/rdfstore/rdql/ ) We also have a more generic rdfstore:contextnodeID which allows graphs to be bNodes as well - as far as I can see there might be an issue with bNodes, which might be accidentally shared between different graphs if expressed into the same physical document http://lists.w3.org/Archives/Public/www-archive/2004Oct/0010.html but it could be easily be avoided if they are being checked while parsing/processing them - and be sure that the parser/engine croaks accordingly. Another (non-standard) N-Triples alike syntax for expressing Comma Separated Values (CSV) multiple graphs into a single source URI is the so called Quads http://robustai.net/sailor/grammar/Quads.html which we use extensively when returning N-Triples if quads are available instead. I think CWM/N3 has formulae for similar tricks - but I can not speak about those. TriX too. Anyway, this discussion might be not directly relevant to the CNC proposal and discussion - but it is good to bear in mind perhaps while designing the SOURCE details. cheers Alberto - Alberto Reggiori, Senior Partner, R&D @Semantics S.R.L. alberto@asemantics.com www.asemantics.com Milan Office, milano@asemantics.com, +39 0332 667092
Received on Tuesday, 26 October 2004 14:28:43 UTC