Difference between revisions of "Graphs-In-Turtle"

From RDF Working Group Wiki
Jump to: navigation, search
m
m (Assumptions:)
Line 5: Line 5:
 
Alignment with SPARQL is more important then alignment with N3.
 
Alignment with SPARQL is more important then alignment with N3.
  
The community does not have a lot of investment TriG syntax.
+
The community does not have a lot of investment in TriG syntax.
  
 
The community has some investment in N-Quads.
 
The community has some investment in N-Quads.
 
  
 
== Advantages of N-Quads: ==
 
== Advantages of N-Quads: ==

Revision as of 00:06, 28 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 in 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 .


Trig Strawman

Denote graphs with {}s:


# N-Graphs
<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> .
  <http://example.org/alice/foaf.rdf#me> <http://xmlns.com/foaf/0.1/name>                  "Alice"  .
}
<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> .
  <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
<> { #base matches graph name

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

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

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

# Not inside {}s so in the default graph:
<http://example.org/alice/foaf.rdf> a foaf:Document .
<http://example.org/bob/foaf.rdf> a foaf:Document .