query-e0a6a474ff1781519a284f8504857fcc
Actual players of the Inter FC SELECT ?player ?playerLabel ?age ?startyear { ?player wdt:P31 wd:Q5. # Human ?player wdt:P106 wd:Q937857 . # Soccer player ?player wdt:P54 wd:Q631. # Member of Inter F.C
?player p:P54 [ # Pointer to statement "Member of.."
ps:P54 wd:Q631; # Pointer to the statement object "Inter"
pq:P580 ?start # Get the property qualifier "Start date"
].
# Filter out all the players that are not member anymore
MINUS {
?player p:P54 [ # Pointer to statement "Member of.."
ps:P54 wd:Q631; # Pointer to the statement object "Inter"
pq:P582 ?end # Get the property qualifier "End date"
].
}
# Year of enrollment
BIND (YEAR(?start) AS ?startyear)
# Age
?player wdt:P569 ?birthdate.
BIND(FLOOR((NOW() - ?birthdate)/365.2425) AS ?age).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it" }
} ORDER BY ?startyear
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Actual players of the Inter FC
SELECT ?player ?playerLabel ?age ?startyear
{
?player wdt:P31 wd:Q5. # Human
?player wdt:P106 wd:Q937857 . # Soccer player
?player wdt:P54 wd:Q631. # Member of Inter F.C
?player p:P54 [ # Pointer to statement "Member of.."
ps:P54 wd:Q631; # Pointer to the statement object "Inter"
pq:P580 ?start # Get the property qualifier "Start date"
].
# Filter out all the players that are not member anymore
MINUS {
?player p:P54 [ # Pointer to statement "Member of.."
ps:P54 wd:Q631; # Pointer to the statement object "Inter"
pq:P582 ?end # Get the property qualifier "End date"
].
}
# Year of enrollment
BIND (YEAR(?start) AS ?startyear)
# Age
?player wdt:P569 ?birthdate.
BIND(FLOOR((NOW() - ?birthdate)/365.2425) AS ?age).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it" }
}
ORDER BY ?startyear
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?age"):::projected
v5("?birthdate")
v4("?end")
v2("?player"):::projected
v3("?start")
v5("?startyear"):::projected
a1((" "))
a2((" "))
c6(["wd:Q631"]):::iri
c13(["bd:serviceParam"]):::iri
c4(["wd:Q937857"]):::iri
c2(["wd:Q5"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,it"]):::literal
v2 --"p:direct/P31"--> c2
v2 --"p:direct/P106"--> c4
v2 --"p:direct/P54"--> c6
a1 --"p:statement/P54"--> c6
a1 --"p:qualifier/P580"--> v3
v2 --"p:P54"--> a1
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
a2 --"p:statement/P54"--> c6
a2 --"p:qualifier/P582"--> v4
v2 --"p:P54"--> a2
end
bind1[/"year-from-dateTime(?start)"/]
v3 --o bind1
bind1 --as--o v5
v2 --"p:direct/P569"--> v5
bind2[/"numeric-floor(NOW() - ?birthdate / '365.2425^^xsd:decimal')"/]
v5 --o bind2
bind2 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end