RDF Schema: Basic Ideas: 1.1 Classes and Properties
RDF Schema: Basic Ideas: 1.1 Classes and Properties
RDF is a universal language that lets users describe resources using their own vocabularies.
RDF does not make assumptions aboutanyparticularapplicationdomain,nordoesitdefinethe
semantics of any domain. Is it up to the user to do so in RDF Schema (RDFS).
RDF Schema
doesnotprovideactualapplicationspecificclassesandproperties.
Instead RDF Schema provides the framework to describe applicationspecific classes and
properties.
Classes in RDF Schema are much like classes inobjectorientedprogramminglanguages.This
allowsresourcestobedefinedasinstancesofclasses,andsubclassesofclasses.
Exampleofahierarchyofclasses
The property
rdfs:subPropertyOfis
an instance of
rdf:Property
that is used to state
that all resources related by one property are also related by another.
For example, is taught
by is a subproperty of involves. If a course c istaughtbyanacademicstaffmembera,thenc
also involves a. The converse is not necessarily true. For example, a may be the convener of
thecourse,oratutorwhomarksstudenthomeworkbutdoesnotteachc.
PisasubpropertyofQ,ifQ(x,y)istruewheneverP(x,y)istrue.
WeillustratethedifferentlayersinvolvedinRDFandRDFSusingasimpleexample:
ConsidertheRDFstatement
DiscreteMathematicsistaughtbyDavidBillington
The schema forthisstatementmay containclasses,suchaslecturers,academicstaffmembers,
staff members, and properties such as is taught by, involves, phone, employee id Next figure
illustrates the layersofRDFandRDFSchema(blocksareproperties,ellipsesabovethedashed
lineareclasses,andellipsesbelowthedashedlineareinstances)
Theschemaofthefigureisitself writteninaformallanguage,RDF Schema,thatcanexpressits
ingredients:subClass,Property,subProperty,Resource,andsoon.
Thecoreclassesare
rdfs:Resource
,theclassofallresources
rdfs:Class
,theclassofallclasses
rdfs:Literal
,theclassofallliterals(strings)
rdf:Property
,theclassofallproperties
rdf:Statement
,theclassofallreifiedstatements
Forexample,aclasslecturercanbedefinedasfollows:
<rdfs:Classrdf:ID="lecturer">
</rdfs:Class>
Thecorepropertiesfordefiningrelationshipsare
rdf:type
,whichrelatesaresourcetoitsclass.
rdfs:subClassOf
,whichrelatesaclasstooneofitssuperclasses.Allinstancesofaclass
areinstancesofitssuperclass.Aclassmaybeasubclassofmorethanoneclass.Asan
example,theclassfemaleProfessormaybeasubclassofbothfemaleandprofessor.
rdfs:subPropertyOf
,whichrelatesapropertytooneofitssuperproperties.
Example:
<rdfs:Classrdf:about="lecturer">
<rdfs:subClassOfrdf:resource="staffMember"/>
</rdfs:Class>
rdfs:subClassOf
and
rdfs:subPropertyOf
aretransitive,bydefinition.
rdfs:Class
isasubclassof
rdfs:Resource
(everyclassisaresource)
rdfs:Resource is an instance of
rdfs:Class (
rdfs:Resource is the class of all
resources,soitisaclass!).Forthesamereason,everyclassisaninstanceof
rdfs:Class
.
Thecorepropertiesforrestrictingpropertiesare
rdfs:domain
, which specifies the domain of a property P and states that any resource that
hasagivenpropertyisaninstanceofthedomainclasses.
rdfs:range
, which specifies the range ofapropertyPandstatesthatthevaluesofaproperty
areinstancesoftherangeclasses.
Here is an example stating thatwheneveranyresourcehas aphonenumber,it is(byinference)
astaffmemberandthatitsvalueisaliteral:
<rdf:Propertyrdf:ID="phone">
<rdfs:domainrdf:resource="#staffMember"/>
<rdfs:rangerdf:resource="&rdfLiteral"/>
</rdf:Property>
rdf:Bag
,theclassofbags,
rdf:Seq
,theclassofsequences,
rdf:Alt
,theclassofalternatives,
rdfs:Container
,asuperclassofallcontainerclasses,includingthethreeprecedingones.
<rdfs:Classrdf:ID="staffMember">
<rdfs:comment>Theclassofstaffmembers</rdfs:comment>
</rdfs:Class>
<rdfs:Classrdf:ID="course">
<rdfs:comment>Theclassofcourses</rdfs:comment>
</rdfs:Class>
<rdf:Propertyrdf:ID="involves">
<rdfs:comment>
Itrelatesonlycoursestolecturers.
</rdfs:comment>
<rdfs:domainrdf:resource="#course"/>
<rdfs:rangerdf:resource="#lecturer"/>
</rdf:Property>
<rdf:Propertyrdf:ID="isTaughtBy">
<rdfs:comment>
Inheritsitsdomain("course")andrange("lecturer")
fromitssuperproperty"involves"
</rdfs:comment>
<rdfs:subPropertyOfrdf:resource="#involves"/>
</rdf:Property>
<rdf:Propertyrdf:ID="phone">
<rdfs:comment>
Itisapropertyofstaffmembers
andtakesliteralsasvalues.
</rdfs:comment>
<rdfs:domainrdf:resource="#staffMember"/>
<rdfs:rangerdf:resource="&rdfLiteral"/>
</rdf:Property>
</rdf:RDF>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22rdfsyntaxns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdfschema#">
<rdfs:Classrdf:ID="motorVehicle"/>
<rdfs:Classrdf:ID="van">
<rdfs:subClassOfrdf:resource="#motorVehicle"/>
</rdfs:Class>
<rdfs:Classrdf:ID="truck">
<rdfs:subClassOfrdf:resource="#motorVehicle"/>
</rdfs:Class>
<rdfs:Classrdf:ID="passengerVehicle">
<rdfs:subClassOfrdf:resource="#motorVehicle"/>
</rdfs:Class>
<rdfs:Classrdf:ID="miniVan">
<rdfs:subClassOfrdf:resource="#passengerVehicle"/>
<rdfs:subClassOfrdf:resource="#van"/>
</rdfs:Class>
</rdf:RDF>
3.1 RDF
<?xmlversion="1.0"encoding="UTF16"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22rdfsyntaxns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdfschema#">
<rdfs:Classrdf:ID="Statement"
rdfs:comment="Theclassoftriplesconsistingofa
predicate,asubjectandanobject
(thatis,areifiedstatement)"/>
<rdfs:Classrdf:ID="Property"
rdfs:comment="Theclassofproperties"/>
<rdfs:Classrdf:ID="Bag"
rdfs:comment="Theclassofunorderedcollections"/>
<rdfs:Classrdf:ID="Seq"
rdfs:comment="Theclassoforderedcollections"/>
<rdfs:Classrdf:ID="Alt"
rdfs:comment="Theclassofcollectionsofalternatives"/>
<rdf:Propertyrdf:ID="predicate"
rdfs:comment="Identifiesthepropertyusedinastatement
whenrepresentingthestatement
inreifiedform">
<rdfs:domainrdf:resource="#Statement"/>
<rdfs:rangerdf:resource="#Property"/>
</rdf:Property>
<rdf:Propertyrdf:ID="subject"
rdfs:comment="Identifiestheresourcethatastatementis
describingwhenrepresentingthestatement
inreifiedform">
<rdfs:domainrdf:resource="#Statement"/>
</rdf:Property>
<rdf:Propertyrdf:ID="object"
rdfs:comment="Identifiestheobjectofastatement
whenrepresentingthestatement
inreifiedform"/>
<rdf:Propertyrdf:ID="type"
rdfs:comment="Identifiestheclassofaresource.
Theresourceisaninstance
ofthatclass."/>
</rdf:RDF>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22rdfsyntaxns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdfschema#">
<rdfs:Classrdf:ID="Resource"
rdfs:comment="Themostgeneralclass"/>
<rdfs:Classrdf:ID="comment"
rdfs:comment="Usethisfordescriptions">
<rdfs:domainrdf:resource="#Resource"/>
<rdfs:rangerdf:resource="#Literal"/>
</rdfs:Class>
<rdfs:Classrdf:ID="Class"
rdfs:comment="Theconceptofclasses.
Allclassesareresources.">
<rdfs:subClassOfrdf:resource="#Resource"/>
</rdfs:Class>
<rdf:Propertyrdf:ID="subClassOf">
<rdfs:domainrdf:resource="#Class"/>
<rdfs:rangerdf:resource="#Class"/>
</rdf:Property>
<rdf:Propertyrdf:ID="subPropertyOf">
<rdfs:domainrdf:resource="&rdfProperty"/>
<rdfs:rangerdf:resource="&rdfProperty"/>
</rdf:Property>
</rdf:RDF>
The namespaces do not provide the full definition of RDF and RDF Schema. Consider, for
example,
rdfs:subClassOf
. The namespace specifies only thatitappliestoclassesandhas
a class as a value. The meaningofbeingasubclass,namely,thatall instancesofoneclassare
also instancesofitssuperclass,isnotexpressedanywhere.Infact,itcannotbeexpressedinan
RDFdocument.Ifitcould,therewouldbenoneedfordefiningRDFSchema.
In order to compare the different serialization formats, we will build a simple graph that we can
use throughout the examples to observe how the various serializations fold relationships
together. For this example graph, wellmodelasmallpartofTobyssocialsphereinparticular,
how he knows the other authors of his book. This will include things like the home page of his
blog, his email address, his interests, and any other names he might use. These clues about
Tobys identity are important to help differentiate our Toby from the numerous other Tobys in
theworldandobtainastrongidentifier(URI)thatwecanuseforfutureinteraction.
The relationships expressed in these social graphs have settled into a collection of wellknown
predicates, forming a vocabulary of expression known as Friend of a Friend or simply FOAF.
While FOAF deals primarily with people, the formal definition of FOAF states that the
foaf:depictionpredicate
canbeusedforgraphics portrayinganyresource(orthing)inthe
world.
TobysFOAFgraph
4.2 N-Triples
NTriples is a format for storing and transmitting data. It is a linebased, plain text
serialisation
format for
RDF (Resource Description Framework) graphs, and a subset of the
Turtle (Terse
RDF Triple Language) format. NTriples was designed to be easier for software to
parse and
generate.
ThereisverylittlevariationinhowanRDF
graph
canberepresentedinNTriples.
_:jamie<http://www.w3.org/1999/02/22rdfsyntaxns#type>
<http://xmlns.com/foaf/0.1/Person>.
<http://semprog.com/people/colin>
<http://xmlns.com/foaf/0.1/name>
"ColinEvans".
<http://semprog.com/people/colin><http://xmlns.com/foaf/0.1/mbox>
<mailto:[email protected]>.
<http://semprog.com/people/colin>
<http://www.w3.org/1999/02/22rdfsyntaxns#type>
<http://xmlns.com/foaf/0.1/Person>.
<http://semprog.com><http://www.w3.org/2000/01/rdfschema#label>
"SemanticProgramming".
<http://semprog.com>
<http://www.w3.org/1999/02/22rdfsyntaxns#type>
<
http://xmlns.com/foaf/0.1/Document
>
4.3 N3
Notation3
, or
N3 as it is more commonly known, is a shorthand non
XML serialization of
Resource Description Framework models, designed with humanreadabilityinmind:N3ismuch
more compact and readable than XML RDF notation. N3 has severalfeaturesthatgobeyonda
serializationforRDFmodels,suchassupportforRDFbasedrules.
In an RDF graph, every connection between nodes represents a triple. Since each node may
participate in a large number of relationships, we could significantly reduce the number of
characters used in NTriples if we used a short symbol to represent repeated nodes. We could
go further, recognizing that many of the URIs used in a specific model frequently come from
related URIs.Inmuch thesamewaythatXMLprovidesanamespacemechanismforgenerating
short Qualified Name (qnames) for nodes, N3allowsustodefineaURIprefixandidentifyentity
URIsrelativetoasetofprefixesdeclaredatthebeginningofthedocument.
N3 reduces this repetition by allowing you to combine multiple statements about the same
subject byusingasemicolon(
)afterthe firststatement,soyouonlyneedtostatethepredicate
andobjectforotherstatementsusingthesamesubject.
Example:
ThisRDFmodelinstandardXMLnotation
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22rdfsyntaxns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<rdf:Description
rdf:about="http://en.wikipedia.org/wiki/Tony_Benn"
>
<dc:title>
TonyBenn
</dc:title>
<dc:publisher>
Wikipedia
</dc:publisher>
</rdf:Description>
</rdf:RDF>
maybewritteninNotation3likethis:
@prefixdc:<http://purl.org/dc/elements/1.1/>.
<http://en.wikipedia.org/wiki/Tony_Benn>
dc:title"TonyBenn"
dc:publisher"Wikipedia".
4.4 RDF/XML
[1]
[2]
RDF/XML is a syntax,
defined by the
W3C
, to express (i.e.
serialize
) an
RDF graph as an
XML document. RDF/XML is sometimes misleading called simply RDF because it was
introduced among the other W3C specifications defining RDF and it was historically the first
W3C standard RDF serialization format. Although the RDF/XMLformatisstillinuse,otherRDF
serializations are now preferred by many RDF users, both because they are more
[3]
humanfriendly,
and because some RDF graphs are not representable in RDF/XML due to
restrictionsonthesyntaxofXML
QNames
.
Conceptually, RDF/XML is built up from a series of smaller descriptions,eachofwhichtracesa
path through an RDF graph.Thesepathsaredescribed intermsofthenodes(subjects)andthe
links(predicates)thatconnectthemtoothernodes(objects).
AstripefromTobysFOAFgraph
TheFOAFgraphwerepresentedinNTriplesandN3cannowberepresentedinRDF/XMLas:
<rdf:RDF
xmlns:foaf='http://xmlns.com/foaf/0.1/'
xmlns:rdf='http://www.w3.org/1999/02/22rdfsyntaxns#'
xmlns:rdfs='http://www.w3.org/2000/01/rdfschema#'>
<foaf:Personrdf:about="http://kiwitobes.com/toby.rdf#ts">
<foaf:name>TobySegaran</foaf:name>
<foaf:homepagerdf:resource="http://kiwitobes.com/"/>
<foaf:nick>kiwitobes</foaf:nick>
<foaf:mboxrdf:resource="mailto:[email protected]"/>
<foaf:interest>
<foaf:Documentrdf:about="http://semprog.com">
<rdfs:label>SemanticProgramming</rdfs:label>
</foaf:Document>
</foaf:interest>
<foaf:knows>
<foaf:Personrdf:about="http://semprog.com/people/colin">
<foaf:name>ColinEvans</foaf:name>
<foaf:mboxrdf:resource="mailto:[email protected]"/>
</foaf:Person>
</foaf:knows>
<foaf:knows>
<foaf:Person>
<foaf:name>JamieTaylor</foaf:name>
<foaf:mboxrdf:resource="mailto:[email protected]"/>
</foaf:Person>
</foaf:knows>
</foaf:Person>
</rdf:RDF>
4.5 RDFa
[1]
RDFa (or
Resource Description Framework in Attributes
) is a
W3C Recommendation that
adds a set of attributelevel extensions to
HTML
,
XHTML and various XMLbased document
types for embedding rich
metadata within Web documents. The RDF datamodel mapping
about
a
URI
or
CURIE
specifyingtheresourcethemetadataisabout
rel and
rev specifying a relationship and reverserelationship with another
resource,respectively
src
,
href
and
resource
specifyingthepartnerresource
Validation
RDFa is based on attributes. While some of the HTML attributes (e.g.,
href
,
src
) have been
reused, other RDFa attributes are new. This is important because some of the (X)HTML
validators may not properly validate the HTML codeuntiltheyareupdatedtorecognizethenew
RDFa attributes. This is rarely a probleminpracticesincebrowserssimplyignoreattributesthat
they donotrecognize.NoneoftheRDFaspecificattributeshaveanyeffecton thevisualdisplay
of the HTML content. Authors do not have to worry about pages marked up with RDFa looking
anydifferenttoahumanbeingfrompagesnotmarkedupwithRDFa.
Resources:
ASemanticWebPrimer,secondeditionGrigorisAntoniouandFrankvanHarmelen,2008
ProgrammingtheSemanticWebbyTobySegaran,ColinEvans,andJamieTaylor,2009
http://eapps.software.ucv.ro/ss15wiki/images/a/a6/Antoniou.pdf
3.43.6
http://eapps.software.ucv.ro/ss15wiki/images/a/ac/Segaran.pdf
RDFSerializationFormats
6880
http://www.cs.helsinki.fi/u/puustjar/soa15/SOC_RDF%20_OWL.pdf
http://www.w3schools.com/webservices/ws_rdf_schema.asp
http://www.obitko.com/tutorials/ontologiessemanticweb/rdfschemardfs.html
http://www.w3schools.com/webservices/ws_rdf_schema.asp
http://www.w3.org/TR/rdfschema/#ch_introduction
http://en.wikipedia.org/wiki/Notation3
http://en.wikipedia.org/wiki/RDF/XML
http://en.wikipedia.org/wiki/RDFa#cite_noterdfa_wiki2
http://www.w3.org/TR/rdfaprimer/