Resource Description Format¶
RDF¶
The RDF represents facts and information as a network of sorts. Each object has some connection with other object, and each connection is written down as a triple.
(subject, predicate, object) is the format of RDF. One example of this is (New_Delhi, capital_of, India)
Models can have attributes and relationships with other objects, but all these connections are modelled as triples.
SPARQL¶
SPARQL is a language used to query RDF template data. A SPARQL query looks like
SELECT ?name
WHERE {
?cid title "Introduction to Computer Science"
?sid course ?cid
?id takes ?sid
?id name ?name
}
It also supports aggregation, optional joins, subqueries, and more. It offers transitive closure on paths as well.
n-ary Relationships¶
While a single RDF triple represents a triple, we can use it to represent more. One option is to create a connector node with binary relationships to erlevant nodes.
(Barrack Obama, president_of, USA, from, 2008-2016) can be broken down into
(e1, represents, Barrack Obama) (e1, president_of, USA) (e1, president_between, 2008-2016)
Or it can be broken down as (Barrack Obama, president_of, USA, c1) (c1, president_between, 2008-2016)
Usage¶
RDF is frequently used to represent interconnected knowledge bases, like DBPedia, Yago, Freebase, or WikiData. Linked open data project aims to connect different knowledge graphs.