Understanding RDF
When studying towards my undergraduate in IT I got interested in graph databases. In the graph data model, things are related to other things. These things and relationships can be further detailed by adding properties. In the background, the data of the graph data is abstracted away from the user and stored in appropriated data structures. Graph databases depend on graph theory stemming from mathematics, where the things are called vertices or nodes and connected with edges. The mathematical concepts from graph theory can be used for working with graphs in computer science, for instance for calculating shortest distances between nodes via edges.
I am learning RDF, Resource Description Framework, as a model for expressing statements. This will become useful as I aim studying knowlegde graphs than can use RDF. I am currently using these two resources:
Hogan, Aidan, Claudio Gutierrez, Michael Cochez, et al. Knowledge Graphs. Synthesis Lectures on Data, Semantics, and Knowledge. Springer International Publishing, 2022. https://doi.org/10.1007/978-3-031-01918-0.
Serles, Umutcan, and Dieter Fensel. An Introduction to Knowledge Graphs. Springer Nature Switzerland, 2024. https://doi.org/10.1007/978-3-031-45256-7.
RDF is used as a data model for an RDF graph database. RDF is the framework to organise and represent data as triples.
More formally, the things I mentioned earlier can be represented as triples consisting of subjects and objects connected by predicates. A subject is related to something else, an object, through a predicate (the relationship). The reasoning goes from subject via the predicate to the object: an RDF triple is directed.
One of the fundamental ideas of using RDF, is that a subject is represented by some unique identifier, related to something else represented by a unique identifier or a literal value (something with a datatype, such as strings, integers, dates), or a blank node (a node without an IRI or literal value).
The unique nodes are identified with an IRI (Internationalised Resource Identifier) which denotes a resource. This is key in RDF, which is based on working with resources. IRIs are similar to URIs. An IRI is essentially an internationalised form of a URI, allowing a much broader range of Unicode characters. Nodes and edges can have human readable labels.
Namespaces are used to avoid naming collisions and to provide a way of grouping and identifying terms. A prefix provides a short name for an IRI namespace, allowing long IRIs to be written in a more compact form. They make RDF more readable and manageable. In short In RDF, a namespace is a base IRI (like http://xmlns.com/foaf/0.1/), and a prefix is a short label (like foaf) used to make long IRIs short and easy to read.
Blank nodes are different from IRIs and literals. They are typically used for unnamed objects or describing complex constructs.
In synthesis (Serles)
- The subject of a triple can be an IRI or a blank node.
- The predicate of a triple must be an IRI.
- The object of a triple can be any of the three types of terms.
To wrap it all up as: A set of RDF triples comprise an RDF graph. Therefore, they are often presented as graphs. An RDF graph is a labelled, directed graph where nodes represent resources (IRI or literal) and blank nodes and edges represent predicates that connect two resources denoted by the subjects and objects of triples. (Serles)