Sparql – How to retrieve alias from Wikidata

I’m trying to retrieve some information from Wikidata, and what I found interesting is the alias of collecting sounds. For example, Francesco Totti is also known as il Capitano or er Pupone:
< img src="/wp-content/uploads/images/architecture/search-engines/1626814068554.png" alt="wikidata of Francesco Totti">

I am trying to search with this sparql query All series of football players:

SELECT ?subject ?nomeLabel ?cognomeLabel ?subjectLabel WHERE {
?subject wdt:P31 wd:Q5.

?subject p:P54 ?team .
?team ps:P54 wd:""" + team_code +""" .
FILTER NOT EXISTS {?team pq:P582 ?end
}
OPTIONAL{
?subject wdt:P735 ?nome .
?subject wdt:P734 ?cognome .
}
SERVICE wikibase:label {bd:serviceParam wikibase: language "it". }
}
ORDER BY (?cognomeLabel)

How do I modify my query to obtain an alias?
Thank you

I have tried queries using various tags. Here is only for Romans:

SELECT distinct ?subject ?subjectLabel ?nomeLabel ?cognomeLabel ?nickname ?alternative ?subjectAltLabel WHERE {
?subject wdt:P31 wd:Q5.
?subject p:P54 ?team .
?team ps:P54 wd:Q2739 .
FILTER NOT EXISTS {?team pq:P582 ?end. }
OPTIONAL {?subject wdt: P735 ?nome. }
OPTIONAL {?subject wdt:P734 ?cognome. }
OPTIONAL {?subject wdt:P1449 ?nickname. }
OPTIONAL {?subject skos:altLabel ?alternative.}
SERVICE wikibase:label {bd:serviceParam wikibase:language "it,en,fr". }
}
ORDER BY (?cognomeLabel)

I believe the P1449 attribute It should be the most suitable attribute for storing aliases/nicknames, but it doesn’t seem to be that much for football players. I just added “il Capitano” to Francesco Totti. Other than that, the Roma players don’t seem to have other nicknames.

The “also known as” tag (in the right column) is not necessarily a nickname, but may be a spelling variant.

I am trying to get it from Wikidata Retrieving some information, what I found interesting is the alias of the collected sound. For example, Francesco Totti is also known as il Capitano or er Pupone:
wikidata of Francesco Totti

I am trying to use this sparql query to retrieve all series of football players:

SELECT ?subject ?nomeLabel ?cognomeLabel ?subjectLabel WHERE {
?subject wdt:P31 wd:Q5.

?subject p:P54 ?team .
? team ps:P54 wd:""" + team_code +""" .
FILTER NOT EXISTS {?team pq:P582 ?end
}
OPTIONAL{
?subject wdt: P735 ?nome .
?subject wdt:P734 ?cognome .
}
SERVICE wikibase:label {bd:serviceParam wikibase:language "it". }
}
ORDER BY (?cognomeLabel)

How can I modify my query to obtain an alias?
Thank you

I have tried queries using various tags. Here is only for Romans:

SELECT distinct ?subject ?subjectLabel ?nomeLabel ?cognomeLabel ?nickname ?alternative ?subjectAltLabel WHERE {
?subject wdt:P31 wd:Q5.
?subject p:P54 ?team .
?team ps:P54 wd:Q2739 .
FILTER NOT EXISTS {?team pq:P582 ?end. }
OPTIONAL {?subject wdt:P735 ?nome. }
OPTIONAL {? subject wdt:P734 ?cognome. }
OPTIONAL {?subject wdt:P1449 ?nickname. }
OPTIONAL {?subject skos:altLabel ?alternative. }
SERVICE wikibase:label {bd:serviceParam wikibase:language "it,en,fr". }
}
ORDER BY (?cognomeLabel)

I believe the P1449 attribute should be the most suitable attribute for storing aliases/nicknames, But it doesn’t seem to be that much for football players. I just added “il Capitano” to Francesco Totti. Other than that, the Roma players don’t seem to have other nicknames.

The “also known as” tag (in (Right column) is not necessarily a nickname, but it may be a spelling variant.

Leave a Comment

Your email address will not be published.