Re: SPARQL syntax proposals

Eric Prud'hommeaux wrote:
 > The promised the regexp syntax:
 >
 > regexp(?x , "regexp"[, "flags"])

Just refining the details - briefly Googling, I found that "regexp" and "regex" 
are both common.  Even in MySQL discussions, people write "regex" when it's 
"REGEXP" so my conclusion is that choosing one is going to cause confusion (and 
support).  There are more hits for "regex sql" than "regexp sql"

In PostgreSQL, it's ~ anyway.

In Java, the standard 1.4 package is regex but the Jakarta package is "regexp".

Much as I dislike it, I think that having these as synonyms makes sense and 
makes implementers lives easier in the long run (they get less questions).

An alternative would be "match" c.f. Functions and Operators where it's "matches".

RDQL has =~, like Perl, but it is a FAQ as to how to do string matching so it 
isn't obvious to people.

 Andy

Eric Prud'hommeaux wrote:
> On Tuesday, the DAWG f2f took up syntax issues. We came up with a
> syntax that was acceptable to all or most (don't know how SteveH would
> phrase his feelings) of the attendees. These are expressed as examples
> below. The principal change was in expressing the graph pattern in
> "turtle+variables". Afterwords, Andy, Steve and I worked out how to
> express regexps and not get an inscrutable grammar like perls.
> 
> We also changed AND to FILTER to express some constraints that we had
> put on the effect of the value constraints section (namely that this
> section ONLY restrict results, never add results or even, I think,
> produce variables bindings).
> 
> These examples give a pretty good idea of our ideas:
> 
> simple query:
> SELECT * WHERE { ?p ?s ?o }
> 
> 
> which prefix:
> PREFIX foaf: <http://example/foaf#>
> SELECT ?me ?you
>  WHERE { ?me foaf:knows ?you. ?you foaf:knows <fred> }
> 
> could also have either of these forms:
>  WHERE { ?me rdf:type foaf:Person.} # trailing thingy in lexer
>  WHERE { ?me rdf:type foaf:Person .} # parses same as above
> 
> 
> ex with GRAPH and '.' in (but not ending) a QName.
>  WHERE { GRAPH ?g  { ?g dc:source myPartOfUriSpace:foo.rdf } }
> this is like turtle but n3 does not currenlty allow '.'s in names.
> 
> 
> use the same syntax in the CONSTRUCT graph:
> PREFIX foo: <http://www.w3.org/>
> CONSTRUCT { ?s foo:bop ?o2 .
>             ?o2 foo:bing ?o }
> WHERE { ?s foo:bar ?o .
>         ?o foo:baz ?o2 }
> 
> use turtle list syntax;
>  WHERE { :bob :brothers (:joe :sam) }
> 
> use turtle ';' operator:
>  WHERE { ?doc dc:title ?txt; dc:author ?who }
> (good for symmetry even if not often used in queries.)
> 
> use turtle ',' operator:
>  WHERE { ?who foaf:knows ?f1, ?f2 }.
> (?who knows ?f1 and ?who knows ?f2.)
> 
> turtle has the 'a' operator (shortcut for rdf:type)
>  WHERE { ?who a foaf:Person } # yes
> but not other operators like '='.
> 
> bNodes are interpreted as unique, unreferencable variables.
> SELECT ?who WHERE { ?who :brother [ in Army ], :mother [ in Navy] . }
> (same as            ?who :brother ?b. 
>                     ?b in Army.
>                     ?who :mother ?m.
>                     ?m in Navy              )
> 
> as promised, AND is now FILTER:
> SELECT ?who
>  WHERE { ?who :age ?n. FILTER ?n + 1 < 5 }
> 
> 
> The promised the regexp syntax:
> 
> regexp(?x , "regexp"[, "flags"])

Received on Tuesday, 8 March 2005 13:39:50 UTC