W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2009

ProjectExpressions without concat

From: Axel Polleres <axel.polleres@deri.org>
Date: Mon, 15 Jun 2009 23:27:05 +0100
Message-ID: <4A36CAB9.1030609@deri.org>
To: Axel Polleres <axel.polleres@deri.org>
CC: "Seaborne, Andy" <andy.seaborne@hp.com>, Steve Harris <steve.harris@garlik.com>, Kjetil Kjernsmo <Kjetil.Kjernsmo@computas.com>, "public-rdf-dawg@w3.org" <public-rdf-dawg@w3.org>
Kjetil was concerned since fn:concat wasn't supported yet in standard 
SPARQL. An alternative would be to resort to something else, like e.g. 
STR():

e.g.

    CONSTRUCT { ?x ex:mailstring STR(?mbox) . }
    WHERE { ?x foaf:mbox ?mbox }

or (using subqueries)

    CONSTRUCT { ?x ex:mailstring ?m . }
    WHERE {
      { SELECT ?x, STR(?mbox) AS ?m
        ?x foaf:mbox ?mbox
      }

but I am quite unsure... is there anyone supporting this?

I suggest, in the absence of better options

i) to mention (if implemented) Option 1) first, or alternatively Option 
4) with reference to XSPARQL
and then

iI) I would still be inclined to also to mention Option 3) as an 
alternative, with a backward-reference to the section on subqueries. Not 
sure who implements both  XPath F&O (i.e. fn:concat) and subqueries, but 
you could leave a TODO there.

Anyways, a reference to XPath F&O [XPath-Functions] should IMO be added 
in the references.


[XPath-Functions] XQuery 1.0 and XPath 2.0 Functions and Operators, A. 
Malhotra, J. Melton, N. Walsh (Editors), W3C Recommendation, World Wide 
Web Consortium, 23 January 2007, 
http://www.w3.org/TR/2007/REC-xpath-functions-20070123/. Latest version 
available at http://www.w3.org/TR/xpath-functions/.



Axel Polleres wrote:
> Seaborne, Andy wrote:
>>
>>> -----Original Message-----
>>> From: public-rdf-dawg-request@w3.org [mailto:public-rdf-dawg-
>>> request@w3.org] On Behalf Of Steve Harris
>>> Sent: 15 June 2009 12:07
>>> To: Kjetil Kjernsmo
>>> Cc: public-rdf-dawg@w3.org
>>> Subject: Re: Requesting input for the Features and Rational document
>>>
>>> On 10 Jun 2009, at 09:42, Kjetil Kjernsmo wrote:
>>>
>>>> On Thursday 04 June 2009 08:46:29 Lee Feigenbaum wrote:
>>>>>> * ProjectExpression needs a better description and motivation.
>>>>>> We feel that the mention of XSLT is not very relevant, as
>>>>>> assigning a
>>>>>> name automatically, like some engines do now, is sufficient for
>>>>>> XSLT.
>>>>>> It should also be motivated by showing why it is required by other
>>>>>> features.
>>>>> I took a stab at this at
>>>>> http://www.w3.org/2009/sparql/wiki/Feature:ProjectExpressions
>>>> As discussed on the teleconf yesterday, it needs better examples
>>>> too. It
>>>> doesn't sound like the examples are actually executeable as it is
>>>> now, and
>>>> they should be. Also, it is also a good thing if they do not rely on
>>>> other
>>>> features that we do not yet have, such as concat().
>>>>
>>>> It is good to have both SELECT and CONSTRUCT examples.
>>>>
>>>> Can anyone have a stab at this?
>>>   CONSTRUCT { ?x foaf:name (concat(?fn, " ", ?sn)) . }
>>
>> Can we adopt F&O naming here?  It's "fn:concat"
>> Tricky - () looks awfully like a list to a parser.  Especially if the 
>> function is named by URI.
> 
> Indeed....
> 
> 
> Option 1)
>> Suggestion: off the top of my head: ?(expr)
>>
>>    CONSTRUCT { ?x foaf:name $(fn:concat(?fn, " ", ?sn)) . }
>>
>> Not necessary beautiful but it will work.
> 
> Option 2) another options here is to leave it without extra syntax, but 
> add a TODO mentioning that
> 
>     fn:concat(?fn, " ", ?sn)
> 
>    is problematic for parsers due to the similarity with list notation.
>    I.e.
> 
> TODO: Note that expressions such as fn:concat(?fn, " ", ?sn) are 
> potentially problematic for parsers due to their similariy with the 
> shortcut notation for 
> [http://www.w3.org/TR/rdf-sparql-query/#collections RDF Collections]
> 
> Option 3) is actually the subselect, i.e. the complete corrected example:
> 
>  CONSTRUCT { ?x foaf:name ?concat . }
>  WHERE {
>    { SELECT ?x fn:concat(?fn, " ", ?sn) AS ?concat
>      WHERE { ?x foaf:firstName ?fn ; foaf:family_name ?sn . }
>    }
>  }
> 
> 
> Are Options 1) or 2) implemented anywhere?
> 
> 
> Option 4)
> If you look for something which is implemented, we have an
> implementation for a slightly different version of Option 1) in XSPARQL 
> [1]:
> 
>    CONSTRUCT { ?x foaf:name {fn:concat(?fn, " ", ?sn)} . }
>    WHERE { ?x foaf:firstName ?fn ; foaf:family_name ?sn . }
> 
>  I had, BTW, Option 2 implemented in some preliminary,
> experimental parser for dlvhex-sparql [2], but basically at the
> cost of sacrificing the collection shortcut notation.
> 
> best,
> Axel
> 
> 1. http://xsparql.deri.org/
> For the example see: 
> http://xsparql.deri.org/spec/xsparql-language-specification.html#fig:rdf2rdf_xsparql 
> 
> Implementation:
> http://sourceforge.net/project/showfiles.php?group_id=243296
> 
> 
> 2. Axel Polleres, François Scharffe, and Roman Schindlauer. SPARQL++ for 
> mapping between RDF vocabularies. In OTM 2007, Part I : Proceedings of 
> the 6th International Conference on Ontologies, DataBases, and 
> Applications of Semantics (ODBASE 2007), volume 4803 of Lecture Notes in 
> Computer Science, pages 878-896, Vilamoura, Algarve, Portugal, November 
> 2007. Springer.
> 
>> This is a place where explicit assignment would be useful syntax.
>>
>>>   WHERE { ?x foaf:firstName ?fn ; foaf:family_name ?sn . }
>>>
>>> As a projection it would be something like:
>>>
>>>   CONSTRUCT { ?x foaf:name ?concat . }
>>>   WHERE {
>>>     { SELECT ?x, concat(?fn, " ", ?sn) AS ?concat
>>
>> SELECT ?x fn:concat....
>>
>> (no comma - comma in SELECT lists are in the time permitting query 
>> language syntax.
>>
>>>     WHERE { ?x foaf:firstName ?fn ; foaf:family_name ?sn . } }
>>>   }
>>>
>>> - Steve
>>
>>     Andy
>>
> 
> 


-- 
Dr. Axel Polleres
Digital Enterprise Research Institute, National University of Ireland, 
Galway
email: axel.polleres@deri.org  url: http://www.polleres.net/
Received on Monday, 15 June 2009 22:27:50 GMT

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