query-90202b04fedfa35d287f4d27ffa5088a

rq turtle/ttl

distinct port or harbour type items SELECT ?item ?itemLabel (group_concat(distinct ?instanceLabel;separator="; ") as ?type) ?LOCODE WHERE { VALUES ?instance { wd:Q1313726 # iceport wd:Q2093976 # industry harbour wd:Q6034850 # inland harbor wd:Q863915 # inland port wd:Q11422437 # International strategic port wd:Q2327160 # kwelkade wd:Q15709854 # liquefied natural gas terminal wd:Q721207 # marina wd:Q426875 # Mulberry harbour wd:Q64210934 # natural harbor wd:Q21601954 # naval air auxiliary station wd:Q6981985 # naval air station wd:Q1745026 # naval arsenal wd:Q1324633 # naval base wd:Q7619063 # naval shore establishment wd:Q55624858 # naval station wd:Q2185059 # Outport wd:Q2518617 # overnight stay harbour wd:Q4303352 # passenger ship terminal wd:Q2150794 # penalty port wd:Q16948701 # pilot station wd:Q44782 # port wd:Q2264924 # port city wd:Q2183215 # port of refuge wd:Q3398594 # Port of trade wd:Q11644820 # Priority ports wd:Q11326124 # Q11326124 wd:Q11366207 # Q11366207 wd:Q11422440 # Q11422440 wd:Q11553812 # Q11553812 wd:Q11644859 # Q11644859 wd:Q1449240 # Q1449240 wd:Q1476279 # Q1476279 wd:Q17172716 # Q17172716 wd:Q1879141 # Q1879141 wd:Q21028415 # Q21028415 wd:Q2837192 # Q2837192 wd:Q3114748 # Q3114748 wd:Q60035547 # Q60035547 wd:Q3543043 # quay wd:Q1310315 # rafting ground wd:Q3398676 # regasification terminal wd:Q913035 # roadstead wd:Q7398566 # safeguarded wharf wd:Q15310171 # seaport wd:Q11570893 # Specific port wd:Q331367 # submarine base wd:Q452020 # submarine pen wd:Q13403663 # warm-water port wd:Q3497366 # whaling station wd:Q828909 # wharf } ?item wdt:P31 ?instance. OPTIONAL {?item wdt:P1937 ?LOCODE .} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?instance rdfs:label ?instanceLabel . ?item rdfs:label ?itemLabel .} } group by ?item ?itemLabel ?LOCODE

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# distinct port or harbour type items
SELECT ?item ?itemLabel (group_concat(distinct ?instanceLabel;separator="; ") as ?type) ?LOCODE
WHERE 
{
 VALUES ?instance {
 wd:Q1313726    # iceport
wd:Q2093976 # industry harbour
wd:Q6034850 # inland harbor
wd:Q863915  # inland port
wd:Q11422437    # International strategic port
wd:Q2327160 # kwelkade
wd:Q15709854    # liquefied natural gas terminal
wd:Q721207  # marina
wd:Q426875  # Mulberry harbour
wd:Q64210934    # natural harbor
wd:Q21601954    # naval air auxiliary station
wd:Q6981985 # naval air station
wd:Q1745026 # naval arsenal
wd:Q1324633 # naval base
wd:Q7619063 # naval shore establishment
wd:Q55624858    # naval station
wd:Q2185059 # Outport
wd:Q2518617 # overnight stay harbour
wd:Q4303352 # passenger ship terminal
wd:Q2150794 # penalty port
wd:Q16948701    # pilot station
wd:Q44782   # port
wd:Q2264924 # port city
wd:Q2183215 # port of refuge
wd:Q3398594 # Port of trade
wd:Q11644820    # Priority ports
wd:Q11326124    # Q11326124
wd:Q11366207    # Q11366207
wd:Q11422440    # Q11422440
wd:Q11553812    # Q11553812
wd:Q11644859    # Q11644859
wd:Q1449240 # Q1449240
wd:Q1476279 # Q1476279
wd:Q17172716    # Q17172716
wd:Q1879141 # Q1879141
wd:Q21028415    # Q21028415
wd:Q2837192 # Q2837192
wd:Q3114748 # Q3114748
wd:Q60035547    # Q60035547
wd:Q3543043 # quay
wd:Q1310315 # rafting ground
wd:Q3398676 # regasification terminal
wd:Q913035  # roadstead
wd:Q7398566 # safeguarded wharf
wd:Q15310171    # seaport
wd:Q11570893    # Specific port
wd:Q331367  # submarine base
wd:Q452020  # submarine pen
wd:Q13403663    # warm-water port
wd:Q3497366 # whaling station
wd:Q828909  # wharf
}
  ?item wdt:P31 ?instance.
  OPTIONAL {?item wdt:P1937 ?LOCODE .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". 
                         ?instance rdfs:label ?instanceLabel .
                         ?item rdfs:label ?itemLabel .}
} group by ?item ?itemLabel ?LOCODE

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?LOCODE"):::projected v1("?instance") v4("?instanceLabel"):::projected v2("?item"):::projected v5("?itemLabel"):::projected v6("?type") c4(["bd:serviceParam"]):::iri c6(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?instance/] bind0-->v1 bind00(["wd:Q1313726"]) bind00 --> bind0 bind01(["wd:Q2093976"]) bind01 --> bind0 bind02(["wd:Q6034850"]) bind02 --> bind0 bind03(["wd:Q863915"]) bind03 --> bind0 bind04(["wd:Q11422437"]) bind04 --> bind0 bind05(["wd:Q2327160"]) bind05 --> bind0 bind06(["wd:Q15709854"]) bind06 --> bind0 bind07(["wd:Q721207"]) bind07 --> bind0 bind08(["wd:Q426875"]) bind08 --> bind0 bind09(["wd:Q64210934"]) bind09 --> bind0 bind010(["wd:Q21601954"]) bind010 --> bind0 bind011(["wd:Q6981985"]) bind011 --> bind0 bind012(["wd:Q1745026"]) bind012 --> bind0 bind013(["wd:Q1324633"]) bind013 --> bind0 bind014(["wd:Q7619063"]) bind014 --> bind0 bind015(["wd:Q55624858"]) bind015 --> bind0 bind016(["wd:Q2185059"]) bind016 --> bind0 bind017(["wd:Q2518617"]) bind017 --> bind0 bind018(["wd:Q4303352"]) bind018 --> bind0 bind019(["wd:Q2150794"]) bind019 --> bind0 bind020(["wd:Q16948701"]) bind020 --> bind0 bind021(["wd:Q44782"]) bind021 --> bind0 bind022(["wd:Q2264924"]) bind022 --> bind0 bind023(["wd:Q2183215"]) bind023 --> bind0 bind024(["wd:Q3398594"]) bind024 --> bind0 bind025(["wd:Q11644820"]) bind025 --> bind0 bind026(["wd:Q11326124"]) bind026 --> bind0 bind027(["wd:Q11366207"]) bind027 --> bind0 bind028(["wd:Q11422440"]) bind028 --> bind0 bind029(["wd:Q11553812"]) bind029 --> bind0 bind030(["wd:Q11644859"]) bind030 --> bind0 bind031(["wd:Q1449240"]) bind031 --> bind0 bind032(["wd:Q1476279"]) bind032 --> bind0 bind033(["wd:Q17172716"]) bind033 --> bind0 bind034(["wd:Q1879141"]) bind034 --> bind0 bind035(["wd:Q21028415"]) bind035 --> bind0 bind036(["wd:Q2837192"]) bind036 --> bind0 bind037(["wd:Q3114748"]) bind037 --> bind0 bind038(["wd:Q60035547"]) bind038 --> bind0 bind039(["wd:Q3543043"]) bind039 --> bind0 bind040(["wd:Q1310315"]) bind040 --> bind0 bind041(["wd:Q3398676"]) bind041 --> bind0 bind042(["wd:Q913035"]) bind042 --> bind0 bind043(["wd:Q7398566"]) bind043 --> bind0 bind044(["wd:Q15310171"]) bind044 --> bind0 bind045(["wd:Q11570893"]) bind045 --> bind0 bind046(["wd:Q331367"]) bind046 --> bind0 bind047(["wd:Q452020"]) bind047 --> bind0 bind048(["wd:Q13403663"]) bind048 --> bind0 bind049(["wd:Q3497366"]) bind049 --> bind0 bind050(["wd:Q828909"]) bind050 --> bind0 v2 --"wdt:P31"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P1937".-> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c4 --"wikibase:language"--> c6 v1 --"rdfs:label"--> v4 v2 --"rdfs:label"--> v5 end bind2[/"?instanceLabel"/] v4 --o bind2 bind2 --as--o v6