Skip to content

Instantly share code, notes, and snippets.

@baskaufs
baskaufs / construct_resource_relationship_triple.rq
Last active October 16, 2021 15:56
SPARQL CONSTRUCT query to create a triple for a resource relationship to be run at https://sparql.vanderbilt.edu/
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix dcterms: <http://purl.org/dc/terms/>
construct {?subject ?predicate ?object}
from <https://resourcerelationship>
where {
bind("http://example.org/.well-known/genid/" as ?skolem)
?statement rdf:subject/dcterms:identifier ?subjectID.
?statement rdf:predicate/dcterms:identifier ?predicateID.
?statement rdf:object/dcterms:identifier ?objectID.
@baskaufs
baskaufs / find_concepts.rq
Created October 15, 2021 21:50
SPARQL query to run at https://sparql.vanderbilt.edu/ to find related format concepts
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix acformat: <http://rs.tdwg.org/format/values/>
select distinct ?broaderConcept ?label ?mediaType ?match ?matchLabel ?fileExtension
from <https://tdwg.github.io/rs.tdwg.org/cvJson/format.jsonld>
where {
# Limit concepts to current terms in pathway scheme
?concept skos:inScheme acformat:m.
@baskaufs
baskaufs / switch.rq
Created October 6, 2021 21:49
SPARQL query to find non-artwork items whose ACT ID needs to be switched to the artwork.
# work1 has an ACT ID, and is NOT an artwork. work2 is an artwork and may or may not have an ACT ID.
# If work2 does not have an ACT ID, then the ACT ID used with work1 should be transferred to work2 and the work1 ACT ID be deleted.
select distinct ?work1 ?actId1 ?work1Label ?class1Label ?work2 ?actId2 ?work2Label ?class2Label where {
?work1 wdt:P9092 ?actId1.
?work1 wdt:P18 ?commonsImage.
optional {?work1 wdt:P31 ?class1.}
?work2 wdt:P18 ?commonsImage.
?work2 wdt:P31 ?class2.
optional {?work2 wdt:P9092 ?actId2.}
filter(?work1 != ?work2)
@baskaufs
baskaufs / remove.rq
Created October 6, 2021 21:41
SPARQL query for finding ACT IDs to remove from non-artwork
# work1 has an ACT ID, and is an artwork. work2 is NOT an artwork and may or may not have an ACT ID.
# If work2 has an ACT ID, it should be removed. If it doesn't, no action is required.
select distinct ?work1 ?actId1 ?work1Label ?class1Label ?work2 ?actId2 ?work2Label ?class2Label where {
?work1 wdt:P9092 ?actId1.
?work1 wdt:P18 ?commonsImage.
?work1 wdt:P31 ?class1.
?work2 wdt:P18 ?commonsImage.
optional{?work2 wdt:P31 ?class2.}
optional {?work2 wdt:P9092 ?actId2.}
filter(?work1 != ?work2)
@baskaufs
baskaufs / generated_manifest.json
Created April 14, 2021 02:54
IIIF manifest generated by script
{
"@context": [
"http://iiif.io/api/presentation/3/context.json",
"http://www.w3.org/ns.anno.jsonld"
],
"id": "https://iiif.vam.ac.uk/collections/O1023003/manifest.json",
"type": "Manifest",
"viewingDirection": "left-to-right",
"behavior": [
"individuals"
@baskaufs
baskaufs / iiif_2_manifest.json
Created April 13, 2021 22:57
IIIF 2 manifest
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "https://storiiies.cogapp.com/wasp/manifest.json",
"@type": "sc:Manifest",
"label": {
"@value": "Hemipepsis heros – Tarantula Hawk wasp",
"@language": "en"
},
"description": {
"@value": "Introduction",
@baskaufs
baskaufs / test_manifest.json
Created April 13, 2021 20:36
test IIIF manifest
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://iiif.io/api/cookbook/recipe/0001-mvm-image/manifest.json",
"type": "Manifest",
"label": {
"en": [
"Image 1"
]
},
"items": [
@baskaufs
baskaufs / authors.csv
Created March 12, 2021 01:42
Authors table to go with articles table
qid label_en author_uuid author author_series_ordinal author_stated_as author_ref1_hash author_ref1_referenceUrl author_ref1_retrieved_nodeId author_ref1_retrieved_val author_ref1_retrieved_prec
Q105899588 Evaluation of Low Temperature Mortality as a Range-limiting Factor for the Southwestern Corn Borer (Lepidoptera: Crambidae) Q40670042 1 S. J. Baskauf https://doi.org/10.1603/0046-225X-30.2.181 2021-03-11
Q105899588 Evaluation of Low Temperature Mortality as a Range-limiting Factor for the Southwestern Corn Borer (Lepidoptera: Crambidae) Q74442060 2 D. E. McCauley https://doi.org/10.1603/0046-225X-30.2.181 2021-03-11
@baskaufs
baskaufs / articles.csv
Created March 12, 2021 01:26
Test data to be uploaded with new article schema
qid label_en description_en instance_of_uuid instance_of doi_uuid doi doi_ref1_hash doi_ref1_referenceUrl doi_ref1_retrieved_nodeId doi_ref1_retrieved_val doi_ref1_retrieved_prec published_uuid published_nodeId published_val published_prec published_ref1_hash published_ref1_referenceUrl published_ref1_retrieved_nodeId published_ref1_retrieved_val published_ref1_retrieved_prec title_en_uuid title_en title_en_ref1_hash title_en_ref1_referenceUrl title_en_ref1_retrieved_nodeId title_en_ref1_retrieved_val title_en_ref1_retrieved_prec journal_uuid journal journal_ref1_hash journal_ref1_referenceUrl journal_ref1_retrieved_nodeId journal_ref1_retrieved_val journal_ref1_retrieved_prec volume_uuid volume volume_ref1_hash volume_ref1_referenceUrl volume_ref1_retrieved_nodeId volume_ref1_retrieved_val volume_ref1_retrieved_prec page_uuid page page_ref1_hash page_ref1_referenceUrl page_ref1_retrieved_nodeId page_ref1_retrieved_val page_ref1_retrieved_prec issue_uuid issue issue_ref1_hash issue_ref1_referenceUrl issue_ref
@baskaufs
baskaufs / config.json
Last active March 13, 2021 20:15
Configuration file for journal articles
{
"data_path": "",
"item_source_csv": "",
"item_pattern_file": "",
"outfiles": [
{
"manage_descriptions": true,
"label_description_language_list": [
"en"
],