Template:Workflow: Difference between revisions
From MaRDI portal
Line 44: | Line 44: | ||
<div class="no-pagination no-filter"> | <div class="no-pagination no-filter"> | ||
{{#sparql: | {{#sparql: | ||
SELECT ?itemLabel ?Symbol ?Type ?taskLabel WHERE { | |||
# Starting from the central item | |||
wd:{{#invoke:Wd|label|raw|}} wdt:P557 ?centralItem . | |||
?centralItem wdt:P31 wd:Q68663; | |||
wdt:P188 ?url; | |||
rdfs:label ?Label. | |||
# Service query to get tasks and connect them to quantities | |||
SERVICE <https://sparql.mtsr2024.m1.mardi.ovh/mathalgodb/query> { | SERVICE <https://sparql.mtsr2024.m1.mardi.ovh/mathalgodb/query> { | ||
?url mdb:appliedByTask ?task. | ?url mdb:appliedByTask ?task . | ||
?task rdfs:label ?taskLabel. | ?task rdfs:label ?taskLabel . | ||
# Define type based on connection type (Input or Output) | |||
{ | |||
?task mdb:containsInput ?item . | |||
?item rdfs:label ?itemLabel . | |||
BIND("independent" AS ?Type) | |||
} | |||
UNION | |||
{ | |||
?task mdb:containsOutput ?item . | |||
?item rdfs:label ?itemLabel . | |||
BIND("dependent" AS ?Type) | |||
?formulation mdb: | } | ||
# Retrieve inDefiningFormulation statement, clean up spaces, and parse symbol | |||
OPTIONAL { | |||
?formulation mdb:definesQuantity ?item . | |||
?formulation mdb:inDefiningFormulation ?definingStatement . | ?formulation mdb:inDefiningFormulation ?definingStatement . | ||
BIND(STRBEFORE(? | |||
BIND(STRAFTER(? | # Clean up spaces around commas, making the format consistent | ||
BIND(REPLACE(?definingStatement, "\\s*,\\s*", ",") AS ?cleanedStatement) | |||
# Extract symbol and quantity label | |||
BIND(STRBEFORE(?cleanedStatement, ",") AS ?Symbol) | |||
BIND(STRAFTER(?cleanedStatement, ",") AS ?quantityLabel) | |||
} | } | ||
# Filter results to only show defining statements that match the current quantity label | |||
FILTER(?quantityLabel = ?itemLabel) | FILTER(?quantityLabel = ?itemLabel) | ||
} | } | ||
} | } | ||
ORDER BY ?taskLabel ?itemLabel | ORDER BY ?taskLabel ?itemLabel |
Revision as of 19:08, 29 October 2024