Data modelling with RDF(S)¶
What is RDF?¶
The Resource Description Framework, more commonly known as RDF, is a graph data model that formally describes the semantics, or meaning of information. It also represents metadata, that is, data about data.
RDF consists of triples. These triples are based on an Entity Attribute Value (EAV) model, in which the subject is the entity, the predicate is the attribute, and the object is the value. Each triple has a unique identifier known as the Uniform Resource Identifier, or URI. URI’s look like web page addresses. The parts of a triple, the subject, predicate, and object, represent links in a graph.
In the first triple, “Fred hasSpouse Wilma”, Fred is the subject, hasSpouse is
the predicate and Wilma is the object. Also, in the next triple, “Fred hasAge 25”,
Fred is the subject,
hasAge is the predicate and 25 is the object, or value.
Multiple triples link together to form an RDF model. The graph below describes the characters and relationships from the Flintstones television cartoon series. We can easily identify triples such as “WilmaFlintstone livesIn Bedrock” or “FredFlintstone livesIn Bedrock”. We now know that the Flintstones live in Bedroch, which is part of Cobblestone County in Prehistoric America.
The rest of the triples in the Flintstones graph describe the characters’ relations,
hasChild, as well as their occupational association (worksFor).
Fred Flintstone is married to Wilma and they have a child Pebbles. Fred works for the Rock Quarry company and Wilma’s mother is Pearl Slaghoople. Pebbles Flintstone is married to Bamm-Bamm Rubble who is the child of Barney and Betty Rubble. Thus, as you can see, many triples form an RDF model.
What is RDFS?¶
RDF Schema, more commonly known as RDFS, adds schema to the RDF. It defines a metamodel of concepts like Resource, Literal, Class, and Datatype and relationships such as subClassOf, subPropertyOf, domain, and range. RDFS provides a means for defining the classes, properties, and relationships in an RDF model and organizing these concepts and relationships into hierarchies.
RDFS specifies entailment rules or axioms for the concepts and relationships. These rules can be used to infer new triples, as we show in the following diagram.
Looking at this example, we see how new triples can be inferred by applying RDFS
rules to a small RDF/RDFS model. In this model, we use RDFS to define that
hasSpouse relationship is restricted to humans. And as you can see, human
is a subclass of mammal.
If we assert that Wilma is Fred’s spouse using the
then we can infer that Fred and Wilma are human because, in RDFS, the
relationship is defined to be between humans. Because we also know humans
are mammals, we can further infer that Fred and Wilma are mammals.
You can also watch the video from GraphDB Fundamentals Module 1: