Fwd: optionals, provenance and transformation into RDF queries

I forward this message to the list because it is quite relevant to the  
ongoing work about RDF Query interoperability

I invite people here to comment/discuss on it perhaps splitting up the  
replies into different threads

cheers

Alberto

Begin forwarded message:

> From: Alberto Reggiori <alberto@asemantics.com>
> Date: Sun Apr 20, 2003  11:13:41  PM Europe/Rome
> To: danbri@w3.org, Andy Seaborne <Andy_Seaborne@hplb.hpl.hp.com>
> Cc: Alberto Reggiori <alberto@asemantics.com>, Libby Miller  
> <libby.miller@bristol.ac.uk>, staff@asemantics.com
> Subject: optionals, provenance and transformation into RDF queries
>
>
> hi there!
>
> I have been reading through your IRC/chump [1] emailed to www-archive  
> [2] - my strong feeling is that sooner or later we will need to add  
> support at the SquishQL/RDQL syntax level for optional matching  
> triples (or bindings). In addition, while developing some RDF apps I  
> also found out the importance and usefulness to SELECT triples using  
> one more dimension/component (s,p,o + c) aka kind of  
> provenance/source/context/scope/quads information (whatever that is  
> called or means in RDF :)
>
> I would like to discuss the possibility to come up with a common  
> (JDBC/ODBC/DBI friendly :) syntax how to express such extensions in  
> our SQL-ish query languages - I am also wondering about the use of  
> some kind of CONSTRUCT clause ala SeRQL [3] to "transform" or format  
> the actual bound vars. IMO this could also help the integration of RDF  
> query languages with XML semi-structured ones [4] and developers would  
> love that :)
>
> here, I will just quickly summarize some aspects related to this  
> extensions (perhaps need to put them on the RDFQR Wiki page [5] later)
>
> optional matches
> ------------------------
> - as soon as you start writing real-world RDF applications you need  
> those, otherwise you have to go back to API and "build the query by  
> hand"; because RDF data nature is generally irregular, incomplete,  
> perhaps expressed using different data granularity, deeply nested
> - DQL supports it and perhaps others (???)
> - RDF is flexible and tolerant and an RDF query language must be so too
> - implementation problems?
> - possible syntax
>
> ---> Andy's idea about "locating data" and "extracting data" - is it  
> about splitting up the RDQL/SquishQL statement SELECT and WHERE parts  
> in two?
> ---> use some special char on SELECTed vars to say they are "optional"  
> (question mark at the end is not a good choice for JDBC/ODBC  
> compatibility)
> ---> use square brackets (we are thinking about supporting this syntax  
> perhaps flagging the SELECTed vars as optional too)
>         WHERE
>                         (?x,<some:mandatoryProp>,?y),
>                         [ (?x, <some:optionalProp>, ?z)]
>
> ---> use full-blown SQL style syntax (really too verbose to me)
>        WHERE
>                        (  (?x,<some:mandatoryProp>,?y)  ) OR
>                        (  (?x,<some:mandatoryProp>,?y),
>                            (?x, <some:optionalProp>, ?z) )
>
> provenance information
> --------------------------------
> - RDF sources once parsed and stored into an RDF database are flatten  
> down and at the query time you very often need to filter them based on  
>  the "context" where they have been asserted - i.e. source URL or some  
> other RDF resource which could be further described. This information  
> can not be generally represented with triples, perhaps with  
> reification, but I do not understand it much :-)
> - N3 formulae are something similar
> - Quads [6] use that extra component for that IMU
> - possible syntax
>
> ---> Allow one more component on the triple-pattern ala Quads (we  
> already support such a syntax in our implementation of RDQL)
>
>        WHERE
>                         (?x, <some:prop>,?y, ?context),
>                         (?context, <rdf:type>,  
> <some:MeaningfulContext>)
>
> ---> Allow N3 style curly brackets (ugly) - or is there any better  
> syntax?
>
>          WHERE ( { (?x, <some:prop>,?y, ?context) } <rdf:type>,  
> <some:MeaningfulContext> )
>
> ---> Use some other special CONTEXT clause
>
> results constructors
> --------------------------
> - most applications need to use RDF just to "grep" the Web to some  
> kind of XML-ish syntax - RDBMS DBI/JDBC/ODBC are also fine. But having  
> an XML result allows to play a lot more with it (e.g. XSLT) and  
> pipe/chain things better; and developers would feel more familiar.
> - Andy RDF Query result set could also benefit from this
> - soon people will start to nest SquisQL/RDQL statements i.e. RDF --->  
> RDF transformation
> - XQuery supports it already
> - SeRQL uses it
> - possible syntax
>
> ---> ala XQuery using CONSTRUCT or TRANFORM clause
>
>         SELECT
>                ?x,?y
>         WHERE
>                (?res, <some:px>, ?x),
>                (?res, <some:py>, ?y)
>         CONSTRUCT
>                <rs:ResultSet>
>                   <rs:resultVariable>x</rs:resultVariable>
>                   <rs:resultVariable>y</rs:resultVariable>
>                   <rs:size  
> rdf:datatype='http://www.w3.org/2000/10/XMLSchema#integer'>1</rs:size>
>                  <rs:solution>
>                        <rs:ResultSolution>
>                            <rs:binding rdf:parseType='Resource'>
>                                <rs:variable>x</rs:variable>
>                                <rs:value  
> rdf:datatype='{$x/rdf:datatype}'>$x</rs:value>
>                            </rs:binding>
>                            <rs:binding rdf:parseType='Resource'>
>                                <rs:variable>y</rs:variable>
>                               <rs:value rdf:resource='$y'/>
>                           </rs:binding>
>                     </rs:ResultSolution>
>                 </rs:solution>
>              <rs:ResultSet>
>         USING
>                some FOR <http://somevoc.org/mine/>,
>                rs FOR <http://jena.hpl.hp.com/2003/03/result-set#>
>
> ---> ala SeRQL (see spec)
> ---> any better syntax?
>
> IMO this TRANSFORM thingie would be extremely useful, especially to  
> dynamically generate XML Web content out of an RDF database - it would  
> also open the doors to all the others XML tools already deployed.
>
> Just give some thoughts to all this - in the meantime I will set up  
> some use cases for this onto the RDF Query and Rules survey page [7]  
> to see if some developer will pick it up
>
> cheers
>
> Alberto
>
> [1]  
> http://rdfig.xmlhack.com/2003/04/20/2003-04-20.html#1050846336.312674
> [2] http://lists.w3.org/Archives/Public/www-archive/2003Apr/0052.html
> [3] http://lists.w3.org/Archives/Public/www-rdf-rules/2003Apr/0013.html
> [4] http://www.w3.org/TR/xquery/
> [5] http://esw.w3.org/topic/RDFQueryTestcasesRequirements
> [6] http://robustai.net/sailor/grammar/Quads.html
> [7]  
> http://rdfstore.sourceforge.net/2002/06/24/rdf-query/query-use- 
> cases.html

Received on Wednesday, 23 April 2003 11:41:42 UTC