Triples
The fundamental data structure in RDF: Subject-Predicate-Object statements representing a fact, like 'John works_at TechCorp'.
Core Concepts
A triple is the atomic data structure in RDF, consisting of three parts: Subject, Predicate (relationship), and Object.
Structure
Subject → Predicate → Object
John → worksAt → TechCorp
Turtle Syntax
@prefix ex: <http://example.com/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
ex:john foaf:name "John Smith" .
ex:john ex:worksAt ex:techcorp .
ex:john foaf:age 30 .
ex:techcorp ex:industry "Technology" .
Each line is a triple. Multiple triples can share subjects (using ; ) or predicates (using , ).
vs Property Graphs
RDF Triples: Cannot have properties on relationships directly
# Relationship properties require reification
:employment a :WorksAtRelationship ;
:subject :john ;
:predicate :worksAt ;
:object :techcorp ;
:since 2020 .
Property Graphs: Properties on relationships native
(john)-[:WORKS_AT {since: 2020}]->(techcorp)
See Also
Examples
- •Subject: John, Predicate: worksAt, Object: TechCorp
- •<http://example.com/john> <http://example.com/worksAt> <http://example.com/techcorp>