the red penguin
HOME NEWS CONTACT ABOUT BLOG LOGIN

26. A very good guide to linked data

Introduction

http://www27.cs.kobe-u.ac.jp/achieve/data/pdf/1285.pdf

What Do the Formats Look Like?

N-Triples

Note: grey numbers are there for explanation purposes only: NOT N-Triples

Turtle

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://dbpedia.org/resource/Bob_Marley> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
dbr:Bob_Marley a foaf:Person

JSON-LD

RDF/XML

Which is the Best Format for Me?

RDF/XML:

JSON-LD:

Turtle:

N-Triples:

Conclusion:

TL;DR:

Appendix:

N-Triples

<http://dbpedia.org/resource/Bob_Marley>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://xmlns.com/foaf/0.1/Person> .

<http://dbpedia.org/resource/Bob_Marley>
<http://www.w3.org/2000/01/rdf-schema#label>
"Bob Marley"@en .

<http://dbpedia.org/resource/Bob_Marley>
<http://www.w3.org/2000/01/rdf-schema#label>
"Bob Marley"@fr .

<http://dbpedia.org/resource/Bob_Marley>
<http://www.w3.org/2000/01/rdf-schema#seeAlso>
<http://dbpedia.org/resource/Rastafari> .

<http://dbpedia.org/resource/Bob_Marley>
<http://dbpedia.org/ontology/birthPlace>
<http://dbpedia.org/resource/Jamaica> .

<http://dbpedia.org/resource/Jamaica>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://schema.org/Country> .

<http://dbpedia.org/resource/Jamaica>
<http://www.w3.org/2000/01/rdf-schema#label>
"Jamaica"@en .

<http://dbpedia.org/resource/Jamaica>
<http://www.w3.org/2000/01/rdf-schema#label>
"Giamaica"@it .

<http://dbpedia.org/resource/Jamaica>
<http://www.w3.org/2003/01/geo/wgs84_pos#lat>
"17.9833"^^<http://www.w3.org/2001/XMLSchema#float> .

<http://dbpedia.org/resource/Jamaica>
<http://www.w3.org/2003/01/geo/wgs84_pos#long>
"-76.8"^^<http://www.w3.org/2001/XMLSchema#float> .

<http://dbpedia.org/resource/Jamaica>
<http://xmlns.com/foaf/0.1/homepage>
<http://jis.gov.jm/> .

Turtle

@prefix dbr:    <http://dbpedia.org/resource/> .
@prefix dbo:    <http://dbpedia.org/ontology/> .
@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf:   <http://xmlns.com/foaf/0.1/> .
@prefix geo:    <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix xsd:    <http://www.w3.org/2001/XMLSchema#> .
@prefix schema: <http://schema.org/> .dbr:Bob_Marley
a foaf:Person ;
rdfs:label "Bob Marley"@en ;
rdfs:label "Bob Marley"@fr ;
rdfs:seeAlso dbr:Rastafari ;
dbo:birthPlace dbr:Jamaica .dbr:Jamaica
a schema:Country ;
rdfs:label "Jamaica"@en ;
rdfs:label "Giamaica"@it ;
geo:lat "17.9833"^^xsd:float ;
geo:long "-76.8"^^xsd:float ;
foaf:homepage <http://jis.gov.jm/> .

JSON-LD

[
  {
    "@id": "http://dbpedia.org/resource/Bob_Marley",
    "@type": [
      "http://xmlns.com/foaf/0.1/Person"
    ],
    "http://www.w3.org/2000/01/rdf-schema#label": [
      {
        "@value": "Bob Marley",
        "@language": "en"
      },
      {
        "@value": "Bob Marley",
        "@language": "fr"
      }
    ],
    "http://www.w3.org/2000/01/rdf-schema#seeAlso": [
      {
        "@id": "http://dbpedia.org/resource/Rastafari"
      }
    ],
    "http://dbpedia.org/ontology/birthPlace": [
      {
        "@id": "http://dbpedia.org/resource/Jamaica"
      }
    ]
  },
  {
    "@id": "http://dbpedia.org/resource/Jamaica",
    "@type": [
      "http://schema.org/Country"
    ],
    "http://www.w3.org/2000/01/rdf-schema#label": [
      {
        "@value": "Jamaica",
        "@language": "en"
      },
      {
        "@value": "Giamaica",
        "@language": "it"
      }
    ],
    "http://www.w3.org/2003/01/geo/wgs84_pos#lat": [
      {
        "@value": "17.9833",
        "@type": "http://www.w3.org/2001/XMLSchema#float"
      }
    ],
    "http://www.w3.org/2003/01/geo/wgs84_pos#long": [
      {
        "@value": "-76.8",
        "@type": "http://www.w3.org/2001/XMLSchema#float"
      }
    ],
    "http://xmlns.com/foaf/0.1/homepage": [
      {
        "@id": "http://jis.gov.jm/"
      }
    ]
  },
  {
    "@id": "http://dbpedia.org/resource/Rastafari"
  },
  {
    "@id": "http://jis.gov.jm/"
  },
  {
    "@id": "http://schema.org/Country"
  },
  {
    "@id": "http://xmlns.com/foaf/0.1/Person"
  }
]

RDF/XML

<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:foaf="http://xmlns.com/foaf/0.1/"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
         xmlns:ns0="http://dbpedia.org/ontology/"
         xmlns:schema="http://schema.org/"
         xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">

  <foaf:Person rdf:about="http://dbpedia.org/resource/Bob_Marley">
    <rdfs:label xml:lang="en">Bob Marley</rdfs:label>
    <rdfs:label xml:lang="fr">Bob Marley</rdfs:label>
    <rdfs:seeAlso rdf:resource="http://dbpedia.org/resource/Rastafari"/>
    <ns0:birthPlace>
      <schema:Country rdf:about="http://dbpedia.org/resource/Jamaica">
        <rdfs:label xml:lang="en">Jamaica</rdfs:label>
        <rdfs:label xml:lang="it">Giamaica</rdfs:label>
        <geo:lat rdf:datatype="http://www.w3.org/2001/XMLSchema#float">17.9833</geo:lat>
        <geo:long rdf:datatype="http://www.w3.org/2001/XMLSchema#float">-76.8</geo:long>
        <foaf:homepage rdf:resource="http://jis.gov.jm/"/>
      </schema:Country>
    </ns0:birthPlace>

  </foaf:Person>

</rdf:RDF>
Sunday 6 March 2022, 196 views


Leave a Reply

Your email address will not be published.