Skip to content

Commit

Permalink
Merge pull request #290 from zazuko/observation-sample
Browse files Browse the repository at this point in the history
include observation sample in fetch-metadata
  • Loading branch information
giacomociti authored Apr 17, 2024
2 parents 7cfceee + 13a297f commit 730c0f1
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gold-tables-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"barnard59-cube": patch
---

Include a sample observation in fetch-metadata
6 changes: 5 additions & 1 deletion packages/cube/pipeline/fetch-metadata.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
code:imports <./query-constraint> ;
code:extension "ttl" ;
] .
[
code:imports <./query-observation-sample> ;
code:extension "ttl" ;
] .

_:endpoint a p:Variable ;
p:name "endpoint" ;
Expand All @@ -30,7 +34,7 @@ _:cube a p:Variable ;
[
p:stepList
(
[ base:concat\/object (:queryCube :queryConstraint) ]
[ base:concat\/object (:queryCube :queryConstraint :queryObservationSample) ]
[ ntriples:serialize () ]
)
]
Expand Down
37 changes: 37 additions & 0 deletions packages/cube/pipeline/query-observation-sample.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@prefix code: <https://code.described.at/> .
@prefix p: <https://pipeline.described.at/> .
@prefix sparql: <https://barnard59.zazuko.com/operations/sparql/> .
@prefix : <http://barnard59.zazuko.com/pipeline/cube-validation/> .

:queryObservationSample a p:Pipeline, p:ReadableObjectMode ;
p:steps
[
p:stepList
(
[
sparql:construct
[ code:name "endpoint"; code:value "endpoint"^^p:VariableName ] ,
[
code:name "query";
code:value """
PREFIX cube: <https://cube.link/>
CONSTRUCT {
<${cube}> cube:observationSet ?set .
?set cube:observation ?obs .
?obs ?p ?o .
}
WHERE {
{ SELECT ?set ?obs WHERE {
<${cube}> cube:observationSet ?set .
?set cube:observation ?obs .
} LIMIT 1
}
?obs ?p ?o
}
"""^^code:EcmaScriptTemplateLiteral
]
]
)
]
.

0 comments on commit 730c0f1

Please sign in to comment.