Graphs-In-Turtle

From RDF Working Group Wiki
Revision as of 22:39, 23 September 2011 by Gcarothe3 (Talk | contribs)

Jump to: navigation, search

Graphs in Turtle Strawman

Assumptions:

Alignment with SPARQL is mort important then allignment with N3.

The comunity does not have a lot of investment TriG syntax.

The comunity has some investment in N-Quads.


Advantages of N-Quads:

No state outside current line.


Questions?

Is it possible for something N-Quad like to be a Subset of Graphs in Turtle?

Strawman

SPARQL uses the GRAPH keyword when talking about graphs, SPARQL keywords tend to match @* keywords in Turtle. @graph seems to follow. While context coming last in N-Quads makes some sense, providing notation of the graph at the end of a statement doesn't work very well with multi line statements.

# N-Graphs
@graph <http://example.org/alice/foaf.rdf> . <http://example.org/alice/foaf.rdf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
@graph <http://example.org/alice/foaf.rdf> . <http://example.org/alice/foaf.rdf#me> <http://xmlns.com/foaf/0.1/name>                  "Alice"  .
@graph <http://example.org/bob/foaf.rdf> . <http://example.org/bob/foaf.rdf#me>   <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
@graph <http://example.org/bob/foaf.rdf> . <http://example.org/bob/foaf.rdf#me>   <http://xmlns.com/foaf/0.1/name>                  "Bob" .

# Graphs in Turtle

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix void: <http://rdfs.org/ns/void#>

<> a void:Dataset .

@base <http://example.org/alice/foaf.rdf> . #setup a new base
@graph <> . #base matches graph name

<#me> a foaf:Person ;
     foaf:name "Alice";
     .

@base <http://example.org/bob/foaf.rdf> .
@graph <> . 

<#me> a foaf:Person ;
      foaf:name "Bob";
      .
@graph . #go back to the default graph
<http://example.org/alice/foaf.rdf> a foaf:Document .
<http://example.org/bob/foaf.rdf> a foaf:Document .