|
| 1 | +@prefix ex: <https://www.bgee.org/sparql/.well-known/sparql-examples/> . |
| 2 | +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
| 3 | +@prefix schema: <https://schema.org/> . |
| 4 | +@prefix sh: <http://www.w3.org/ns/shacl#> . |
| 5 | + |
| 6 | +ex:001 a sh:SPARQLExecutable, |
| 7 | + sh:SPARQLSelectExecutable ; |
| 8 | + rdfs:comment "What are the ROIs which have the word lymph in its annotation"@en ; |
| 9 | + sh:prefixes _:sparql_examples_prefixes ; |
| 10 | + sh:select """PREFIX ns2: <http://www.openmicroscopy.org/rdf/2016-06/ome_core/> |
| 11 | +PREFIX ome: <http://www.openmicroscopy.org/rdf/2016-06/ome_core/> |
| 12 | +PREFIX redcap: <https://population.ahri.org/api/> |
| 13 | +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
| 14 | +PREFIX dc: <http://purl.org/dc/elements/1.1/> |
| 15 | +PREFIX dct: <http://purl.org/dc/terms/> |
| 16 | +SELECT DISTINCT ?redCapId ?redcapRecord ?omeID ?omeRecord ?specimen_source ?imagename ?ROI ?text |
| 17 | +WHERE { |
| 18 | + # --- REDCap records --- |
| 19 | + ?redcapRecord |
| 20 | + rdf:type redcap:record ; |
| 21 | + redcap:specimen_source ?specimen_source ; |
| 22 | + redcap:lab_id ?redCapId . |
| 23 | + BIND( |
| 24 | + URI(CONCAT("https://population.ahri.org/api/", REPLACE(STR(?redCapId), " ", ""))) |
| 25 | + AS ?redcapConstructedURI |
| 26 | + ) |
| 27 | +# VALUES ?specimen_source {"5"} # restrict to IALCH Forensic Pathology |
| 28 | + # --- OME records --- |
| 29 | + ?omeRecord ome:Map ?map ; |
| 30 | + dct:isPartOf ?image |
| 31 | + . |
| 32 | + ?map |
| 33 | + ome:Key "lab_id_main" ; |
| 34 | + ome:Value ?omeID . |
| 35 | + BIND( |
| 36 | + URI(CONCAT("https://population.ahri.org/api/", STR(?omeID))) |
| 37 | + AS ?omeConstructedURI |
| 38 | + ) |
| 39 | + . ?image dct:hasPart ?pixels ; ome:Name ?imagename |
| 40 | + . ?pixels rdf:type <http://www.openmicroscopy.org/Schemas/OME/2016-06#Pixels> |
| 41 | + ; dct:hasPart ?ROI . |
| 42 | + ?ROI rdf:type <http://www.openmicroscopy.org/Schemas/OME/2016-06#ROI> ; |
| 43 | + ome:shapes ?shapes . |
| 44 | + ?shapes ome:Text ?text |
| 45 | +# VALUES ?text{'lymph node'} . |
| 46 | + FILTER REGEX(?text, 'lymph', 'i') |
| 47 | +# . ?roi dct:isPartOf ?pixels; rdf:type <http://www.openmicroscopy.org/Schemas/OME/2016-06#ROI> |
| 48 | +
|
| 49 | + # --- Match records by constructed URI --- |
| 50 | + FILTER(?redcapConstructedURI = ?omeConstructedURI) |
| 51 | +}""" ; |
| 52 | + schema:target <http://localhost:7200/sparql/> . |
0 commit comments