Skip to content

Commit adb6642

Browse files
committed
Adds new sample queries, each in its own file
1 parent 1b21fb5 commit adb6642

File tree

8 files changed

+102
-27
lines changed

8 files changed

+102
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ The web-UI will then (probably) be available at:
5757

5858
<http://localhost:3030/#/dataset/okh/query>
5959

60-
You can now try your first [sample query](res/sample-query.txt)
60+
You can now try your first [sample query](res/sample-queries/list-projects.sparql)
6161
on the OKH data.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: 2025 Robin Vobruba <[email protected]>
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
6+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
7+
PREFIX ods: <http://w3id.org/oseg/ont/ods#>
8+
PREFIX okh: <http://w3id.org/oseg/ont/okh#>
9+
PREFIX otrl: <http://purl.org/oseg/ontologies/OTRL#>
10+
11+
# Count all projects (aka modules)
12+
SELECT (COUNT(*) AS ?count)
13+
WHERE {
14+
?proj a okh:Module
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2025 Robin Vobruba <[email protected]>
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
6+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
7+
PREFIX ods: <http://w3id.org/oseg/ont/ods#>
8+
PREFIX okh: <http://w3id.org/oseg/ont/okh#>
9+
PREFIX otrl: <http://purl.org/oseg/ontologies/OTRL#>
10+
11+
# First 100 projects with "bambulab" (case-insensitive)
12+
# in their name
13+
SELECT distinct ?proj ?label
14+
WHERE {
15+
?proj a okh:Module .
16+
?proj okh:name ?label .
17+
FILTER (CONTAINS(lcase(str(?label)), "bambulab"))
18+
}
19+
LIMIT 100
Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,17 @@
44

55
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
66
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
7-
#PREFIX bd: <http://www.bigdata.com/rdf#>
87
PREFIX ods: <http://w3id.org/oseg/ont/ods#>
98
PREFIX okh: <http://w3id.org/oseg/ont/okh#>
109
PREFIX otrl: <http://purl.org/oseg/ontologies/OTRL#>
11-
PREFIX wf: <https://wikifactory.com/>
12-
PREFIX ap: <https://www.appropedia.org/>
13-
PREFIX wfs: <https://wikifactory.com/@shirako/>
1410
PREFIX loshdummymosha: <https://github.com/OPEN-NEXT/LOSH-dummy-MOSH-A/1.0.0#>
1511
PREFIX ohloom: <https://gitlab.com/OSEGermany/ohloom/1.0.0#>
1612

17-
# All triples
18-
#SELECT ?subject ?predicate ?object
19-
#WHERE {
20-
# ?subject ?predicate ?object
21-
#}
22-
23-
# All Projects type triples
24-
#SELECT ?subject ?predicate ?object
25-
#WHERE {
26-
# ?subject rdf:type okh:Module
27-
#}
28-
2913
# All Projects names and their licenses
30-
#SELECT ?name ?license
31-
#WHERE {
32-
# ?subject rdf:type okh:Module ;
33-
# rdfs:label ?name ;
34-
# ods:license ?license
35-
#}
36-
37-
SELECT (COUNT(*) AS ?count)
14+
SELECT ?name ?license
3815
WHERE {
39-
?proj a okh:Module
16+
?subject rdf:type okh:Module ;
17+
rdfs:label ?name ;
18+
ods:license ?license
4019
}
20+
LIMIT 100
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: 2025 Robin Vobruba <[email protected]>
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
PREFIX ods: <http://w3id.org/oseg/ont/ods#>
6+
PREFIX okh: <http://w3id.org/oseg/ont/okh#>
7+
PREFIX owl: <http://www.w3.org/2002/07/owl#>
8+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
9+
PREFIX otrl: <http://w3id.org/oseg/ont/otrl#>
10+
PREFIX spdxt: <http://spdx.org/rdf/terms#>
11+
PREFIX ap: <https://www.appropedia.org/>
12+
13+
# All (direct) triples of a project (aka module)
14+
SELECT ?pred ?obj
15+
WHERE {
16+
<https://www.appropedia.org/40/Bamboo_demonstration_motor/project> ?pred ?obj
17+
}
18+
LIMIT 100
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: 2025 Robin Vobruba <[email protected]>
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
PREFIX ods: <http://w3id.org/oseg/ont/ods#>
6+
PREFIX okh: <http://w3id.org/oseg/ont/okh#>
7+
PREFIX owl: <http://www.w3.org/2002/07/owl#>
8+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
9+
PREFIX otrl: <http://w3id.org/oseg/ont/otrl#>
10+
PREFIX spdxt: <http://spdx.org/rdf/terms#>
11+
12+
SELECT ?license
13+
WHERE {
14+
?subj a okh:Module .
15+
?subj ods:license ?license
16+
}
17+
GROUP BY ?license
18+
LIMIT 100
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-FileCopyrightText: 2025 Robin Vobruba <[email protected]>
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
PREFIX ods: <http://w3id.org/oseg/ont/ods#>
6+
PREFIX okh: <http://w3id.org/oseg/ont/okh#>
7+
PREFIX owl: <http://www.w3.org/2002/07/owl#>
8+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
9+
PREFIX otrl: <http://w3id.org/oseg/ont/otrl#>
10+
PREFIX spdxt: <http://spdx.org/rdf/terms#>
11+
12+
# All projects with a specific license
13+
SELECT ?subj ?name ?license
14+
WHERE {
15+
?subj a okh:Module .
16+
?subj okh:name ?name .
17+
?subj ods:license ?license .
18+
?subj ods:license spdxt:CC-BY-SA-3.0
19+
#?subj ods:license spdxt:CC-BY-SA-4.0
20+
#?subj ods:license spdxt:GPL-3.0-or-later
21+
#?subj ods:license spdxt:Unlicense
22+
#?subj ods:license spdxt:CC0-1.0
23+
#?subj ods:license spdxt:Apache-2.0
24+
}
25+
LIMIT 100

run/fill-db

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ echo
308308
echo "for example:"
309309
echo "$jena_db_data_querier \\"
310310
echo " --loc \"$db_dir\" \\"
311-
echo " --query \"$res_dir/sample-query.txt\""
311+
echo " --query \"$res_dir/sample-queries/list-projects.sparql\""
312312
echo
313313
echo "Or start the Web interface for running SPARQL queries with:"
314314
echo "run/web-ui"

0 commit comments

Comments
 (0)