Skip to content

Commit a1a28dc

Browse files
authored
Merge pull request #69 from KNowledgeOnWebScale/EDC_active
fixed link-traversal example queries and small login error
2 parents 3a73594 + 0c894aa commit a1a28dc

14 files changed

Lines changed: 481 additions & 195 deletions
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Datasources: https://sparql.rhea-db.org/sparql https://sparql.uniprot.org/sparql/
2+
PREFIX rh: <http://rdf.rhea-db.org/>
3+
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
4+
PREFIX up: <http://purl.uniprot.org/core/>
5+
# Query 13
6+
# Select all Rhea reactions used to annotate Escherichia coli (taxid=83333) in UniProtKB/Swiss-Prot
7+
# return the number of UniProtKB entries
8+
SELECT ?uniprot ?mnemo ?rhea ?accession ?equation
9+
WHERE {
10+
{
11+
VALUES (?taxid) { (taxon:83333) }
12+
GRAPH <http://sparql.uniprot.org/uniprot> {
13+
?uniprot up:reviewed true .
14+
?uniprot up:mnemonic ?mnemo .
15+
?uniprot up:organism ?taxid .
16+
?uniprot up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea .
17+
}
18+
}
19+
?rhea rh:accession ?accession .
20+
?rhea rh:equation ?equation .
21+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Datasources: https://solidbench.linkeddatafragments.org/pods/00000000000000000933/profile/card
2+
# QueryMode: solid-link-traversal
3+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
4+
PREFIX snvoc: <https://solidbench.linkeddatafragments.org/www.ldbc.eu/ldbc_socialnet/1.0/vocabulary/>
5+
SELECT ?messageId ?messageCreationDate ?messageContent WHERE {
6+
?message snvoc:hasCreator <https://solidbench.linkeddatafragments.org/pods/00000000000000000933/profile/card#me>;
7+
rdf:type snvoc:Post;
8+
snvoc:content ?messageContent;
9+
snvoc:creationDate ?messageCreationDate;
10+
snvoc:id ?messageId.
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Datasources: https://solidbench.linkeddatafragments.org/pods/00000015393162789111/posts
2+
# QueryMode: solid-link-traversal
3+
PREFIX snvoc: <https://solidbench.linkeddatafragments.org/www.ldbc.eu/ldbc_socialnet/1.0/vocabulary/>
4+
SELECT ?personId ?firstName ?lastName WHERE {
5+
<https://solidbench.linkeddatafragments.org/pods/00000015393162789111/posts#893353506423> snvoc:id ?messageId;
6+
snvoc:hasCreator ?creator.
7+
?creator snvoc:id ?personId;
8+
snvoc:firstName ?firstName;
9+
snvoc:lastName ?lastName.
10+
}

demonstrator/solid-link-traversal-foaf-knows.rq

Lines changed: 0 additions & 10 deletions
This file was deleted.

demonstrator/solid-link-traversal-see-also.rq

Lines changed: 0 additions & 9 deletions
This file was deleted.

demonstrator/solid-no-traversal-basic-select.rq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Datasources: https://triple.ilabt.imec.be/test/bio-usecase/nbn-chist-era-annex-1-chemicals-custom-predicate.ttl
1+
# Datasources: https://triple.ilabt.imec.be/test/
22
# QueryMode: solid-no-traversal
33
SELECT ?s ?p ?o
44
WHERE {

demonstrator/triple-solid-2.rq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Datasources: http://localhost:3000/test/random/nbn-chist-era-annex-1-chemicals-custom-predicate.ttl
1+
# Datasources: https://triple.ilabt.imec.be/test/bio-usecase/nbn-chist-era-annex-1-chemicals-custom-predicate.ttl
22
# QueryMode: solid-no-traversal
33
PREFIX thd: <urn:triple-hybrid-demo:>
44
SELECT DISTINCT ?CAS WHERE {

src/components/DataQuery.vue

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,23 @@ export default {
22452245
isLikelySolidOrRdfSource(source: string) {
22462246
return !this.isLikelySparqlEndpointSource(source);
22472247
},
2248+
/**
2249+
* Infers query mode from canonical example filename prefixes so the sample
2250+
* picker remains stable even when files omit explicit # QueryMode metadata.
2251+
*/
2252+
inferModeFromExampleId(exampleId: string): QueryExecutionMode | null {
2253+
const normalizedId = exampleId.toLowerCase();
2254+
if (
2255+
normalizedId.startsWith("link-traversal-") ||
2256+
normalizedId.startsWith("link-taversal-")
2257+
) {
2258+
return "solid-link-traversal";
2259+
}
2260+
if (normalizedId.startsWith("solid-no-traversal-")) {
2261+
return "solid-no-traversal";
2262+
}
2263+
return null;
2264+
},
22482265
/**
22492266
* Determines the target query engine mode for an example query. Authors can
22502267
* explicitly pin a mode via `# QueryMode: <mode-id>` in the .rq file.
@@ -2253,6 +2270,7 @@ export default {
22532270
_queryText: string,
22542271
sources: string[],
22552272
declaredMode?: string,
2273+
exampleId?: string,
22562274
): QueryExecutionMode {
22572275
if (
22582276
declaredMode &&
@@ -2261,6 +2279,13 @@ export default {
22612279
return declaredMode as QueryExecutionMode;
22622280
}
22632281
2282+
if (exampleId) {
2283+
const modeFromName = this.inferModeFromExampleId(exampleId);
2284+
if (modeFromName) {
2285+
return modeFromName;
2286+
}
2287+
}
2288+
22642289
const endpointSourceCount = sources.filter((source) =>
22652290
this.isLikelySparqlEndpointSource(source),
22662291
).length;
@@ -2283,6 +2308,7 @@ export default {
22832308
queryText: string,
22842309
sources: string[],
22852310
mode: QueryExecutionMode,
2311+
exampleId?: string,
22862312
): ExampleQueryCategory {
22872313
if (mode === "solid-link-traversal") {
22882314
return "Solid query (link traversal)";
@@ -2291,13 +2317,32 @@ export default {
22912317
return "Solid query (no traversal)";
22922318
}
22932319
2320+
const normalizedId = (exampleId || "").toLowerCase();
2321+
if (normalizedId.startsWith("federated-")) {
2322+
return "Federated query";
2323+
}
2324+
22942325
const hasServiceClause = /service\s*<[^>]+>/i.test(queryText);
22952326
const endpointSourceCount = sources.filter((source) =>
22962327
this.isLikelySparqlEndpointSource(source),
22972328
).length;
2329+
const endpointHosts = new Set(
2330+
sources
2331+
.filter((source) => this.isLikelySparqlEndpointSource(source))
2332+
.map((source) => this.normalizeSourceUrlForValidation(source))
2333+
.map((source) => {
2334+
try {
2335+
return new URL(source).host;
2336+
} catch {
2337+
return "";
2338+
}
2339+
})
2340+
.filter((host) => host.length > 0),
2341+
);
22982342
22992343
if (
23002344
hasServiceClause ||
2345+
endpointHosts.size > 1 ||
23012346
endpointSourceCount > 1 ||
23022347
(endpointSourceCount === 1 && sources.length > 1)
23032348
) {
@@ -2576,8 +2621,14 @@ export default {
25762621
query,
25772622
sources,
25782623
declaredMode,
2624+
rawName,
2625+
);
2626+
const category = this.categorizeExampleQuery(
2627+
query,
2628+
sources,
2629+
mode,
2630+
rawName,
25792631
);
2580-
const category = this.categorizeExampleQuery(query, sources, mode);
25812632
queries.push({
25822633
id: rawName,
25832634
name,
@@ -2604,8 +2655,10 @@ export default {
26042655
);
26052656
if (!example) return;
26062657
2607-
// Clone example sources so user edits never mutate the static sample list.
2608-
this.currentQuery.sources = [...example.sources];
2658+
// Link-traversal examples intentionally start with no explicit datasource.
2659+
// Comunica can derive traversal seeds from IRIs that appear in the query.
2660+
this.currentQuery.sources =
2661+
example.mode === "solid-link-traversal" ? [] : [...example.sources];
26092662
this.currentQuery.query = example.query || "";
26102663
this.queryMode = example.mode;
26112664
this.syncYasqeFromExternalQuery(this.currentQuery.query, {

src/components/Guides/DataQueryGuide.vue

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@
5252
Targets multiple SPARQL endpoints in one execution (commonly via SERVICE clauses).
5353
</li>
5454
<li>
55-
<span class="guide-tag">Solid query</span>
56-
Targets RDF resources from a Solid pod or local server.
55+
<span class="guide-tag">Solid query (no traversal)</span>
56+
Targets explicit Solid RDF resources/containers without discovering linked documents.
5757
</li>
5858
<li>
59-
<span class="guide-tag">Mixed source federated query</span>
60-
Targets both Solid pod sources and SPARQL endpoint sources.
59+
<span class="guide-tag">Solid query (link traversal)</span>
60+
Starts from Solid seed URLs and discovers additional RDF documents by following links.
6161
</li>
6262
</ul>
6363
</section>
@@ -70,6 +70,22 @@
7070
<span class="guide-control">baseline-test</span>
7171
Quick concept-check query on the Rhea endpoint that returns a small set of predicate IRIs.
7272
</li>
73+
<li>
74+
<span class="guide-control">federated-automated-rhea-13</span>
75+
Federates UniProt and Rhea to list E. coli-reviewed proteins and associated reactions.
76+
</li>
77+
<li>
78+
<span class="guide-control">federated-uniprot-rhea-human-reactions</span>
79+
Fetches human proteins in UniProt and joins to reaction labels from Rhea.
80+
</li>
81+
<li>
82+
<span class="guide-control">federated-wikidata-uniprot-human-proteins</span>
83+
Uses Wikidata + UniProt federation to enrich proteins with mnemonics.
84+
</li>
85+
<li>
86+
<span class="guide-control">federated-wikidata-cities</span>
87+
Single-endpoint Wikidata city query with label service for readable output.
88+
</li>
7389
<li>
7490
<span class="guide-control">triple-wikidata-1</span>
7591
Aggregates toxicity-related compound data in Wikidata and ranks by average LD50.
@@ -95,8 +111,20 @@
95111
Retrieves OMA ortholog protein links and organism names for a selected UniProt protein.
96112
</li>
97113
<li>
98-
<span class="guide-control">triple-combined-service</span>
99-
Full mixed-source federated workflow that chains Solid/local CAS data, IDSM similarity search, and Rhea reactions.
114+
<span class="guide-control">solid-no-traversal-basic-select</span>
115+
Reads triples directly from a selected Solid container without traversal.
116+
</li>
117+
<li>
118+
<span class="guide-control">solid-no-traversal-literal-preview</span>
119+
Extracts literal values from a specific Solid RDF document.
120+
</li>
121+
<li>
122+
<span class="guide-control">link-traversal-solidbench-1</span>
123+
SolidBench link-traversal query that starts at a profile seed and discovers related posts.
124+
</li>
125+
<li>
126+
<span class="guide-control">link-traversal-solidbench-2</span>
127+
SolidBench link-traversal query that resolves creator details from a message seed URL.
100128
</li>
101129
</ul>
102130
</section>

0 commit comments

Comments
 (0)