WebID by examples
Sample Graphs
Serializations Lineup
Of the serialisations listed below only RDF/XML and RDFa 1.0 are currently required by the WebID Spec. The listing below is to help us determine which of these formats could be potentially added to the required formats, or indeed if they could supplant one of them.
RDF/XML
<?xml version="1.0"?> <rdf:RDF xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cert="http://www.w3.org/ns/auth/cert#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> <foaf:Person rdf:about="https://bob.example/profile#me"> <foaf:name>Bob</foaf:name> <foaf:knows rdf:resource="https://example.edu/p/Alois#MSc" /> <cert:key> <cert:RSAPublicKey> <rdfs:label>made on 23 November 2011 on my laptop</rdfs:label> <cert:modulus rdf:datatype="http://www.w3.org/2001/XMLSchema#hexBinary">cb24ed85d64d794b69c70...</cert:modulus> <cert:exponent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">65537</cert:exponent> </cert:RSAPublicKey> </cert:key> </foaf:Person> </rdf:RDF>
Spec: http://www.w3.org/TR/REC-rdf-syntax/
Libs:
- C: http://librdf.org/ Bindings:
- PHP: https://github.com/semsol/arc2/wiki
- PHP: http://www.aelius.com/njh/easyrdf/
- Python: http://www.rdflib.net/
- Ruby: http://rdf.rubyforge.org/rdfxml/
- Java: http://jrdf.sourceforge.net/
- Java: http://jena.sourceforge.net/
- C#: http://razor.occams.info/code/semweb/
- JavaScript: http://code.google.com/p/rdfquery/
- JavaScript: http://www.jibbering.com/rdf-parser/
- JavaScript: https://github.com/linkeddata/rdflib.js
- and many others
Turtle and N3
@prefix : <http://www.w3.org/ns/auth/cert#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix bob: <https://bob.example/profile#> . @prefix rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . bob:me a foaf:Person; foaf:name "Bob"; foaf:knows <https://example.edu/p/Alois#MSc>; :key [ a :RSAPublicKey; rdfs:label "made on 23 November 2011 on my laptop"; :modulus "cb24ed85d64d794b69c70..."^^xsd:hexBinary; :exponent 65537 ; ] .
- N3 spec: http://www.w3.org/TeamSubmission/n3/
- Turtle spec: http://www.w3.org/TR/turtle/
Libs:
- C: http://librdf.org/ Bindings:
- PHP: https://github.com/semsol/arc2/wiki
- PHP: http://www.aelius.com/njh/easyrdf/
- Python: http://www.rdflib.net/
- Ruby: http://rdf.rubyforge.org/rdfxml/
- Java: http://jrdf.sourceforge.net/
- Java: http://jena.sourceforge.net/
- C#: http://razor.occams.info/code/semweb/
- JavaScript: http://code.google.com/p/rdfquery/
- JavaScript: http://www.jibbering.com/rdf-parser/
- JavaScript: https://github.com/linkeddata/rdflib.js
- and many others
N-Triples
<https://bob.example/profile#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person>. <https://bob.example/profile#me> <http://xmlns.com/foaf/0.1/name> "Bob". <https://bob.example/profile#me> <http://xmlns.com/foaf/0.1/knows> <https://example.edu/p/Alois#MSc>. _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/auth/cert#RSAPublicKey>. _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#label> "made on 23 November 2011 on my laptop". _:a <http://www.w3.org/ns/auth/cert#modulus> "cb24ed85d64d794b69c70..."^^<http://www.w3.org/2001/XMLSchema#hexBinary>. _:a <http://www.w3.org/ns/auth/cert#exponent> "65537"^^<http://www.w3.org/2001/XMLSchema#integer>. <https://bob.example/profile#me> <http://www.w3.org/ns/auth/cert#key> _:a.
Spec: http://www.w3.org/TR/rdf-testcases/#ntriples
Libs:
- C: http://librdf.org/ Bindings:
- PHP: https://github.com/semsol/arc2/wiki
- PHP: http://www.aelius.com/njh/easyrdf/
- Python: http://www.rdflib.net/
- Ruby: http://rdf.rubyforge.org/RDF/NTriples.html
- Java: http://jrdf.sourceforge.net/
- Java: http://jena.sourceforge.net/
- C#: http://razor.occams.info/code/semweb/
- and many others
RDFa 1.0
<div xmlns:cert="http://www.w3.org/ns/auth/cert#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" about="#me" typeof="foaf:Person" > <span property="foaf:name">Bob</span> <h1>My Good Friends</h1> <ul> <li rel="foaf:knows" href="https://example.edu/p/Alois#MSc">Alois</li> </ul> <h1>My RSA Public Keys</h1> <div rel="cert:key"> <div typeof="cert:RSAPublicKey"> <p property="rdfs:label">made on 23 November 2011 on my laptop</p> <dl> <dt>Modulus (hexadecimal)</dt> <dd property="cert:modulus" datatype="xsd:hexBinary">cb24ed85d64d794b69c70...</dd> <dt>Exponent (decimal)</dt> <dd property="cert:exponent" datatype="xsd:int">65537</dd> </dl> </div> </div> </div>
Spec: http://www.w3.org/TR/rdfa-syntax/
Libs:
- C: http://librdf.org/ Bindings:
- Python: http://www.rdflib.net/
- Ruby: http://rdf.rubyforge.org/rdfa/
- Perl: http://search.cpan.org/dist/RDF-RDFa-Parser/
- JavaScript: http://code.google.com/p/rdfquery/wiki/Introduction
- JavaScript: http://www.jibbering.com/rdf-parser/
- JavaScript: https://github.com/linkeddata/rdflib.js
- Java:
- http://www-sop.inria.fr/teams/edelweiss/wiki/wakka.php?wiki=RDFaParser
- Shellacs' parser for Jena and Sesame https://github.com/shellac/java-rdfa
- and many others
RDFa 1.1
<div about="#me" typeof="foaf:Person" vocab="http://www.w3.org/ns/auth/cert#" prefix="foaf: http://xmlns.com/foaf/0.1/ rdfs: xmlnshttp://www.w3.org/2000/01/rdf-schema# xsd: http://www.w3.org/2001/XMLSchema#"> <span property="foaf:name">Bob</span> <h1>My Good Friends</h1> <ul> <li rel="foaf:knows" href="https://example.edu/p/Alois#MSc">Alois</li> </ul> <h1>My RSA Public Keys</h1> <div rel="key"> <div typeof="RSAPublicKey"> <p property="rdfs:label">made on 23 November 2011 on my laptop</p> <dl> <dt>Modulus (hexadecimal)</dt> <dd property="modulus" datatype="xsd:hexBinary">cb24ed85d64d794b69c70...</dd> <dt>Exponent (decimal)</dt> <dd property="exponent" datatype="xsd:int">65537</dd> </dl> </div> </div> </div>
Spec: http://www.w3.org/TR/rdfa-core/ (HTML: http://www.w3.org/TR/rdfa-in-html/ XHTML: http://www.w3.org/TR/xhtml-rdfa/ )
Some of libs that supported RDF 1.0 might support RDF 1.1.
JSON-LD
{ "@context": { "cert": "http://www.w3.org/ns/auth/cert#", "foaf": "http://xmlns.com/foaf/0.1/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "@coerce": { "xsd:int": "cert:exponent", "@iri": [ "cert:key", "foaf:knows" ], "xsd:hexBinary": "cert:modulus" } }, "@subject": "#me", "@type": "foaf:Person", "cert:key": { "@type": "cert:RSAPublicKey", "cert:exponent": 65537, "cert:modulus": "cb24ed85d64d794b69c70...", "rdfs:label": "made on 23 November 2011 on my laptop" }, "foaf:knows": "https://example.edu/p/Alois#MSc", "foaf:name": "Bob" }
Spec: http://json-ld.org/spec/latest/json-ld-syntax/
Libs:
- C++: https://github.com/digitalbazaar/monarch
- PHP: https://github.com/digitalbazaar/php-json-ld
- Python: https://github.com/bradleypallen/json_ld_processor
- Ruby: https://github.com/gkellogg/json-ld/
- JavaScript: https://github.com/digitalbazaar/jsonld.js
RDF/JSON
{ "https://bob.example/profile#me" : { "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" : [ { "value" : "http://xmlns.com/foaf/0.1/Person", "type" : "uri" } ] , "http://xmlns.com/foaf/0.1/name" : [ { "value" : "Bob", "type" : "literal" } ] , "http://xmlns.com/foaf/0.1/knows" : [ { "value" : "https://example.edu/p/Alois#MSc", "type" : "uri" } ] , "http://www.w3.org/ns/auth/cert#key" : [ { "value" : "_:a", "type" : "bnode" } ] } , "_:a" : { "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" : [ { "value" : "http://www.w3.org/ns/auth/cert#RSAPublicKey", "type" : "uri" } ] , "http://www.w3.org/1999/02/22-rdf-syntax-ns#label" : [ { "value" : "made on 23 November 2011 on my laptop", "type" : "literal" } ] , "http://www.w3.org/ns/auth/cert#modulus" : [ { "value" : "cb24ed85d64d794b69c70...", "type" : "literal", "datatype" : "http://www.w3.org/2001/XMLSchema#hexBinary" } ] , "http://www.w3.org/ns/auth/cert#exponent" : [ { "value" : "65537", "type" : "literal", "datatype" : "http://www.w3.org/2001/XMLSchema#integer" } ] } }
Spec: https://dvcs.w3.org/hg/rdf/raw-file/default/rdf-json/index.html (Editor's Draft)
It is under development so there aren't many libs. Additionally, there are a lot of RDF serializations which isn't compatible with RDF/JSON.
Microdata
<div itemscope="" itemtype="http://xmlns.com/foaf/0.1/Person"> <div itemprop="http://www.w3.org/2000/01/rdf-schema#about">https://bob.example/profile#me</div> <h1>My Good Friends</h1> <div itemprop="http://xmlns.com/foaf/0.1/name">Bob</div> <div itemprop="http://xmlns.com/foaf/0.1/knows" itemscope="">Alois <div itemprop="http://www.w3.org/2000/01/rdf-schema#resource">https://example.edu/p/Alois#MSc</div> </div> <h1>My RSA Public Keys</h1> <div itemprop="http://www.w3.org/ns/auth/cert#key" itemscope="" itemtype="http://www.w3.org/ns/auth/cert#RSAPublicKey"> <div itemprop="http://www.w3.org/2000/01/rdf-schema#label">made on 23 November 2011 on my laptop</div> <div itemprop="http://www.w3.org/ns/auth/cert#modulus" itemscope="">cb24ed85d64d794b69c70... <div itemprop="http://www.w3.org/2000/01/rdf-schema#datatype">http://www.w3.org/2001/XMLSchema#hexBinary</div> </div> <div itemprop="http://www.w3.org/ns/auth/cert#exponent" itemscope="">65537 <div itemprop="http://www.w3.org/2000/01/rdf-schema#datatype">http://www.w3.org/2001/XMLSchema#integer</div> </div> </div> </div>
Spec: http://www.w3.org/TR/microdata/
Issues: Issue 66 has been raised in support of Microdata for WebID profiles. http://www.w3.org/2005/Incubator/webid/track/issues/66
Libs: