Note: Before anyone marks this as duplicate to How to query Wikidata for "also known as", no actual working answer was given there.
The question I have is similar to that thread: How do I get matching entities from "also known as" using a query (without getting time-out errors)? I have a working solution to match the "also known as" column for properties, but I cannot get it to work for all entities. This is that query:
SELECT DISTINCT ?property
WHERE {
?property a wikibase:Property .
?property skos:altLabel ?altLabel .
FILTER (CONTAINS(?altLabel, "<ALSOKNOWNAS>"@en))
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" .}
}
The < ALSOKNOWNAS > indicates where a label is inserted from my script. As an example, when placing the word "invented" in the query, the query returns the page P61 for "discoverer or inventor".
Removing the first line of the WHERE statement does not work. I'm not very proficient in WIkidata query, but I hope someone can help me.