Predicate-lists (;) and object-lists (,)

Stop repeating yourself.

0/3 done

Theory

Two compactness shortcuts:

  • ; — same subject, new predicate.
  • , — same subject and predicate, new object.
:Alice a foaf:Person ;
       foaf:name "Alice" ;
       :knows :Bob, :Carol .

How much typing you save — same four facts, two ways:

# Verbose: 4 lines, :Alice repeated 4 times.
:Alice a foaf:Person .
:Alice foaf:name "Alice" .
:Alice :knows :Bob .
:Alice :knows :Carol .

Both forms parse to the exact same four triples — the shortcuts are pure syntactic sugar over the long form above.

Analogy

Turtle shorthand syntax is like filling out a contact form where you avoid rewriting the same person's name over and over.

Imagine a teacher writing notes about Alice on a classroom whiteboard.

Instead of writing:

Alice is a student.
Alice likes pizza.
Alice knows Bob.
Alice knows Carol.

the teacher naturally compresses it into:

Alice:
- is a student
- likes pizza
- knows Bob and Carol

That is exactly what Turtle's ; and , operators do.

The Whiteboard Analogy

Turtle SyntaxMeaningReal-World Analogy
;Same subject, new predicateContinue describing the same person
,Same subject and predicate, new objectList multiple items for the same relationship

Example

:Alice a foaf:Person ;
       foaf:name "Alice" ;
       :knows :Bob, :Carol .

This expands internally into:

:Alice a foaf:Person .
:Alice foaf:name "Alice" .
:Alice :knows :Bob .
:Alice :knows :Carol .

Mental Model

Think of Turtle syntax like natural note-taking.

The subject (:Alice) acts like the title of a sticky note.

Every semicolon means:

“Still talking about Alice, but now describing something else.”

Every comma means:

“Still talking about the same relationship, but adding more items.”

Why This Matters

The shortcuts:

  • reduce repetition
  • improve readability
  • make RDF authoring faster
  • keep graphs visually compact

But importantly:

The graph itself does NOT change.

The parser expands the shorthand into the exact same triples.

Key Insight

; and , are purely syntactic sugar.

They make Turtle easier for humans to write and read, while the RDF engine still sees the same underlying graph structure.

Reading in progress · 0 of 3 activities done