Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions demonstrator/federated-automated-rhea-13.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Datasources: https://sparql.rhea-db.org/sparql https://sparql.uniprot.org/sparql/
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX up: <http://purl.uniprot.org/core/>
# Query 13
# Select all Rhea reactions used to annotate Escherichia coli (taxid=83333) in UniProtKB/Swiss-Prot
# return the number of UniProtKB entries
SELECT ?uniprot ?mnemo ?rhea ?accession ?equation
WHERE {
{
VALUES (?taxid) { (taxon:83333) }
GRAPH <http://sparql.uniprot.org/uniprot> {
?uniprot up:reviewed true .
?uniprot up:mnemonic ?mnemo .
?uniprot up:organism ?taxid .
?uniprot up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea .
}
}
?rhea rh:accession ?accession .
?rhea rh:equation ?equation .
}
11 changes: 11 additions & 0 deletions demonstrator/link-traversal-solidbench-1.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Datasources: https://solidbench.linkeddatafragments.org/pods/00000000000000000933/profile/card
# QueryMode: solid-link-traversal
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX snvoc: <https://solidbench.linkeddatafragments.org/www.ldbc.eu/ldbc_socialnet/1.0/vocabulary/>
SELECT ?messageId ?messageCreationDate ?messageContent WHERE {
?message snvoc:hasCreator <https://solidbench.linkeddatafragments.org/pods/00000000000000000933/profile/card#me>;
rdf:type snvoc:Post;
snvoc:content ?messageContent;
snvoc:creationDate ?messageCreationDate;
snvoc:id ?messageId.
}
10 changes: 10 additions & 0 deletions demonstrator/link-traversal-solidbench-2.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Datasources: https://solidbench.linkeddatafragments.org/pods/00000015393162789111/posts
# QueryMode: solid-link-traversal
PREFIX snvoc: <https://solidbench.linkeddatafragments.org/www.ldbc.eu/ldbc_socialnet/1.0/vocabulary/>
SELECT ?personId ?firstName ?lastName WHERE {
<https://solidbench.linkeddatafragments.org/pods/00000015393162789111/posts#893353506423> snvoc:id ?messageId;
snvoc:hasCreator ?creator.
?creator snvoc:id ?personId;
snvoc:firstName ?firstName;
snvoc:lastName ?lastName.
}
10 changes: 0 additions & 10 deletions demonstrator/solid-link-traversal-foaf-knows.rq

This file was deleted.

9 changes: 0 additions & 9 deletions demonstrator/solid-link-traversal-see-also.rq

This file was deleted.

