Template:Workflow: Difference between revisions
From MaRDI portal
Line 69: | Line 69: | ||
} | } | ||
# | # Filter results to only show defining statements that match the current quantity label | ||
OPTIONAL { | OPTIONAL { | ||
?task mdb:containsFormulation ?formulation. | ?task mdb:containsFormulation ?formulation . | ||
?formulation mdb:inDefiningFormulation ?definingStatement . | ?formulation mdb:inDefiningFormulation ?definingStatement . | ||
# Convert definingStatement to a plain string to strip off datatype markup | |||
BIND(STR(?definingStatement) AS ?plainStatement) | |||
# Clean up spaces around commas, making the format consistent | # Clean up spaces around commas, making the format consistent | ||
BIND(REPLACE(? | BIND(REPLACE(?plainStatement, "\\s*,\\s*", ",") AS ?cleanedStatement) | ||
# Extract symbol and quantity label | # Extract symbol and quantity label | ||
BIND(STRBEFORE(?cleanedStatement, ",") AS ?Symbol) | BIND(STRBEFORE(?cleanedStatement, ",") AS ?Symbol) | ||
BIND(STRAFTER(?cleanedStatement, ",") AS ?quantityLabel) | BIND(STRAFTER(?cleanedStatement, ",") AS ?quantityLabel) | ||
# Filter results to only show defining statements that match the current quantity label | |||
BIND(STR(?itemLabel) AS ?plainItemLabel) | |||
FILTER(?quantityLabel = ?plainItemLabel) | |||
} | } | ||
} | } | ||
} | } |
Revision as of 19:46, 29 October 2024