This query can return both the ID (?ID) for the property and the item ID, but I can't seem to get it to use the property ID (?ID) in a triplet.
SPARQL is a dark art to me. Thank you for your help.
SELECT ?item ?itemLabel ?superpower ?property ?label ?ID ?superpowerLabel
WHERE
{
?property a wikibase:Property ;
schema:description ?label .
filter contains(?label,"super")
filter contains(?label,"abilities")
?item rdfs:label "Wolverine"@en .
# Get the ID
BIND(REPLACE(STR(?property), "http://www.wikidata.org/entity/", "wdt:") AS ?ID)
?item ?ID ?superpower . # This part works with "wdt:P2563" instead of ?ID.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
LIMIT 10