-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial SPARQL mapping queries for Sinopia BIBFRAME resources to FOLI…
…O Instance
- Loading branch information
1 parent
85c03ea
commit e142066
Showing
2 changed files
with
247 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
date_of_publication = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?date | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:provisionActivity ?activity . | ||
?activity a bf:Publication . | ||
?activity bf:date ?date . | ||
}} | ||
""" | ||
|
||
identifier = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?identifier | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:identifiedBy ?ident_bnode . | ||
?ident_bnode a {bf_identifier_class} . | ||
?ident_bnode rdf:value ?identifier . | ||
}} | ||
""" | ||
|
||
instance_format_category = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?format_category | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:media ?format_category . | ||
}} | ||
""" | ||
|
||
instance_format_term = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?format_term | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:carrier ?format_term . | ||
}} | ||
""" | ||
|
||
local_identifier = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?identifier | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:identifiedBy ?ident_bnode . | ||
?ident_bnode a bf:Local . | ||
?ident_bnode bf:source ?source_bnode . | ||
?ident_bnode rdf:value ?identifier . | ||
?source_bnode a bf:Source . | ||
OPTIONAL {{ | ||
?source_bnode rdfs:label "OColC" . | ||
}} | ||
OPTIONAL {{ | ||
?source_bnode rdfs:label "OCLC" . | ||
}} | ||
}} | ||
""" | ||
|
||
mode_of_issuance = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SElECT ?mode_of_issuance | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:issuance ?mode_of_issuance . | ||
}} | ||
""" | ||
|
||
note = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?note | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:note ?note_bnode . | ||
?note_bnode a bf:Note . | ||
?note_bnode rdfs:label ?note . | ||
}} | ||
""" | ||
|
||
physical_description_dimensions = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?dimensions | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:dimensions ?dimensions . | ||
}} | ||
""" | ||
|
||
physical_description_extent = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?extent | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:extent ?extent_bnode . | ||
?extent_bnode a bf:Extent . | ||
?extent_bnode rdfs:label ?extent . | ||
}} | ||
""" | ||
|
||
place = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?place | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:provisionActivity ?activity . | ||
?activity a bf:Publication . | ||
?activity bf:place ?place_holder . | ||
?place_holder rdfs:label ?place . | ||
}} | ||
""" | ||
|
||
publisher = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?publisher | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:provisionActivity ?activity . | ||
?activity a bf:Publication . | ||
?activity bf:agent ?agent . | ||
?agent a bf:Agent . | ||
?agent rdfs:label ?publisher . | ||
}} | ||
""" | ||
|
||
title = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?main_title ?subtitle ?part_number ?part_name | ||
WHERE {{ | ||
<{bf_instance}> a bf:Instance . | ||
<{bf_instance}> bf:title ?title . | ||
?title a {bf_title_class} . | ||
?title bf:mainTitle ?main_title . | ||
OPTIONAL {{ | ||
?title bf:subtitle ?subtitle . | ||
}} | ||
OPTIONAL {{ | ||
?title bf:partNumber ?part_number . | ||
}} | ||
OPTIONAL {{ | ||
?title bf:partName ?part_name | ||
}} | ||
}} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
contributor = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX bflc: <http://id.loc.gov/ontologies/bflc/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?agent ?role | ||
WHERE {{ | ||
<{bf_work}> a bf:Work . | ||
<{bf_work}> bf:contribution ?contrib_bnode . | ||
?contrib_bnode a bf:Contribution . | ||
?contrib_bnode bf:role ?role_uri . | ||
?role_uri rdfs:label ?role . | ||
?contrib_bnode bf:agent ?agent_uri . | ||
?agent_uri a {bf_class} . | ||
?agent_uri rdfs:label ?agent . | ||
}} | ||
""" | ||
|
||
editions = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?edition | ||
WHERE {{ | ||
<{bf_work}> a bf:Work . | ||
<{bf_work}> bf:editionStatement ?edition . | ||
}} | ||
""" | ||
|
||
instance_type_id = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
SELECT ?instance_type_id | ||
WHERE {{ | ||
<{bf_work}> a bf:Work . | ||
<{bf_work}> bf:content ?instance_type . | ||
?instance_type rdfs:label ?instance_type_id . | ||
}} | ||
""" | ||
|
||
language = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
SELECT ?language | ||
WHERE {{ | ||
<{bf_work}> a bf:Work . | ||
<{bf_work}> bf:language ?language_uri . | ||
?language_uri rdfs:label ?language . | ||
}} | ||
""" | ||
|
||
primary_contributor = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX bflc: <http://id.loc.gov/ontologies/bflc/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?agent ?role | ||
WHERE {{ | ||
<{bf_work}> a bf:Work . | ||
<{bf_work}> bf:contribution ?contrib_bnode . | ||
?contrib_bnode a bflc:PrimaryContribution . | ||
?contrib_bnode bf:role ?role_uri . | ||
?role_uri rdfs:label ?role . | ||
?contrib_bnode bf:agent ?agent_uri . | ||
?agent_uri a {bf_class} . | ||
?agent_uri rdfs:label ?agent . | ||
}} | ||
""" | ||
|
||
subject = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
SELECT ?subject | ||
WHERE {{ | ||
<{bf_work}> a bf:Work . | ||
<{bf_work}> bf:subject ?subject_node . | ||
OPTIONAL {{ | ||
?subject_node rdfs:label ?subject . | ||
}} | ||
}} | ||
""" |