- but no fixed structure
A work (unidentified) has
....etc
Information Management: A Proposal,
--Tim Berners-Lee, CERN, Marzo 1989
Foafnaut shows information as informations nodes with relations...
Clearly:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/" >
<foaf:Person>
<foaf:mbox rdf:resource="mailto:charles@w3.org"/>
<foaf:givenname xml:lang="en">Charles</foaf:givenname>
</foaf:Person>
</rdf:RDF>
A useful tool: the RDF validator
The "triples" (the declarations):
Subject | Predicate | Object | |
---|---|---|---|
1 | genid:ARP14847 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | http://xmlns.com/foaf/0.1/Person |
2 | genid:ARP14847 | http://xmlns.com/foaf/0.1/mbox | mailto:charles@w3.org |
3 | genid:ARP14847 | http://xmlns.com/foaf/0.1/givenname | "Charles"@en |
"Blank nodes" aren't "identified" (named), just described.
For example, we can use
(Here is an example of foaf, and example of EARL, that I prepared eaerlier)
- declarations, of potentially independent origin
- pronounced as "coom"
python cwm.py --rdf rdf-ejem.rdf rdf2-ejem.rdf
result: The information from the two files, mixed
rdf:Description
"?- the important thing is the semantics
Usando otra forma de RDF llamada n3, cwm puede
N3 syntax is consistent and can represent RDF/XML accurately, but it is not XML
python cwm.py --rdf rdf-ejem.rdf rdf2-ejem.rdf --n3
(it is useful to make an instruction cwm instead of using python cwm.py...)
gives:
[ a <http://xmlns.com/foaf/0.1/Person>;
<http://xmlns.com/foaf/0.1/givenname> "Charles"@en;
<http://xmlns.com/foaf/0.1/mbox> <mailto:charles@w3.org> ].
[ a <http://xmlns.com/foaf/0.1/Person>;
<http://xmlns.com/foaf/0.1/mbox> <mailto:charles@w3.org>;
<http://xmlns.com/foaf/0.1/name> "Charles McCathieNevile"@fr ].
The idea of n3 was to create something easier to read and write.
(Personally I prefer to use a tool for that :-)
The basic syntax: <url1> <url2> <url3> .
For two declarations:
<url1> <url2> <url3> .
<url4> <url5> <url6> .
[ <predicado> <objeto> ]
<x> a <y> .
<x>
is a member of the class
<y>
- literally
<x> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <y> .
<x> <pred1> <obj1> .
<x> <pred2> <obj2> .
"texto"@es
Cwm allows some options in the instructions
--n3
--rdf
--think
--purge
http://www.w3.org/2000/10/swap/log#Chaff
")--filter=
filename{ ?x a <http://xmlns.com/foaf/0.1/Person> ;
<http://xmlns.com/foaf/0.1/mbox> ?direction ;
<http://xmlns.com/foaf/0.1/name> ?nombre .
?y a <http://xmlns.com/foaf/0.1/Person> ;
<http://xmlns.com/foaf/0.1/mbox> ?direction ;
<http://xmlns.com/foaf/0.1/givenname> ?apellido .
} =>
{ ?x a <http://xmlns.com/foaf/0.1/Person> ;
<http://xmlns.com/foaf/0.1/mbox> ?direction ;
<http://xmlns.com/foaf/0.1/givenname> ?apellido ;
<http://xmlns.com/foaf/0.1/name> ?nombre } .
If ?x
is a Person, with a given value for mbox
and for name
,
and ?y
is a Person with the same value for mbox
and some value for givenname
,
Then ?x
has the same value for givenname
=>
<http://www.w3.org/2000/10/swap/log#implies>
?algo
algo
" as a name of a variable (in n3 - there is no
equivalent in RDF/XML yet){ <x> <y> <z> }
cwm --rdf rdf-ejem.rdf rdf2-ejem.rdf --n3 regla-ejem.n3 --think
The result includes all the information given (including the rule itself)
@prefix log: <http://www.w3.org/2000/10/swap/log#>
.
<x> <pred> <objUno> .
<x> <pred> <objDos> .
To only give the results we are interested in use
cwm --rdf rdf-ejem.rdf rdf2-ejem.rdf --n3 regla-ejem.n3 --think --filter=regla-ejem.n3
This only gives declarations corresponding to something implied by a rule in regla-ejem.n3
Note If you want to include other declarations, you have to include them as implications in the filter:
{ ?z a ical:Vcalendar } =>
{ ?z a ical:Vcalendar } .
The rules in evaluador.n3 include a blank node
{ [ a <http://xmlns.com/foaf/0.1/Person> ;
<http://xmlns.com/foaf/0.1/mbox> ?direction ;
?relation ?objeto ] .
?y a earl:Assertor ;
earl:email ?direction }
=> { ?y ?relation ?objeto } .
We can use the example FOAF and EAR files:
cwm --rdf earl-ejem.rdf foaf-ejem2.rdf --n3 > cwm-ejem.n3 cwm cwm-ejem.n3 evaluador.n3 --think --filter=evaluador.n3
To find all the declarations with the earl:Assertor
as
subject
{ ?ev a act:ActionItem ; dc:title ?title ;
log:racine ?desde . ?desde dc:date ?fecha} =>
{ ?ev a ical:Vtodo ; ical:summary ?title ;
ical:dtstart [ ical:dateTime ?fecha ];
is ical:component of <foo> } .
Note Another syntax construction: <objeto>
is <relacion> of
<subjeto>
It is open source, developed collaboratively...
It also includes arithmetic functions expressed as RDF, and other interesting possiblities
Remember
rdf:Description
rdfs:subClass
rdfs:seeAlso
Etc...
Basic RDF:
Subject - Predicate - Object
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:exterms="http://www.example.org/terms/">
<rdf:Description rdf:about="http://www.example.org/index.html">
<exterms:creation-date>August 16, 1999</exterms:creation-date>
</rdf:Description>
</rdf:RDF>
about
, ID
, nodeID
Three similar attributes to identify what is described
ID
ID
in XML. Puede aparecer una vez en un documento,
y se refiere de fuera
p.ej. <rdf:Description rdf:ID="aquí">
defines
#aquí
in the document (or its xml:base
)
about
"../#alli
") that is its value.eg. <rdf:Description
rdf:about="http://www.example.com/#aquí">
nodeID
ID
, but it can appear repeatedly.Properties are the relations
Each one has a URI - so we can decribe it in RDF
<rdf:Description rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"> <rdfs:comment xml:lang="es">Una relation entre 2 cosas identificados (normalmente) por URIs</rdf:label> </rdf:Description>
A class is a type of resource.
For example, every RDF class is of type
http://www.w3.org/1999/02/22-rdf-syntax-ns#Class
(and possibly of other classes at the same time)
type
and datatype
(and
xml:lang
)Different things, but similar
type
datatypegDate
es una fecha
xml:lang<foaf:Person><foaf:name>Charles</foaf:name></foaf:Person>
<algo:Anónimo><dc:title rdf:value="Un
titulo"/></algo:Anónimo>
first
, rest
, nil
, ...subClass
- hierarchy in RDFSA class can be a subclass of others
For example, we can say that "myclass" is a subclass of Class
implica que todo de tipo myclass es de tipo Class (pero no viceversa)
Hay también subProperty para propiedades
There are 6 specifications for RDF (including a primer and test cases), and 6 more for OWL...
RDFS is a common nickname for the RDF language for describing voccabularies
It includes the properties label
and comment
,
which are useful to present a label in an interface, or describe it more
meaningfully.
<rdf:Description rdf:about="http://www.w3.org/2000/01/rdf-schema#label">
<rdfs:label xml:lang="no">Navn</rdfs:label>
<rdfs:label xml:lang="es">Titulo</rdfs:label>
<rdfs:comment xml:lang="es">Un titulo breve para un termino en un vocabulario RDF</rdfs:comment>
</rdf:Description>
An RDF vocabulary that can define a vocabulary more precisely
For example
- or describe something equivalently...
Build (use rdfs:label
and rdfs:comment
!) or
"Borrow"?
Better to use something already made. But where to find it?