- From: Dave Beckett <dave.beckett@bristol.ac.uk>
- Date: Tue, 28 Sep 2004 18:06:35 +0100
- Cc: public-rdf-dawg@w3.org
- Message-Id: <20040928180635.384cd68b@hoth.ilrt.bris.ac.uk>
On Tue, 28 Sep 2004 15:13:45 +0100, Dave Beckett <dave.beckett@bristol.ac.uk> wrote: > I attach two possible result formats that vary in one design choice - > 1) variable names are element names and hence the XML is schemaless I've expanded this example to include an example query based on one in the current rq23 draft, extended to add optionals so I can show missing items and something with datatypes, XML literals and empty literals. So given the following query (example.rq23 attached) PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX ex: <http://ns.example.org/#> SELECT ?hpage ?name ?mbox ?age ?blurb FROM <data.n3> WHERE ( ?x foaf:name ?name ) ( ?x foaf:mbox ?mbox ) ( ?x foaf:homepage ?hpage ) [ ( ?x ex:ageInYears ?age ) ] [ ( ?x ex:blurb ?blurb ) ] operating on the data (data.n3 attached) @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://ns.example.org/#> . _:a foaf:name "Alice" . _:a foaf:homepage <http://work.example.org/alice/> . _:a foaf:mbox "" . _:a ex:blurb "<p xmlns=\"http://www.w3.org/1999/xhtml\">My name is <b>alice</b></p>"^^rdf:XMLLiteral . _:b foaf:name "Bob"@en . _:b foaf:mbox <mailto:bob@work> . _:a foaf:homepage <http://work.example.org/bob/> . _:b ex:age 30 . gives Query Result: ?hpage = <http://work.example.org/alice/>, ?name = "Alice", ?mbox = "", ?blurb = "<p xmlns = \"http://www.w3.org/1999/xhtml\">My name is <b>alice</b></p>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> ?hpage = <http://work.example.org/bob/>, ?name = "Bob"@en, ?mbox = <mailto:bob@work>, ?age = 10 and XML version of that (result1.xml attached) <results xmlns="http://www.w3.org/sw/2001/DataAccess/result1#"> <result> <hpage href="http://work.example.org/alice/"/> <name>Alice</name> <mbox/> <blurb datatype="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"><p xmlns="http://www.w3.org/1999/xhtml">My name is <b>alice</b></p></blurb> </result> <result> <hpage href="http://work.example.org/bob/"/> <name xml:lang="en">Bob</name> <mbox href="mailto:bob@work"/> <age datatype="http://www.w3.org/2001/XMLSchema#integer">30</age> </result> </results> The XML content I expect to be rare compared to the RDF datatyped literals and rarer than RDF plain literals. However, it does look ugly as above. The other choice I see is to just include it inline - since there is no XML schema being used here: <blurb><p xmlns="http://www.w3.org/1999/xhtml">My name is <b>alice</b></p></blurb> This is probably a good choice if XSLT and related tech are targets since (XSLT at least) cannot easily transform an escaped XML literal to a DOM tree. It could be that it would need to be way to distinguish a plain literal from non-mixed content with some flag, but I think that's not the "XML Way". So I'm leaning to making this last change too. Dave
Attachments
- text/plain attachment: example.rq23
- text/plain attachment: data.n3
- text/xml attachment: result1.xml
Received on Tuesday, 28 September 2004 17:09:30 UTC