query-8fc342d456b523dcd86969c3b202b2d1

rq turtle/ttl

Expansion of an existing queryHello, the following query works well, but I would want additional datas regarding potential synonymy. Some of the results have: e.g. ?taxonSynonym (P642)of (Q1040689)synonym (P2868)subject has role The value "?taxonSynonym", when it exist, being the one that I want to be displayed in the query. In addition, this value "?taxonSynonym" may have a sitelink to Wikispecies, when this sitelink exist I would also want to have this sitelink in the query results.

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?referenceHasRole ?referenceHasRoleLabel ?Pages ?BHL_URL ?PlaziID ?PlaziID_URL 
WHERE
{
    ?item p:P225 ?statement .
    ?statement prov:wasDerivedFrom ?reference .
    ?reference pr:P248 wd:Q56025286.
  OPTIONAL { ?item p:P225 ?statement .
    ?statement prov:wasDerivedFrom ?reference .
    ?reference pr:P248 ?publication.
              OPTIONAL { ?item p:P225 ?statement .
    ?statement prov:wasDerivedFrom ?reference .
    ?reference pr:P248 ?publication.
    ?reference pr:P6184 ?referenceHasRole}
               OPTIONAL { ?item p:P225 ?statement .
    ?statement prov:wasDerivedFrom ?reference .
    ?reference pr:P248 ?publication.
    ?reference pr:P1992 ?PlaziID
  BIND(IRI(CONCAT("http://treatment.plazi.org/id/",?PlaziID)) as ?PlaziID_URL)}
               OPTIONAL { ?item p:P225 ?statement .
    ?statement prov:wasDerivedFrom ?reference .
    ?reference pr:P248 ?publication.
    ?reference pr:P304 ?Pages}
               OPTIONAL { ?item p:P225 ?statement .
    ?statement prov:wasDerivedFrom ?reference .
    ?reference pr:P248 ?publication.
    ?reference pr:P687 ?BHLpageID
  BIND(IRI(CONCAT("https://biodiversitylibrary.org/page/",?BHLpageID)) as ?BHL_URL)}
}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?BHL_URL"):::projected v9("?BHLpageID") v8("?Pages"):::projected v6("?PlaziID"):::projected v7("?PlaziID_URL"):::projected v1("?item"):::projected v4("?publication") v3("?reference") v5("?referenceHasRole"):::projected v2("?statement") c10(["bd:serviceParam"]):::iri c4(["wd:Q56025286"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal v1 --"p:P225"--> v2 v2 --"prov:wasDerivedFrom"--> v3 v3 --"p:reference/P248"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P225".-> v2 v2 --"prov:wasDerivedFrom"--> v3 v3 --"p:reference/P248"--> v4 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P225".-> v2 v2 --"prov:wasDerivedFrom"--> v3 v3 --"p:reference/P248"--> v4 v3 --"p:reference/P6184"--> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P225".-> v2 v2 --"prov:wasDerivedFrom"--> v3 v3 --"p:reference/P248"--> v4 v3 --"p:reference/P1992"--> v6 bind0[/"concat('http://treatment.plazi.org/id/',?PlaziID)"/] v6 --o bind0 bind0 --as--o v7 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P225".-> v2 v2 --"prov:wasDerivedFrom"--> v3 v3 --"p:reference/P248"--> v4 v3 --"p:reference/P304"--> v8 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P225".-> v2 v2 --"prov:wasDerivedFrom"--> v3 v3 --"p:reference/P248"--> v4 v3 --"p:reference/P687"--> v9 bind1[/"concat('https://biodiversitylibrary.org/page/',?BHLpageID)"/] v9 --o bind1 bind1 --as--o v10 end end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end