Nepomuk unlike other conventional projects, does not use a relational database to store its data. Instead it uses a RDF store. RDF stands for Resource Description Framework. It's the big framework that was written for describing abstract data on the web, and is the basis of the semantic web. While RDF, has many concepts, Nepomuk mainly utilizes a couple of them.
The simplest concept is that of a sentence. All the data in Nepomuk is stored in the form
<subject> <predicate> <object> <graph>. These 4 values combined are called a statement.
If we look at this in terms of an object oriented programming language, the
<subject> is an OOP Object, and the (predicate, object) pair can be looked as (key, value) pairs which define properties on that OOP Object.
Here are some examples of common statements -
<nepomuk:/res/some-uuid> rdf:type nao:Tag <nepomuk:/res/some-uuid> nao:lastModified 2012-03-16T18:41:09.006Z <nepomuk:/res/some-uuid> nao:prefLabel "Sample" <nepomuk:/res/some-other-uuid> rdf:type nfo:FileDataObject <nepomuk:/res/some-other-uuid> nao:hasTag <nepomuk:/res/some-uuid>
The subject, like in conventional english, is the main part of the sentence. It highlights what we are talking about. In the above example there are different subjects
nepomuk:/res/some-other-uuid. In each of these statements the subjects have certain properties and objects bound to them.
Predicates are often also called properties, and they used to connect the
<subject> with the
Each predicate is generally assigned a domain and range which governs the kind of <subject>s and <object>s it can be connected to.
Some examples of commonly used predicates are
The object is the slightly tricky part of statement. Objects can either be uris or literals. Uris refers to other subjects, and literals can be any of the conventional data types - integers, strings, datetime, boolean.
The graph contains some information about the triple - (<subject> <predicate> <object>) such as when it was created, and last modified. Unless you're working on the absolute core parts of Nepomuk, you won't ever have to interact with graphs, and they'll just work seamlessly in the background.
What they are - all about
An ontology is a formal description of the all the properties and types that resources can posses. It can be viewed as the database schema or like the architectural plans.
The Resource Description Framework and Resource Description Framework Schema are the two main schemas that were defined by the Semantic web. They are important because they provide the building blocks for writing all of the other ontologies.
The RDF and RDFS provide the foundation for an entire type system. It is slightly simpler than that of any programming language. It just provides single and multiple inheritance.
nfo:RemoteDataObject a rdfs:Class ; rdfs:comment "A file data object stored at a remote location. Don't confuse this class with a RemotePortAddress. This one applies to a particular resource, RemotePortAddress applies to an address, that can have various interpretations." ; rdfs:label "RemoteDataObject" ; rdfs:subClassOf nfo:FileDataObject .
We use the
rdfs:subClassOf property to indicate one class is a sub-type of another class.
Unlike other conventional system, RDFS also defines a property inheritance system. Each property can be defined a domain, range, cardinality and super-properties.
nfo:fileName a rdf:Property ; rdfs:subPropertyOf nao:prefLabel ; rdfs:comment "Name of the file, together with the extension" ; rdfs:domain nfo:FileDataObject ; rdfs:label "fileName" ; nrl:maxCardinality "1" ; rdfs:range xsd:string .
In the above example a property called
nfo:fileName has been declared. This property is a sub-property of the
nao:prefLabel ontology. It additionally defines a
nrl:maxCardinality as 1. This indicates that no resource should have more than 1 filename. And finally it defines a domain of
nfo:FileDataObject and range of
Nepomuk currently enforces these ontologies. So if you should always check the domain and range of properties before using them.