- From: Seaborne, Andy <andy.seaborne@hp.com>
- Date: Sat, 05 Mar 2005 15:09:54 +0000
- To: Eric Prud'hommeaux <eric@w3.org>
- Cc: public-rdf-dawg@w3.org
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) }
Presumably lists can be nested. ( 1 ( 2 3 ) 4 )
and the rd;type rdf:List is not needed.
- - - - - - - -
What about this one:
SELECT * WHERE { ( ?x ) }
because a list is just some triples. It's the same query as:
SELECT *
WHERE
{ _:b rdf:first ?x .
_:b rdf:rest rdf:nil .
}
"find all the elements at the end of a list".
Looking around:
cwm 1.0.0, parsing the file:
--------------
( 1 ) .
--------------
generates an empty model without warning or error.
Jena parses that input as the triples:
-----------------
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
_:b1 rdf:first 1 .
_:b1 rdf:rest () .
-----------------
Turtle allows lists only as blank nodes in other triples, not free standing
triples.
The difference in grammar terms is small - just whether a list can be seen
in place of a triple or not.
triples ::= subject predicate-object-list
|
collection
or
triples ::= subject predicate-object-list
Andy
>
> 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 Saturday, 5 March 2005 15:11:05 UTC