2 changes: 1 addition & 1 deletion demonstrator/solid-no-traversal-basic-select.rq
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Datasources: https://triple.ilabt.imec.be/test/bio-usecase/nbn-chist-era-annex-1-chemicals-custom-predicate.ttl
# Datasources: https://triple.ilabt.imec.be/test/
# QueryMode: solid-no-traversal
SELECT ?s ?p ?o
WHERE {
Expand Down
2 changes: 1 addition & 1 deletion demonstrator/triple-solid-2.rq
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Datasources: http://localhost:3000/test/random/nbn-chist-era-annex-1-chemicals-custom-predicate.ttl
# Datasources: https://triple.ilabt.imec.be/test/bio-usecase/nbn-chist-era-annex-1-chemicals-custom-predicate.ttl
# QueryMode: solid-no-traversal
PREFIX thd: <urn:triple-hybrid-demo:>
SELECT DISTINCT ?CAS WHERE {
Expand Down
59 changes: 56 additions & 3 deletions src/components/DataQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,23 @@ export default {
isLikelySolidOrRdfSource(source: string) {
return !this.isLikelySparqlEndpointSource(source);
},
/**
* Infers query mode from canonical example filename prefixes so the sample
* picker remains stable even when files omit explicit # QueryMode metadata.
*/
inferModeFromExampleId(exampleId: string): QueryExecutionMode | null {
const normalizedId = exampleId.toLowerCase();
if (
normalizedId.startsWith("link-traversal-") ||
normalizedId.startsWith("link-taversal-")
) {
return "solid-link-traversal";
}
if (normalizedId.startsWith("solid-no-traversal-")) {
return "solid-no-traversal";
}
return null;
},
/**
* Determines the target query engine mode for an example query. Authors can
* explicitly pin a mode via `# QueryMode: <mode-id>` in the .rq file.
Expand All @@ -2253,6 +2270,7 @@ export default {
_queryText: string,
sources: string[],
declaredMode?: string,
exampleId?: string,
): QueryExecutionMode {
if (
declaredMode &&
Expand All @@ -2261,6 +2279,13 @@ export default {
return declaredMode as QueryExecutionMode;
}

if (exampleId) {
const modeFromName = this.inferModeFromExampleId(exampleId);
if (modeFromName) {
return modeFromName;
}
}

const endpointSourceCount = sources.filter((source) =>
this.isLikelySparqlEndpointSource(source),
).length;
Expand All @@ -2283,6 +2308,7 @@ export default {
queryText: string,
sources: string[],
mode: QueryExecutionMode,
exampleId?: string,
): ExampleQueryCategory {
if (mode === "solid-link-traversal") {
return "Solid query (link traversal)";
Expand All @@ -2291,13 +2317,32 @@ export default {
return "Solid query (no traversal)";
}

const normalizedId = (exampleId || "").toLowerCase();
if (normalizedId.startsWith("federated-")) {
return "Federated query";
}

const hasServiceClause = /service\s*<[^>]+>/i.test(queryText);
const endpointSourceCount = sources.filter((source) =>
this.isLikelySparqlEndpointSource(source),
).length;
const endpointHosts = new Set(
sources
.filter((source) => this.isLikelySparqlEndpointSource(source))
.map((source) => this.normalizeSourceUrlForValidation(source))
.map((source) => {
try {
return new URL(source).host;
} catch {
return "";
}
})
.filter((host) => host.length > 0),
);

if (
hasServiceClause ||
endpointHosts.size > 1 ||
endpointSourceCount > 1 ||
(endpointSourceCount === 1 && sources.length > 1)
) {
Expand Down Expand Up @@ -2576,8 +2621,14 @@ export default {
query,
sources,
declaredMode,
rawName,
);
const category = this.categorizeExampleQuery(
query,
sources,
mode,
rawName,
);
const category = this.categorizeExampleQuery(query, sources, mode);
queries.push({
id: rawName,
name,
Expand All @@ -2604,8 +2655,10 @@ export default {
);
if (!example) return;

// Clone example sources so user edits never mutate the static sample list.
this.currentQuery.sources = [...example.sources];
// Link-traversal examples intentionally start with no explicit datasource.
// Comunica can derive traversal seeds from IRIs that appear in the query.
this.currentQuery.sources =
example.mode === "solid-link-traversal" ? [] : [...example.sources];
this.currentQuery.query = example.query || "";
this.queryMode = example.mode;
this.syncYasqeFromExternalQuery(this.currentQuery.query, {
Expand Down
40 changes: 34 additions & 6 deletions src/components/Guides/DataQueryGuide.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
Targets multiple SPARQL endpoints in one execution (commonly via SERVICE clauses).
</li>
<li>
<span class="guide-tag">Solid query</span>
Targets RDF resources from a Solid pod or local server.
<span class="guide-tag">Solid query (no traversal)</span>
Targets explicit Solid RDF resources/containers without discovering linked documents.
</li>
<li>
<span class="guide-tag">Mixed source federated query</span>
Targets both Solid pod sources and SPARQL endpoint sources.
<span class="guide-tag">Solid query (link traversal)</span>
Starts from Solid seed URLs and discovers additional RDF documents by following links.
</li>
</ul>
</section>
Expand All @@ -70,6 +70,22 @@
<span class="guide-control">baseline-test</span>
Quick concept-check query on the Rhea endpoint that returns a small set of predicate IRIs.
</li>
<li>
<span class="guide-control">federated-automated-rhea-13</span>
Federates UniProt and Rhea to list E. coli-reviewed proteins and associated reactions.
</li>
<li>
<span class="guide-control">federated-uniprot-rhea-human-reactions</span>
Fetches human proteins in UniProt and joins to reaction labels from Rhea.
</li>
<li>
<span class="guide-control">federated-wikidata-uniprot-human-proteins</span>
Uses Wikidata + UniProt federation to enrich proteins with mnemonics.
</li>
<li>
<span class="guide-control">federated-wikidata-cities</span>
Single-endpoint Wikidata city query with label service for readable output.
</li>
<li>
<span class="guide-control">triple-wikidata-1</span>
Aggregates toxicity-related compound data in Wikidata and ranks by average LD50.
Expand All @@ -95,8 +111,20 @@
Retrieves OMA ortholog protein links and organism names for a selected UniProt protein.
</li>
<li>
<span class="guide-control">triple-combined-service</span>
Full mixed-source federated workflow that chains Solid/local CAS data, IDSM similarity search, and Rhea reactions.
<span class="guide-control">solid-no-traversal-basic-select</span>
Reads triples directly from a selected Solid container without traversal.
</li>
<li>
<span class="guide-control">solid-no-traversal-literal-preview</span>
Extracts literal values from a specific Solid RDF document.
</li>
<li>
<span class="guide-control">link-traversal-solidbench-1</span>
SolidBench link-traversal query that starts at a profile seed and discovers related posts.
</li>
<li>
<span class="guide-control">link-traversal-solidbench-2</span>
SolidBench link-traversal query that resolves creator details from a message seed URL.
</li>
</ul>
</section>
Expand Down
Loading
Loading