Skip to content

Commit a4ec6d7

Browse files
committed
add sparql query for cq10
1 parent ee1cf12 commit a4ec6d7

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

docs/sparql/cq10.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""\
2+
This script contains the SPARQL query for Competency Question 10 "What is the
3+
script used to wrap up a software component?". In the discussion on
4+
https://github.com/ResearchObject/workflow-run-crate/issues/18 we realized
5+
that we were already representing the wrappers, and the issue was actually to
6+
represent their dependencies. The corresponding specification was added to the
7+
profiles in https://github.com/ResearchObject/workflow-run-crate/pull/67.
8+
"""
9+
10+
import rdflib
11+
from pathlib import Path
12+
13+
CRATE = Path("crate")
14+
15+
g = rdflib.Graph()
16+
g.parse(CRATE/"ro-crate-metadata.json")
17+
18+
QUERY = """\
19+
PREFIX s: <http://schema.org/>
20+
21+
SELECT ?tool ?req ?main_req ?version
22+
WHERE {
23+
?tool a s:SoftwareApplication .
24+
?action a s:CreateAction .
25+
?action s:instrument ?tool .
26+
?tool s:softwareRequirements ?req .
27+
?tool s:mainEntity ?main_req .
28+
?req s:version ?version .
29+
}
30+
"""
31+
32+
qres = g.query(QUERY)
33+
for row in qres:
34+
print(f"Tool: {row.tool}")
35+
print(f" main requirement: {row.main_req}")
36+
print(f" requirement: {row.req}")
37+
print(f" version: {row.version}")

docs/sparql/crate/ro-crate-metadata.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,17 @@
521521
"SoftwareApplication",
522522
"File"
523523
],
524+
"softwareRequirements": [
525+
{
526+
"@id": "scripts/classify_tumor.py"
527+
},
528+
{
529+
"@id": "https://pypi.org/project/numpy/1.26.2/"
530+
}
531+
],
532+
"mainEntity": {
533+
"@id": "scripts/classify_tumor.py"
534+
},
524535
"input": [
525536
{
526537
"@id": "classify_tumor.cwl#batch-size"
@@ -555,6 +566,17 @@
555566
],
556567
"sha1": "0f504b9b002b943ca3e564af1d3f9297ca637317"
557568
},
569+
{
570+
"@id": "scripts/classify_tumor.py",
571+
"@type": "SoftwareApplication",
572+
"version": "0.1"
573+
},
574+
{
575+
"@id": "https://pypi.org/project/numpy/1.26.2/",
576+
"@type": "SoftwareApplication",
577+
"name": "NumPy",
578+
"version": "1.26.2"
579+
},
558580
{
559581
"@id": "predictions.cwl#extract-tissue-low",
560582
"@type": "HowToStep",

0 commit comments

Comments
 (0)