Last verification: | 20180912 |
---|---|
Tools required for this lab: | – |
During this lab we will use Anything to Triples website. If it is down, there is also a possibility to download any23 service and run it on your own computer:
[PATH-to-unpacked-archive]/apache-any23-service-1.1-server-embedded/bin/any23server
"$REPO"
into %REPO%
twice (line #79 in any23server.bat file) if Error: Unable to access jarfile $REPO/jetty-runner-8.1.4.v20120524.jar.
message appearsDuring this lab, you will serialize (using Turtle syntax) an RDF graph created before (The Bold and the Beautiful vs The Game of Thrones).
RDF is a data model for which several syntaxes have been developed. RDF document is an RDF graph (describing some objects) serialized into chosen representation/syntax. In this task, you will convert the graph representation into so called Turtle syntax.
*.ttl
extension.@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix bb: <http://yourname/b-and-b#>.
@base <http://kkutt/b-and-b/> .
#
symbol.<http://kkutt/b-and-b/brooke-logan>
. To make notation more compact, we can use prefixes and/or base namespace.<data><![CDATA[ … ]]></data>
(indentation may be changed).ttl
file) in the report archive.In RDF there are two ways to describe set or sequences of objects: Containters and Collections.
The container and collection are resources that contain things. The contained things are members. RDF defines three types of containers:
rdf:Bag
,rdf:Seq
,rdf:Alt
,and one type of collection:
rdf:List
.While „a container only says that certain identified resources are members; it does not say that other members do not exist.” with a Collection we can describe groups containing only the specified members.
Read about them and then:
Add the references to XML Schema datatypes to chosen information in your RDF file, e.g.:
# ... @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . # ... # ... <brooke-logan> <daughter-of> <beth-logian>; <born> "1900-01-01"^^xsd:date; <studied> "Chemistry"^^xsd:string; # ...
Use at least 3 different datatypes!
We are in the middle, so let's visualize our RDF files.
rdfxml
) format. Do not analyze resulting code. Simply copy it :) Check by Direct Input
field. Select Graph only
from dropdown list and click Parse RDF
Semantic vocabularies are sets of predefined properties for describing some domains. Examples include:
# ... @prefix dc: <http://purl.org/dc/elements/1.1/>. @prefix dcterms: <http://purl.org/dc/terms/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix fhkb: <http://www.example.com/genealogy.owl#> . # ... # ... <brooke-logan> fhkb:isDaughterOf <beth-logian>; <born> "1900-01-01"^^xsd:date; <studied> "Chemistry"^^xsd:string; foaf:name "Brooke Logan", "Brooke Forrester", "Brooke Chambers", "Brooke Jones", "Brooke Marone", "Brooke Spencer". # ...
dcterms:
and dc:
elements is here („Section 2: Properties in the /terms/ namespace” = dcterms:
, „Properties in the /elements/1.1/ namespace” = dc:
)RDF Schema allows to organize objects into classes and define simple taxonomies.
@base <http://kkutt/got/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . <Character> rdf:type rdfs:Class . <Dwarf> rdf:type rdfs:Class ; rdfs:subClassOf <Character> . foaf:Person rdfs:subClassOf <Character> .
Add the rdf:type
statements to your RDF file, e.g.:
<brooke-logan> a foaf:Person . <tyrion-lannister> rdf:type <Dwarf> .
Note that a
is an alias for rdf:type
so two statements:
<tyrion-lannister> rdf:type <Dwarf> .
<tyrion-lannister> a <Dwarf> .
are equivalent.
RDF Schema also provides a way to define Properties as well as their domains and ranges.
<brooke-logan> fhkb:isDaughterOf <beth-logian>; <born> "1900-01-01"^^xsd:date; <studied> "Chemistry"^^xsd:string; foaf:name "Brooke Logan", "Brooke Forrester", "Brooke Chambers", "Brooke Jones", "Brooke Marone", "Brooke Spencer".
<studied>
is not defined in external dictionary – it is defined in our own namespace.
@base <http://kkutt/b-and-b/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . <studied> rdf:type rdfs:Property ; rdfs:domain foaf:person ; rdfs:range rdfs:Literal.
You may find RDF Schema 1.1 recommendation useful.
RDF Schema also provides some handful properties that are not used in inference process. These are:
rdfs:label
– used by convention to provide a human-readable name that is displayed by semantic web agents,rdfs:seeAlso
– cross-referencing; provide links to supplementary information,rdfs:isDefinedBy
– subPropertyOf rdfs:seeAlso; provides a link to the primary source of information,rdfs:comment
– for everything you want :) .Reading:
Common vocabularies:
RDF serialization in XML:
Tools:
Articles:
Others: