Difference between revisions of "Graphs-In-Turtle"

From RDF Working Group Wiki
Jump to: navigation, search
(Strawman)
(Strawman)
Line 35: Line 35:
 
@prefix void: <http://rdfs.org/ns/void#> .
 
@prefix void: <http://rdfs.org/ns/void#> .
  
<> a void:Dataset .
+
<> a void:Dataset . # no graph statement yet, must be default graph
  
 
@base <http://example.org/alice/foaf.rdf> . #setup a new base
 
@base <http://example.org/alice/foaf.rdf> . #setup a new base

Revision as of 22:53, 23 September 2011

Graphs in Turtle Strawman

Assumptions:

Alignment with SPARQL is more important then alignment with N3.

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

The community 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 . # no graph statement yet, must be default graph

@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 .