Glossary / RDF and ontologies
RDF and ontologies, for newcomers
What you need to read the graphs OntoCast produces. Start with the two-minute walkthrough, or jump to a term below.
Two minutes
Read a Turtle file
RDF stores every fact as a triple: a subject, a predicate and an object. Turtle is the usual way to write triples as text. Here are a few real ones, from a climate paper OntoCast read with the W3C SOSA vocabulary.
@prefix doc: <https://ontocast.growgraph.dev/doc/e3e0d78bebc6/> .
@prefix sosa: <http://www.w3.org/ns/sosa/> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@prefix unit: <http://qudt.org/vocab/unit/> .
@prefix qqval: <https://growgraph.dev/ontologies/qqval#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
doc:lyttonTemperatureObservation a sosa:Observation ;
rdfs:label "Lytton temperature record on 29 June 2021" ;
sosa:hasFeatureOfInterest doc:lytton ;
sosa:hasResult doc:lyttonTemperatureObservation.hasResult .
doc:lyttonTemperatureObservation.hasResult a qqval:QualifiedQuantityValue ;
qudt:numericValue "49.6"^^xsd:decimal ;
qudt:unit unit:DEG_C .- lines 1–7Prefixes. Each one is a short alias for the start of a web address (an IRI), so the rest of the file stays readable. sosa: is the W3C vocabulary for observations; doc: is where OntoCast names the things it found in this one document. More →
- line 9A subject, the thing the facts are about, and its class: "a" is short for rdf:type. This thing is an Observation, a kind defined by SOSA. More →
- line 10The semicolon means "same subject, next fact". rdfs:label gives it a name for people; the text in quotes is a literal, a plain value. More →
- line 11A triple linking two things: the observation is about Lytton. Both ends have IRIs, so other facts can point at them. More →
- line 12The result is a thing of its own (the dot inside its name is part of the name), because a value with a unit needs two facts. The full stop ends the statement. More →
- lines 14–16The result: the number 49.6, read as a decimal (xsd:decimal is its datatype), in degrees Celsius from the QUDT units vocabulary. More →
That is most of what you need. The terms below go one step further each, in the order you are likely to meet them.
Terms
From triples to shapes
The examples use the prefixes of the walkthrough, plus ex: for made-up names and the usual rdf:, owl:, prov: and sh: for RDF, OWL, PROV-O and SHACL.
- Knowledge graph#
Information stored as things and the connections between them, rather than as rows or documents. In RDF, each connection is written down as a triple.
- Triple#
One fact in three parts: a subject (the thing the fact is about), a predicate (the relation) and an object (another thing, or a plain value). "Lytton temperature record — has feature of interest — Lytton" is one triple.
Turtledoc:lyttonTemperatureObservation sosa:hasFeatureOfInterest doc:lytton .In the console: The graph view draws each triple between two things as two circles and an arrow; click a circle to list its triples. See it in the sample →
- IRI#
The unique, web-style name of anything in a graph, such as http://www.w3.org/ns/sosa/Observation. Two things with the same IRI are the same thing, wherever they appear. Labels are for people; the IRI is what software compares.
In the console: Click an entity in the graph: its IRI sits under its label, with a button to copy it.
- Prefix and namespace#
A namespace is the shared start of a set of IRIs, such as http://www.w3.org/ns/sosa/ for every SOSA term. A prefix is a short alias for it, so sosa:Observation stands for http://www.w3.org/ns/sosa/Observation. A prefix changes how a file reads, not what it means.
Turtle@prefix sosa: <http://www.w3.org/ns/sosa/> . # from here on, sosa:Observation means <http://www.w3.org/ns/sosa/Observation>In the console: The Turtle and SPARQL editors complete prefixes and the terms behind them: press Ctrl/⌘ Space.
- Class and instance#
A class is a kind of thing, defined in an ontology: sosa:Observation. An instance is one particular thing of that kind: the Lytton temperature record. The predicate rdf:type links the two; Turtle writes it as "a".
Turtledoc:lyttonTemperatureObservation a sosa:Observation .In the console: In the graph view, colour shows an entity’s class. An ontology’s Classes tab lists its classes as a tree. See it in the sample →
- Property#
A predicate defined in an ontology. An object property links two things (sosa:hasFeatureOfInterest); a datatype property links a thing to a value (qudt:numericValue). An ontology can also say which class a property starts from and which it points to: its domain and its range.
Turtleex:locatedIn a owl:ObjectProperty ; rdfs:domain ex:Station ; # it starts from a Station rdfs:range ex:Place . # and points to a PlaceIn the console: An ontology’s Classes tab lists each class’s properties.
- Literal and datatype#
A plain value rather than a thing: a number, a date, a piece of text. Its datatype says how to read it (xsd:decimal, xsd:date); text can also carry a language tag, such as "Lytton"@en. A literal has no IRI, so nothing can point at it.
Turtledoc:lyttonTemperatureObservation.hasResult qudt:numericValue "49.6"^^xsd:decimal . doc:lyttonTemperatureObservation rdfs:label "Lytton temperature record on 29 June 2021" .In the console: The graph view does not draw values as circles: click an entity to see its own. See it in the sample →
- Ontology / vocabulary#
The agreed terms for a domain: its classes, its properties and the rules that relate them. You can write your own or reuse a published one, such as W3C PROV-O for provenance or SOSA for observations. Reusing one means your data uses the same names as other people’s.
In the console: The Ontologies page: upload your own, add a published one from the gallery, or let OntoCast draft one from a document. See it in the sample →
- RDF, RDFS and OWL#
Three W3C standards, each built on the one before. RDF is the data model: everything is triples. RDFS adds classes, subclasses, labels, domains and ranges. OWL adds richer rules, such as two classes sharing no members, or a property taking at most one value.
- Turtle and the other formats#
Turtle is the most readable way to write RDF as text: prefixes first, then triples, with a semicolon to repeat the subject and a comma to repeat the predicate. The same graph can also be written as N-Triples (one full triple per line), JSON-LD (JSON), or, with named graphs, TriG and N-Quads. The format changes the text, not the facts.
Turtledoc:lyttonTemperatureObservation a sosa:Observation ; # ; same subject, next fact rdfs:label "Lytton temperature record on 29 June 2021" . # . ends the statementIn the console: Every download offers Turtle, N-Triples, N-Quads, TriG and JSON-LD. An ontology’s Turtle tab shows it highlighted, and lets you edit it.
- Blank node#
A thing with no IRI of its own, written [ … ] or _:b1 in Turtle. It means something only inside its file, so nothing elsewhere can point at it. Ontologies use blank nodes for nested rules; OntoCast gives the things it extracts IRIs instead, so they can be linked and queried.
Turtleex:Station rdfs:subClassOf [ a owl:Restriction ; owl:onProperty ex:locatedIn ; owl:minCardinality 1 ] . # every Station is located somewhere- Named graph#
A set of triples with an IRI of its own, so facts from different sources can be kept apart, traced and queried separately. TriG and N-Quads are the formats that keep them.
TriG<https://example.org/graphs/run-1> { ex:stationA ex:locatedIn ex:Lytton . }In the console: OntoCast keeps each extraction, and each ontology version, in a graph of its own. The Graph page draws several together, coloured by source.
- Provenance#
Where a fact came from: which document, which passage, which run. W3C PROV-O is the standard vocabulary for it; prov:wasDerivedFrom links a fact to its source.
In the console: Click an entity in the graph: under "Where it came from", open the passage, with the value highlighted. See it in the sample →
- Facts about facts: RDF 1.2 and reification#
To say where one triple came from, you need a way to talk about the triple itself. RDF 1.2 can name a triple directly. The older RDF 1.1 way, reification, describes the triple as a thing of type rdf:Statement. Both say the same; RDF 1.1 reification reads in every RDF tool, RDF 1.2 only in recent ones.
Turtle# RDF 1.2 << doc:lyttonTemperatureObservation sosa:hasFeatureOfInterest doc:lytton >> prov:wasDerivedFrom doc:1a05fc92bbdc . # RDF 1.1 reification: the same, readable everywhere [] a rdf:Statement ; rdf:subject doc:lyttonTemperatureObservation ; rdf:predicate sosa:hasFeatureOfInterest ; rdf:object doc:lytton ; prov:wasDerivedFrom doc:1a05fc92bbdc .In the console: The Provenance choice in every download: RDF 1.1 (classic) or RDF 1.2 (native).
- SPARQL#
The W3C query language for RDF. You write a pattern of triples with variables (?observation) where the unknowns go, and it returns every match.
SPARQLPREFIX sosa: <http://www.w3.org/ns/sosa/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?observation ?label WHERE { GRAPH ?g { # in any graph of the project ?observation a sosa:Observation ; rdfs:label ?label . } } LIMIT 10In the console: The Query page runs one read-only query on a project, and completes the terms of your ontologies as you type. See it in the sample →
- SHACL shape#
A W3C standard for rules data must follow: which properties a thing of some class must have, which datatype a value takes. A shape states the rule; a validator lists every thing that breaks it.
Turtleex:ObservationShape a sh:NodeShape ; sh:targetClass sosa:Observation ; sh:property [ sh:path sosa:hasResult ; sh:minCount 1 # every Observation has a result ] .In the console: Upload shapes to a project: extractions are checked against them, and the job page lists what the checks found.
- Ontology version#
Ontologies change. Each version gets an IRI of its own (owl:versionIRI) and names the one it replaces (owl:priorVersion), so data can say which version it used, and an old version stays readable.
In the console: An ontology’s page lists its versions. Edit the Turtle, review what changes, and save it as the next version. See it in the sample →
See these on real data: open the sample run in the OntoCast console.
Property graphs, GraFlo and agents have their own glossary.

