The value of RDF Linked Data comes when it is paired with a
Triplestore that supports the RDF query language,
SPARQL (short for
SPARQL Protocol and RDF Query Language), allows for sophisticated
retrieval of data within the triplestore as well as an means to
manipulate the data by adding, editing, or deleting triples contained in
the triplestore.
With RDF predicates restricted to IRIs, multiple
RDF vocabularies can be used in the same graph with potential different
semantic statements being asserted about the same subject.
SPARQL easily handles multiple vocabularies like
Schema.org and
BIBFRAME.
Finally, RDF graphs support different serialization methods for both
input and export of data. The RDF XML serialization was the first method
followed by N-Triples, Turtle, and JSON-LD.
Example SPARQL - Number of Triples in Graph
SELECT (COUNT(*) as ?count)
WHERE { ?s ?p ?o . }
Example SPARQL - Entities and Titles for all BIBFRAME Works
PREFIX bf: <http://id.log.gov/onotologies/bibframe/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?iri ?title
WHERE { ?iri rdf:type bf:Work ;
bf:title ?title_node .
?title_node rdf:value ?title
}
>>> http://www.worldcat.org/oclc/32050898,
"Pride and Prejudice"
Example Graph in XML Format
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:bf="http://id.log.gov/onotologies/bibframe/"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>
<rdf:Description rdf:about="http://www.worldcat.org/oclc/32050898">
<rdf:type rdf:resource="http://id.log.gov/onotologies/bibframe/Work"/>
<bf:title rdf:nodeID="N3d82a73836c547d8be606b01797b8fb8"/>
<rdf:type rdf:resource="http://id.log.gov/onotologies/bibframe/Text"/>
<bf:contribution rdf:nodeID="Nfbc8691a15774bf581a429e4f99822a7"/>
</rdf:Description>
<rdf:Description rdf:about="https://en.wikipedia.org/wiki/Jane_Austen">
<rdfs:label xml:lang="en">Jane Austen</rdfs:label>
<owl:sameAs rdf:resource="http://viaf.org/viaf/102333412"/>
<rdf:type rdf:resource="http://schema.org/Person"/>
</rdf:Description>
<rdf:Description rdf:nodeID="Nfbc8691a15774bf581a429e4f99822a7">
<bf:role rdf:resource="http://id.loc.gov/vocabulary/relators/aut"/>
<rdf:value rdf:resource="https://en.wikipedia.org/wiki/Jane_Austen"/>
<rdf:type rdf:resource="http://id.log.gov/onotologies/bibframe/Contribution"/>
</rdf:Description>
<rdf:Description rdf:nodeID="N3d82a73836c547d8be606b01797b8fb8">
<rdf:type rdf:resource="http://id.log.gov/onotologies/bibframe/Title"/>
<rdf:value xml:lang="en">Pride and Prejudice</rdf:value>
</rdf:Description>
</rdf:RDF>
Example in Turtle Format
@prefix bf: <http://id.log.gov/onotologies/bibframe/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix relators: <http://id.loc.gov/vocabulary/relators/> .
@prefix schema: <http://schema.org/> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://www.worldcat.org/oclc/32050898> a bf:Text,
bf:Work ;
bf:contribution [ a bf:Contribution ;
bf:role relators:aut ;
rdf:value <https://en.wikipedia.org/wiki/Jane_Austen> ] ;
bf:title [ a bf:Title ;
rdf:value "Pride and Prejudice"@en ] .
<https://en.wikipedia.org/wiki/Jane_Austen> a schema:Person ;
rdfs:label "Jane Austen"@en ;
owl:sameAs <http://viaf.org/viaf/102333412> .
Example in JSON-LD Format
[
{
"@id": "https://en.wikipedia.org/wiki/Jane_Austen",
"@type": [
"http://schema.org/Person"
],
"http://www.w3.org/2000/01/rdf-schema#label": [
{
"@language": "en",
"@value": "Jane Austen"
}
],
"http://www.w3.org/2002/07/owl#sameAs": [
{
"@id": "http://viaf.org/viaf/102333412"
}
]
},
{
"@id": "http://www.worldcat.org/oclc/32050898",
"@type": [
"http://id.log.gov/onotologies/bibframe/Work",
"http://id.log.gov/onotologies/bibframe/Text"
],
"http://id.log.gov/onotologies/bibframe/contribution": [
{
"@id": "_:Nfbc8691a15774bf581a429e4f99822a7"
}
],
"http://id.log.gov/onotologies/bibframe/title": [
{
"@id": "_:N3d82a73836c547d8be606b01797b8fb8"
}
]
},
{
"@id": "_:N3d82a73836c547d8be606b01797b8fb8",
"@type": [
"http://id.log.gov/onotologies/bibframe/Title"
],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#value": [
{
"@language": "en",
"@value": "Pride and Prejudice"
}
]
},
{
"@id": "_:Nfbc8691a15774bf581a429e4f99822a7",
"@type": [
"http://id.log.gov/onotologies/bibframe/Contribution"
],
"http://id.log.gov/onotologies/bibframe/role": [
{
"@id": "http://id.loc.gov/vocabulary/relators/aut"
}
],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#value": [
{
"@id": "https://en.wikipedia.org/wiki/Jane_Austen"
}
]
}
]