|
1 |
| -PREFIX allores: <http://purl.allotrope.org/ontologies/result#> |
2 |
| -PREFIX cat: <http://example.org/catplus/ontology/> |
3 |
| -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
| 1 | +PREFIX res: <http://dbpedia.org/resource/> |
| 2 | +PREFIX allo-res: <http://purl.allotrope.org/ontologies/result#> |
4 | 3 | PREFIX schema: <https://schema.org/>
|
5 |
| - |
| 4 | +PREFIX cat: <http://example.org/catplus/ontology/> |
| 5 | +PREFIX purl: <http://purl.allotrope.org/ontologies/> |
6 | 6 | SELECT
|
7 |
| - ?contentUrl |
8 |
| - ?reactionType |
9 |
| - ?chemicalName |
| 7 | +?contenturl ?deviceTypes ?chemicals ?peakIdentifiers |
| 8 | +WHERE { |
| 9 | + FILTER( |
| 10 | + CONTAINS(?chemicalNames, "Styrene") && CONTAINS(?chemicalNames, "methanol") |
| 11 | + && |
| 12 | +CONTAINS(?casNumbers, "1") && CONTAINS(?casNumbers, "73") |
| 13 | +&& |
| 14 | + CONTAINS(?smiless, "O") && CONTAINS(?smiless, "OC") |
| 15 | + && |
| 16 | + CONTAINS(?deviceTypes, "Oven") |
| 17 | + ) |
| 18 | +{ |
| 19 | +SELECT DISTINCT |
| 20 | +?contenturl |
| 21 | +?deviceTypes |
| 22 | +(GROUP_CONCAT(DISTINCT CONCAT(?chemicalName); separator=" | ") AS ?chemicalNames) |
| 23 | +(GROUP_CONCAT(DISTINCT CONCAT(?casNumber); separator=" | ") AS ?casNumbers) |
| 24 | +(GROUP_CONCAT(DISTINCT CONCAT(?smiles); separator=" | ") AS ?smiless) |
| 25 | +(GROUP_CONCAT(DISTINCT CONCAT(?chemicalName, " [", ?casNumber, "] <", ?smiles, ">"); separator=" | ") AS ?chemicals) |
| 26 | +?peakIdentifiers |
10 | 27 | WHERE {
|
11 |
| - ?s schema:contentUrl ?contentUrl . |
12 |
| - ?s cat:hasBatch ?batch . |
13 |
| - {?s cat:hasChemical ?chemical . ?s a cat:Campaign} |
14 |
| - UNION {?action cat:hasBatch ?batch . ?action cat:hasSample* ?sample . ?sample cat:hasChemical ?chemical .} |
15 |
| - ?batch cat:reactionType ?reactionType . |
16 |
| - ?chemical allores:AFR_0002292 ?chemicalName . |
| 28 | + # Step 1: Pagination of contenturl |
| 29 | + { |
| 30 | + SELECT DISTINCT ?contenturl |
| 31 | + WHERE { |
| 32 | + ?LiquidChromatographyAggregateDocument schema:contentUrl ?contenturl . |
| 33 | + ?LiquidChromatographyAggregateDocument a allo-res:AFR_0002524 . |
| 34 | + } |
| 35 | + ORDER BY ?contenturl |
| 36 | + LIMIT 10 |
| 37 | + OFFSET 0 |
| 38 | + } |
| 39 | + # Step 2: Get deviceType per contenturl |
17 | 40 | {
|
18 |
| - SELECT DISTINCT ?s WHERE { |
19 |
| - ?batch cat:reactionType ?reactionType . |
20 |
| - ?s rdf:type cat:Campaign . |
21 |
| - ?s cat:hasBatch ?batch . |
22 |
| - {?s cat:hasChemical ?chemical . ?s a cat:Campaign} |
23 |
| - UNION {?action cat:hasBatch ?batch . ?action cat:hasSample* ?sample . ?sample cat:hasChemical ?chemical .} |
24 |
| - ?s schema:contentUrl ?contentUrl . |
25 |
| - FILTER (?reactionType IN ('N-methylation')) |
26 |
| - } |
27 |
| - ORDER BY ASC(?contentUrl) |
28 |
| - LIMIT 3 |
29 |
| - OFFSET 0 |
| 41 | + SELECT ?contenturl (GROUP_CONCAT(DISTINCT ?deviceType; separator=", ") AS ?deviceTypes ) |
| 42 | + WHERE { |
| 43 | + ?LiquidChromatographyAggregateDocument schema:contentUrl ?contenturl ; |
| 44 | + allo-res:AFR_0002526 ?DeviceSystemDocument ; |
| 45 | + cat:hasLiquidChromatography/allo-res:AFR_0002374 ?MeasurementAggregateDocument . |
| 46 | + ?DeviceSystemDocument a cat:DeviceSystemDocument ; |
| 47 | + allo-res:AFR_0002722/allo-res:AFR_0002568 ?deviceType . |
| 48 | + ?MeasurementAggregateDocument allo-res:AFR_0002083 ?SampleDocument . |
| 49 | + ?SampleDocument cat:hasProduct ?product . |
| 50 | + ?synthAddAction cat:producesProduct ?product ; |
| 51 | + cat:hasBatch ?batch . |
| 52 | + ?batch cat:reactionType ?reactionType ; |
| 53 | + cat:reactionName ?reactionName . |
| 54 | + FILTER(CONTAINS(?reactionType, "N-methylation")) |
| 55 | + FILTER(CONTAINS(?reactionName, "Caffeine synthesis")) |
| 56 | + } |
| 57 | + GROUP BY ?contenturl |
| 58 | + |
| 59 | + } |
| 60 | + # Step 3: Chemical info coming from campaigns and samples |
| 61 | + { |
| 62 | + SELECT ?contenturl ?chemical ?casNumber ?smiles ?chemicalName |
| 63 | + WHERE { |
| 64 | + ?LiquidChromatographyAggregateDocument schema:contentUrl ?contenturl ; |
| 65 | + cat:hasLiquidChromatography/allo-res:AFR_0002374 ?MeasurementAggregateDocument . |
| 66 | + ?MeasurementAggregateDocument allo-res:AFR_0002083 ?SampleDocument . |
| 67 | + ?SampleDocument cat:hasProduct ?product . |
| 68 | + ?synthaddaction cat:producesProduct ?product . |
| 69 | + ?synthaddaction cat:hasBatch ?batch . |
| 70 | + ?campaign cat:hasBatch ?batch . |
| 71 | + {?synthaddaction cat:hasSample+ ?sample . |
| 72 | + ?sample cat:hasChemical ?chemical . |
| 73 | + } |
| 74 | + UNION { |
| 75 | + ?campaign cat:hasChemical ?chemical . |
| 76 | + } |
| 77 | + ?campaign schema:name ?campaignName . |
| 78 | + FILTER(CONTAINS(?campaignName, "Caffeine Synthesis")) |
| 79 | + |
| 80 | + ?chemical |
| 81 | + allo-res:AFR_0002292 ?chemicalName ; |
| 82 | + cat:casNumber ?casNumber ; |
| 83 | + allo-res:AFR_0002295 ?smiles . |
| 84 | + } |
| 85 | + GROUP BY ?contenturl ?chemical ?casNumber ?smiles ?chemicalName |
| 86 | + } |
| 87 | + # Step 4: Peak Identifiers |
| 88 | + { |
| 89 | + SELECT ?contenturl (GROUP_CONCAT(DISTINCT ?peakIdentifier; separator=", ") AS ?peakIdentifiers) |
| 90 | + WHERE { |
| 91 | + ?LiquidChromatographyAggregateDocument schema:contentUrl ?contenturl ; |
| 92 | + cat:hasLiquidChromatography/allo-res:AFR_0002374 ?MeasurementAggregateDocument . |
| 93 | + ?MeasurementAggregateDocument allo-res:AFR_0002659/allo-res:AFR_0000432/cat:peak/allo-res:AFR_0001164 ?peakIdentifier . |
30 | 94 | }
|
| 95 | + GROUP BY ?contenturl |
| 96 | + } |
31 | 97 | }
|
32 |
| -GROUP BY ?contentUrl ?reactionType ?chemicalName |
33 |
| -ORDER BY ASC(?contentUrl) |
| 98 | +GROUP BY ?contenturl ?deviceTypes ?peakIdentifiers |
| 99 | +}} |
| 100 | +ORDER BY ASC(?contenturl) |
0 commit comments