-
Notifications
You must be signed in to change notification settings - Fork 7
OpenBiodiv SPARQL Queries
mdmtrv edited this page Dec 22, 2020
·
2 revisions
Person (http://xmlns.com/foaf/0.1/Person)
PREFIX : <http://openbiodiv.net/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT {
?person :fullName ?full_name ;
:firstName ?first_name ;
:lastName ?last_name ;
:affiliation ?institution ;
:email ?email .
}
WHERE {
BIND ( URI("http://example.com/7a247614-878b-4d01-ab97-bf5fc608dc86") as ?person )
?person rdfs:label ?full_name .
OPTIONAL { ?person :affiliation ?institution . }
OPTIONAL { ?person foaf:mbox ?email . }
OPTIONAL { ?person foaf:firstName ?first_name . }
OPTIONAL { ?person foaf:surname ?last_name . }
}
PREFIX : <http://openbiodiv.net/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
PREFIX prism: <http://prismstandard.org/namespaces/basic/2.0/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?paper prism:publicationDate ?publication_date .
?paper dc:title ?articleTitle .
}
WHERE {
BIND ( URI("http://example.com/7a247614-878b-4d01-ab97-bf5fc608dc86") as ?person )
?paper dcterms:creator ?person ;
rdf:type fabio:ResearchPaper.
?article frbr:realizationOf ?paper .
?article dc:title ?articleTitle .
OPTIONAL { ?article prism:publicationDate ?publication_date . }
}
PREFIX : <http://openbiodiv.net/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
PREFIX prism: <http://prismstandard.org/namespaces/basic/2.0/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?collaborator :collaborated_on_paper ?paper ;
:name ?name .
}
WHERE {
BIND ( URI("http://example.com/7a247614-878b-4d01-ab97-bf5fc608dc86") as ?person )
?paper dcterms:creator ?person ;
dcterms:creator ?collaborator ;
rdf:type fabio:ResearchPaper.
?collaborator rdfs:label ?name .
FILTER( ?person != ?collaborator )
FILTER NOT EXISTS { ?person owl:sameAs ?collaborator .}
}
Taxonomic Concept (http://openbiodiv.net/TaxonomicConceptLabel, http://openbiodiv.net/LatinName, http://openbiodiv.net/TaxonomicName)
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dwc: <http://rs.tdwg.org/dwc/terms/>
PREFIX : <http://openbiodiv.net/>
PREFIX dwciri: <http://rs.tdwg.org/dwc/iri/>
CONSTRUCT
{
?name rdfs:label ?name_string.
?name rdf:type ?class.
?name dwc:verbatimTaxonRank ?verbatim_rank.
?name dwc:taxonomicRank ?rank.
?name dwc:scientificNameAuthorship ?author.
?name dwc:genus ?genus.
?name dwc:subgenus ?subgenus.
?name dwc:specificEpithet ?species.
?name dwc:infraSpecificEpithet ?subspecies.
?name dwc:order ?order.
?name dwc:family ?family.
?name :nameAccordingToId ?sec.
}
WHERE {
BIND(URI("http://example.com/7a247614-878b-4d01-ab97-bf5fc608dc86") as ?name )
{
?name rdfs:label ?name_string.
?name rdf:type ?class.
}
UNION {
?name dwc:verbatimTaxonRank ?verbatim_rank.
}
UNION {
?name dwciri:taxonRank ?rank .
}
UNION {
?name dwciri:scientificNameAuthorship ?author .
}
UNION {
?name dwc:genus ?genus.
}
UNION {
?name dwc:subgenus ?subgenus.
}
UNION {
?name dwc:specificEpithet ?species.
}
UNION {
?name dwc:infraSpecificEpithet ?subspecies.
}
UNION {
?name dwc:order ?order.
}
UNION {
?name dwc:family ?family.
}
UNION {
?name :nameAccordingToId ?sec.
}
}
PREFIX po: <http://www.essepuntato.it/2008/12/pattern#>
PREFIX pkm: <http://proton.semanticweb.org/protonkm#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?tnu (group_concat(?class) as ?classes)
WHERE {
BIND(URI("http://example.com/7a247614-878b-4d01-ab97-bf5fc608dc86") as ?name)
?tnu pkm:mentions ?name.
?component po:contains ?tnu.
?component rdf:type ?class.
} GROUP BY ?tnu
PREFIX : <http://openbiodiv.net/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
CONSTRUCT {
?name :relatedName ?name2.
?name2 rdfs:label ?label.
}
WHERE {
BIND(URI("http://example.com/7a247614-878b-4d01-ab97-bf5fc608dc86") as ?name)
?name :relatedName ?name2.
?name2 rdfs:label ?label .
FILTER (?name != ?name2)
FILTER NOT EXISTS {?name owl:sameAs ?name2}
}
Research Paper (http://purl.org/spar/fabio/ResearchPaper)
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prism: <http://prismstandard.org/namespaces/basic/2.0/>
SELECT (SAMPLE(?name) AS ?authors_string) (SAMPLE(?publication_date) AS ?publication_date) (SAMPLE(?publisher) AS ?publisher) (SAMPLE(?doi) AS ?doi) (SAMPLE(?title) AS ?title)
WHERE {
{
SELECT ?article (GROUP_CONCAT(?name; separator = " and ") AS ?name)
WHERE {
<http://example.com/7a247614-878b-4d01-ab97-bf5fc608dc86> frbr:realization ?article ;
dc:creator ?author .
?author rdfs:label ?name.
} GROUP BY ?article
}
?article prism:publicationDate ?publication_date ;
prism:doi ?doi;
dc:title ?title.
optional {?article dc:publisher ?publisher .}
} GROUP BY ?article
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://openbiodiv.net/>
SELECT (MAX(?name) AS ?NAME) ?author_id
WHERE {
<http://example.com/7a247614-878b-4d01-ab97-bf5fc608dc86> dc:creator ?author_id .
?author_id rdfs:label ?name .
} GROUP BY(?author_id)
PREFIX pkm: <http://proton.semanticweb.org/protonkm#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://openbiodiv.net/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
PREFIX po: <http://www.essepuntato.it/2008/12/pattern#>
SELECT ?taxonomic_name (SAMPLE(?taxonomic_name_id) AS ?taxonomic_name_id)
WHERE {
<http://example.com/7a247614-878b-4d01-ab97-bf5fc608dc86> frbr:realization ?article .
?article po:contains ?tnu .
?tnu pkm:mentions ?taxonomic_name_id .
?taxonomic_name_id rdfs:label ?taxonomic_name .
} GROUP BY ?taxonomic_name