📜 ⬆️ ⬇️

RDF for dummies

With this article, I start my own cycle of posts "for beginners" where the most widely understood terms are web 3.0. Subsequently, all articles will be posted to the wiki and will be “published” by me in the form of a PDF book.

Let's start with the funds, and today we have the foundation of the basics - RDF.
The Resource Description Framework is a model developed by the W3C consortium for describing resources, especially resource metadata.

RDF is a knowledge description language. This is not exactly XML. that is, not XML at all, just syntax is similar. RDF contains triples of data "object - predicate - subject". Well, an example of "The pillar has a height of 15m." Here is the simplest example; RDF .:
')
@prefix : <http: www.example.org> .
:john a :Person .
:john :hasMother :helga .
:john :hasFather :henrich .
:richard :hasSister :jane .


Let's call it Document # 1, it will come in handy later.

Is it clear yet? Not?
@prefix - ( , , -)
:john a :Person - ()
()
:john :hasMother : helga - .
.
:john :hasFather : henrich -

:richard :has Sister : j ane - father has a sister - Jane

Such a little family here. By the way, this is a short form of RDF recording, it is called N3 (Notation three). As I understand it, created under the influence of LISP and after they realized that XML is too big. It is good in some cases and very clear, we will use it as an example. But there is also an XML-like version, it is used in the web - RSS 0.9, (if I'm not mistaken) an example of this. Here is an XML-like example about the same John:
 <rdf: rdf xmlns: rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns: ns = "http://www.example.org/#">
 <ns: person rdf: about = "http://www.example.org/#john">
  <ns: hasmother rdf: resource = "http://www.example.org/#helga" />
  <ns: hasfather>
   <rdf: description rdf: about = "http://www.example.org/#henrich">
    <ns: hassister rdf: resource = "http://www.example.org/#jane">
    </ ns: hassister>
   </ rdf: description>
  </ ns: hasfather>
 </ ns: person>
 </ rdf: rdf> 

Unclear and poorly readable. I agree, but it is more convenient for a computer, since any programming language can easily parse an XML file and retrieve data.

The biggest difference between RDF and XML is that RDF is intended for distributed data. For example, my SIO . I reprinted the posts of John Breslin, so my SIOC is associated with its SIOC and the computer can easily follow the links (links are the main pillar of the Semantic Web, remember?) To put together a single discussion. Robots can collect different RDF, written by different people and find out things that were not clearly in any of the documents, do you feel the approach of the Matrix?
Example:
From Document # 1, we know that John has a father, Heinrich.
Here is the second document (Document # 2):

@prefix : <http:> :</http:> henrich <http:> :hasBrother :han
{ ?a :hasFather ?b . ?b :hasBrother ?c . } => { ?a :hasUncle ?c }
</http:>
<http:> :hasBrother :han
{ ?a :hasFather ?b . ?b :hasBrother ?c . } => { ?a :hasUncle ?c }
</http:>


It says here that Henrikhaest is brother Han. And the bottom line is the rule that says that if the father of a certain person A has a brother, then he is the uncle for person A. Combine Document # 1 and # 2, follow the rule, and voila: the computer knows that John has uncle Han!

Richard Siganiak voiced the main uses for RDF.
  1. You need to combine data from various sources, without resorting to the creation of specialized programs.
  2. You need to give others access to your data.
  3. You need to decentralize your data so that all of them are not “owned” by someone alone.
  4. You need to do something special with large amounts of data — enter, retrieve, view, analyze, search, etc. You want to create (or use a ready-made) universal tool that would allow you to do all this based on the RDF data model (which has the advantage that it is not tied to closed data storage and presentation technologies - unlike the DBMS dialects).

In general, this is something like a distributed union of a hierarchical and network database .

There are two types of names in RDF: literals (just text) and URIs . The URI may be a link to a web site (http://futuri.us) but not necessarily. In general, a URI is a link to an object (not necessarily it has its own idea), for example, urn: isbn: 5-3180-0093-2. This is a link to the book " Samba. System Administrator's Guide. For Professionals " by Ed Brooksbank. This book is unlikely to have a page, but it is clear that this URI indicates the book, and it is clear which one. URI is unique. Therefore, it allows you to bind RDF to some single object.

@prefix : <www.example.org/>
<futuri.us/> a :Website
<futuri.us/> dc:title ""
<futuri.us/> dc:contributor " "
<futuri.us/> dc:creator " "
<futuri.us/> dc:language ru-RU
<futuri.us/> dc:rights by-nc-sa
A brief description of my site using the Dublin Core namespace. But we'll talk about it later.

Eventually:

Useful:


All this from my blog.

Source: https://habr.com/ru/post/17946/


All Articles