User:Vicarage

From Wikidata
Jump to navigation Jump to search

I use Wikidata for my Expounder sites warlike.expounder.info etc

Babel user information
en-GB-N This user has a native understanding of British English.
en-N This user has a native understanding of English.
Users by language

Find classes where operator is at least Royal Navy, then find the other operators[edit]

SELECT DISTINCT ?item ?itemLabel ?vessel_class ?vessel_classLabel ?operator1 ?operator1Label WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P289 ?statement0.
      ?statement0 (ps:P289/(wdt:P279*)) _:anyValueP289.
      ?item p:P137 ?operator.
      ?operator (ps:P137/(wdt:P279*)) wd:Q172771.
    }
  }
  OPTIONAL { ?item wdt:P137 ?operator1. }
  OPTIONAL { ?item wdt:P289 ?vessel_class. }
}
Try it!

Royal Navy ships where vessel_class has no_value[edit]

SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 ps:P31 wd:Q3114762.
      ?item p:P137 ?statement.
      ?statement (ps:P137/(wdt:P279*)) wd:Q172771.
      MINUS { ?item p:P289 ?statement1. }
      MINUS { ?item rdf:type wdno:P289. }
    }
  }
}
Try it!

Aliases[edit]

Good morning. I was just wondering why you were removing aliases from ship items? Any reasonable aliases should ideally be left because the aid searching. — Martin (MSGJ · talk) 07:55, 19 July 2022 (UTC)

The aliases were very inconsistent, being pennant numbers, names without the HMS, names with a year, even nicknames. I was removing all except actual ship names in other services. If its judged that a particular pattern, like X for HMS X", or DD-123 they could all be all be reintroduced systematically. I would also like to get ship names correctly documented, see the wikidata chat, and the best source of those is a cleaned alias list. I worry that having "Blenheim" as an alias for HMS Blenheim would clutter searches, and its easy enough for a searcher to add the HMS prefix if looking for a ship. I am making sure the descriptions are very clear, so searching should be much easier for similar ships of the same name. Vicarage (talk) 08:23, 19 July 2022 (UTC)

Castleton[edit]

SELECT DISTINCT ?item ?itemLabel ?itemAltLabel
WHERE {
  hint:Query hint:optimizer "None".
  SERVICE wikibase:mwapi {
    bd:serviceParam wikibase:api "Search";
                    wikibase:endpoint "www.wikidata.org";
                    mwapi:srsearch "USS Aaron Ward (DF-132)".
    ?item wikibase:apiOutputItem mwapi:title .
  }
 FILTER EXISTS
  {
    { ?item rdfs:label ?text }
    UNION
    { ?item schema:description ?text }
    UNION
    { ?item skos:altLabel ?text }
    FILTER CONTAINS(?text, "HMS Castleton")
  }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
}
Try it!

Aaron Ward[edit]

SELECT DISTINCT ?item ?itemLabel ?itemAltLabel
WHERE {
  hint:Query hint:optimizer "None".
  SERVICE wikibase:mwapi {
    bd:serviceParam wikibase:api "Search";
                    wikibase:endpoint "www.wikidata.org";
                    mwapi:srsearch "USS Aaron Ward (DF-132)".
    ?item wikibase:apiOutputItem mwapi:title .
  }
 FILTER EXISTS
  {
    { ?item rdfs:label ?text }
    UNION
    { ?item schema:description ?text }
    UNION
    { ?item skos:altLabel ?text }
    FILTER CONTAINS(?text, "HMS Castleton")
  }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
}
Try it!

should be a shipwreck[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P625 ?statement0.
      ?statement0 ps:P625 _:anyValueP625.
      ?item p:P137 ?statement1.
      ?statement1 (ps:P137/(wdt:P279*)) wd:Q172771.
      ?item p:P31 ?statement2.
      ?statement2 (ps:P31/(wdt:P279*)) wd:Q11446.
      MINUS {
        ?item p:P31 ?statement3.
        ?statement3 (ps:P31/(wdt:P279*)) wd:Q852190.
      }
    }
  }
}
Try it!

Not in a vessel class[edit]

SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 ps:P31 wd:Q161705.
      ?item p:P137 ?statement1.
      ?statement1 (ps:P137/(wdt:P279*)) wd:Q172771.
      minus {
        ?item p:P289 ?statement .
        minus { ?statement a wdno:P289 . }
      }
    }
  }
}
Try it!

Wikipedia articles[edit]

SELECT ?item ?itemLabel ?article WHERE {

    ?item wdt:P137 wd:Q172771 . # ship
    ?article schema:about ?item .
    ?article schema:isPartOf <https://en.wikipedia.org/>.

    SERVICE wikibase:label {
       bd:serviceParam wikibase:language "en"
    }
}
Try it!

frigate properties[edit]

SELECT DISTINCT ?item ?itemLabel ?itemDescription ?service_entry ?service_retirement ?subclassLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q559026.
      ?item p:P137 ?statement1.
      ?statement1 (ps:P137/(wdt:P279*)) wd:Q172771.
      ?item p:P279 ?statement2.
      ?statement2 (ps:P279/(wdt:P279*)) wd:Q161705.
    }
  }
  OPTIONAL { ?item wdt:P729 ?service_entry. }
  OPTIONAL { ?item wdt:P730 ?service_retirement. }
  OPTIONAL { ?item wdt:P279 ?subclass. }
}
Try it!

no operator[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P279 ?statement0.
      ?statement0 (ps:P279/(wdt:P279*)) wd:Q2811.
      MINUS {
        ?item p:P137 ?statement1.
        ?statement1 (ps:P137/(wdt:P279*)) _:anyValueP137.
      }
    }
  }
}
Try it!
SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q559026.
      MINUS {
        ?item p:P137 ?statement1.
        ?statement1 (ps:P137/(wdt:P279*)) _:anyValueP137.
      }
    }
  }
}
Try it!

still has country of registry[edit]

SELECT DISTINCT ?item ?itemLabel ?itemDescription ?vessel_classLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      ?item p:P8047 ?statement1.
      ?statement1 (ps:P8047/(wdt:P279*)) _:anyValueP8047.
    }
  }
  OPTIONAL { ?item wdt:P289 ?vessel_class. }
}
Try it!


??[edit]

SELECT DISTINCT ?item ?itemLabel ?vessel_class ?vessel_classLabel ?operator1 ?operator1Label WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P289 ?statement0.
      ?statement0 (ps:P289/(wdt:P279*)) _:anyValueP289.
      ?item p:P137 ?operator.
      ?operator (ps:P137/(wdt:P279*)) wd:Q172771.
    }
  }
  OPTIONAL { ?item wdt:P137 ?operator1. }
  OPTIONAL { ?item wdt:P289 ?vessel_class. }
}
Try it!

battleship AltLabels[edit]

SELECT DISTINCT ?item ?itemLabel ?itemAltLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P289 ?statement0.
      ?statement0 (ps:P289/(wdt:P279*)) wd:Q182531.
    }
  }
}
Try it!


Minesweepers looking for ([edit]

SELECT DISTINCT ?item ?itemLabel ?itemAltLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P289 ?statement0.
      ?statement0 (ps:P289/(wdt:P279*)) wd:Q202527.
    }
  }
}
Try it!

museum ship location[edit]

SELECT ?ship ?shipLabel ?shipDescription ?coordinates WHERE {
  ?ship wdt:P625 ?coordinates.
  {
    ?ship p:P31 ?statement0.
    ?statement0 (ps:P31/(wdt:P279*)) wd:Q575727.
  }
  UNION
  {
    ?ship p:P366 ?statement1.
    ?statement1 (ps:P366/(wdt:P279*)) wd:Q575727.
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
}
Try it!

shipyard indirect location[edit]

SELECT ?organisation ?organisationLabel ?location ?locationLabel ?coordinates WHERE {
  ?organisation wdt:P131 ?location;
    wdt:P31 wd:Q190928.
  ?location wdt:P625 ?coordinates.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
}
Try it!

navy indirect location[edit]

SELECT ?organisation ?organisationLabel ?location ?locationLabel ?coordinates WHERE {
  ?organisation wdt:P159 ?hq;
    wdt:P31 wd:Q4508.
  ?hq wdt:P131 ?location.
  ?location wdt:P625 ?coordinates.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
}
Try it!

Royal Navy shipwrecks[edit]

SELECT DISTINCT ?ship ?shipLabel ?coordinates WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?ship WHERE {
      ?ship p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      {
        ?ship p:P31 ?statement1.
        ?statement1 (ps:P31/(wdt:P279*)) wd:Q852190.
      }
      UNION
      {
        ?ship p:P366 ?statement2.
        ?statement2 (ps:P366/(wdt:P279*)) wd:Q852190.
      }    
    }  
  }
  OPTIONAL { ?ship wdt:P625 ?coordinates. }
}
Try it!

UK shipyards[edit]

SELECT DISTINCT ?ship ?shipLabel ?coordinates WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?ship WHERE {
      ?ship p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q190928.
      ?ship p:P17 ?statement1.
      ?statement1 (ps:P17/(wdt:P279*)) wd:Q145.
    }
  }
  OPTIONAL { ?ship wdt:P625 ?coordinates. }
}
Try it!


Fixme[edit]

SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q559026.
      ?item p:P137 ?statement1.
      ?statement1 (ps:P137/(wdt:P279*)) wd:Q172771.
    }
  }
}
Try it!
SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      MINUS {
        ?item p:P289 ?statement1.
        ?statement1 (ps:P289/(wdt:P279*)) _:anyValueP289.
      }
    }
  }
}
Try it!

inception present

SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      ?item p:P571 ?statement_1.
      ?statement_1 psv:P571 ?statementValue_1.
      ?statementValue_1 wikibase:timeValue ?P571_1.
    }
  }
}
Try it!
SELECT DISTINCT ?item ?itemLabel ?itemAltLabel ?itemDescription ?vessel_classLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      ?item p:P8047 ?statement1.
      ?statement1 (ps:P8047/(wdt:P279*)) _:anyValueP8047.
    }
  }
  OPTIONAL { ?item wdt:P289 ?vessel_class. }
}
Try it!

dates of battles for ships[edit]

SELECT ?ship ?shipLabel ?conflict ?conflictLabel ?timeLabel WHERE {
  ?ship wdt:P607 ?conflict;
    wdt:P289 wd:Q2240070.
  ?conflict wdt:P585 ?time.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
}
Try it!

dates of battles[edit]

SELECT DISTINCT ?item ?itemLabel ?pointintime ?starttime ?endtime WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q1261499.
    }
    LIMIT 100
  }
  OPTIONAL { ?item wdt:P585 ?pointintime. }
  OPTIONAL { ?item wdt:P580 ?starttime. }
  OPTIONAL { ?item wdt:P582 ?endtime. }
}
Try it!

warship entries changed within 1 day[edit]

SELECT ?item ?itemLabel ?change
WHERE {
  ?item p:P31 ?statement0.
  ?statement0 (ps:P31/(wdt:P279*)) wd:Q3114762.
  ?item schema:dateModified ?change .
    FILTER(BOUND(?change) && DATATYPE(?change) = xsd:dateTime).
    # not in the future, and not more than 1 day ago
    BIND(NOW() - ?change AS ?distance).
    FILTER(0 <= ?distance && ?distance < 1).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }             
} ORDER BY DESC(?change)
Try it!

Fortifications within 20km from Dover Castle[edit]

SELECT ?place ?placeLabel ?placeDescription ?location WHERE {
  wd:Q950970 wdt:P625 ?targetLoc . 
  SERVICE wikibase:around { 
      ?place wdt:P625 ?location . 
      bd:serviceParam wikibase:center ?targetLoc . 
      bd:serviceParam wikibase:radius "20" . 
      bd:serviceParam wikibase:distance ?dist.
  } 
  # Is a fortification but not a hillfort
  FILTER EXISTS { ?place wdt:P31/wdt:P279* wd:Q57821.
    MINUS {
      ?place wdt:P31/wdt:P279* wd:Q744099.
    }
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en-GB,en" . 
  }
} ORDER BY ASC(?dist)
Try it!

Hugo award winners and their years[edit]

With work

SELECT DISTINCT ?item ?itemLabel ?winner ?winnerLabel ?pointintime ?forwork WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?winner ?pointintime ?forwork WHERE {
      ?item wdt:P279 wd:Q188914;
      p:P1346 [ ps:P1346 ?winner ; pq:P585 ?pointintime; pq:P1686 ?forwork].
    }
  }
}
Try it!

without work

SELECT DISTINCT ?item ?itemLabel ?winner ?winnerLabel ?pointintime WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?winner ?pointintime WHERE {
      ?item wdt:P279 wd:Q188914;
      p:P1346 [ ps:P1346 ?winner ; pq:P585 ?pointintime].
    }
  }
}
Try it!

Award details[edit]

SELECT ?item ?itemLabel ?fan ?countryLabel ?conferredLabel ?organiserLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q107581015.
    }
    LIMIT 100
  }
OPTIONAL {?item wdt:P9307 ?fan.}
OPTIONAL {?item wdt:P17 ?country.}
OPTIONAL {?item wdt:P1027 ?conferred.}
OPTIONAL {?item wdt:P664 ?organiser.}
}
Try it!

With Fancyclopedia but without SFE[edit]

SELECT DISTINCT ?item ?itemLabel ?fancy WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P9307 ?statement0.
      ?statement0 (ps:P9307) _:anyValueP9307.
      MINUS {
        ?item p:P5357 ?statement1.
        ?statement1 (ps:P5357) _:anyValueP5357.
      }
    }
  }
  OPTIONAL {?item wdt:P9307 ?fancy.}
}
Try it!

RN ships with no launch date[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      MINUS {
        ?item p:P793 ?statement1.
        ?statement1 (ps:P793/(wdt:P279*)) wd:Q596643.
      }
      ?item p:P31 ?statement2.
      ?statement2 (ps:P31/(wdt:P279*)) wd:Q3114762.
    }
  }
}
Try it!

RN ships without a vessel class[edit]

SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      ?item p:P31 ?statement1.
      ?statement1 (ps:P31/(wdt:P279*)) wd:Q1229765.
      MINUS {
        ?item p:P31 ?statement2.
        ?statement2 (ps:P31/(wdt:P279*)) wd:Q974686.
      }
      MINUS {
        ?item p:P289 ?statement3.
        ?statement3 (ps:P289/(wdt:P279*)) _:anyValueP289.
      }
    }
  }
}
Try it!

Three Decks URL for ship classes[edit]

SELECT DISTINCT ?item ?itemLabel ?source ?url WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?source ?url WHERE {
      ?item p:P31 ?statement1.
      ?statement1 (ps:P31/(wdt:P279*)) wd:Q559026.
      ?item wdt:P1343 wd:Q68966143;
      p:P1343 [ ps:P1343 ?source ; pq:P2699 ?url].
    }
  }
}
Try it!

UK Fortifications with TripAdvisor but without official website[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q57821.
      ?item p:P17 ?statement1.
      ?statement1 (ps:P17/(wdt:P279*)) wd:Q145.
      ?item p:P3134 ?statement2.
      ?statement2 (ps:P3134) _:anyValueP3134.
      MINUS {
        ?item p:P856 ?statement3.
        ?statement3 (ps:P856) _:anyValueP856.
      }
    }
  }
}
Try it!

ship classes that end with s[edit]

SELECT ?item ?label
WHERE
{
  ?item wdt:P31 wd:Q559026;
         rdfs:label ?label.
  FILTER(LANG(?label) = "en").
  FILTER(STRENDS(?label, "s")).
}
Try it!

ship classes that contain a ([edit]

SELECT ?item ?label ?description
WHERE
{
      ?item p:P137 ?statement2.
      ?statement2 (ps:P137/(wdt:P279*)) wd:Q172771.
  ?item wdt:P31 wd:Q559026;
         schema:description ?description;
         rdfs:label ?label.
  FILTER(LANG(?label) = "en").
  FILTER(CONTAINS(?label, "(")).
}
Try it!

RN operated with 19 in name[edit]

SELECT ?item ?label
WHERE
{
  ?item p:P137 ?statement1.
  ?statement1 (ps:P137/(wdt:P279*)) wd:Q172771.
  ?item rdfs:label ?label.
  FILTER(LANG(?label) = "en").
  FILTER(CONTAINS(?label, "19")).
}
Try it!

Ships with launch dates[edit]

SELECT DISTINCT ?item ?itemLabel ?launchdate WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?launchdate WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
        ?item p:P793 ?statement1.
        ?statement1 (ps:P793/(wdt:P279*)) wd:Q596643.
        ?statement1 pq:P585 ?launchdate.
      ?item p:P31 ?statement2.
      ?statement2 (ps:P31/(wdt:P279*)) wd:Q3114762.
    }
  }
}
Try it!

First rate ships without Three Decks ship id[edit]

SELECT DISTINCT ?item ?itemLabel ?launchdate WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?launchdate WHERE {
      #?item p:P137 ?statement0.
      #?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      ?item p:P793 ?statement1.
      ?statement1 (ps:P793/(wdt:P279*)) wd:Q596643.
      ?statement1 pq:P585 ?launchdate.
      ?item p:P31 ?statement2.
      ?statement2 (ps:P31/(wdt:P279*)) wd:Q892367.
      MINUS {
        ?item p:P11085 ?statement3.
        ?statement3 (ps:P11085) _:anyValueP11085.
      }
        
    }
  }
}
Try it!

Royal Navy ship classes after 1707 without country of origin[edit]

SELECT DISTINCT ?item ?itemLabel ?P729_1 WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?P729_1 WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      ?item p:P729 ?statement_1.
      ?statement_1 psv:P729 ?statementValue_1.
      ?statementValue_1 wikibase:timePrecision ?precision_1.
      hint:Prior hint:rangeSafe "true"^^xsd:boolean.
      FILTER(?precision_1 >= 9 )
      ?statementValue_1 wikibase:timeValue ?P729_1.
      hint:Prior hint:rangeSafe "true"^^xsd:boolean.
      FILTER(?P729_1 >= "+1707-00-00T00:00:00Z"^^xsd:dateTime)
      ?item p:P31 ?statement2.
      ?statement2 (ps:P31/(wdt:P279*)) wd:Q19832479.
      MINUS {
        ?item p:P137 ?statement3.
        ?statement3 (ps:P137/(wdt:P279*)) wd:Q11220.
      }
      MINUS {
        ?item p:P495 ?statement4.
        ?statement4 (ps:P495/(wdt:P279*)) _:anyValueP495.
      }
    }
  }
}
Try it!

Find country of shipyard that built a ship[edit]

SELECT DISTINCT ?item ?itemLabel ?shipyardLabel ?country ?countryLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?country ?shipyard WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q559026.
      MINUS {
        ?item p:P495 ?statement1.
        ?statement1 (ps:P495/(wdt:P279*)) _:anyValueP495.
      }
      ?item wdt:P176 ?shipyard.
      ?shipyard wdt:P17 ?country.
    }
  }
}
Try it!

Sub Brit described by URLs[edit]

SELECT DISTINCT ?item ?url ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?url WHERE {
      ?item p:P1343 ?statement0.
      ?statement0 (ps:P1343/(wdt:P279*)) wd:Q10683167.
      ?item wdt:P1343 wd:Q10683167;
      p:P1343 [ ps:P1343 ?source ; pq:P2699 ?url].
    }
  }
}
Try it!

Open museums in historic county of Kent[edit]

SELECT DISTINCT ?organisation ?organisationLabel  ?county ?countyLabel WHERE {
   ?organisation wdt:P31/wdt:P279* wd:Q33506.
   ?organisation wdt:P17 wd:Q145 .
   OPTIONAL {?organisation wdt:P7959 ?county1. }
   OPTIONAL {?organisation wdt:P131/wdt:P7959 ?county2. }
   BIND(COALESCE(?county1,?county2) as ?county)
   FILTER(?county IN (wd:Q67479626))
   MINUS {
   ?organisation p:P576 ?statement_2.
   ?statement_2 psv:P576 ?statementValue_2.
   ?statementValue_2 wikibase:timeValue ?P576_2.
   }
   MINUS {
   ?organisation p:P3999 ?statement_3.
   ?statement_3 psv:P3999 ?statementValue_3.
   ?statementValue_3 wikibase:timeValue ?P3999_2.
   } 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". } 
}
Try it!

or

SELECT distinct ?organisation ?organisationLabel ?location ?locationLabel ?tag
WHERE {
  { ?organisation wdt:P31/wdt:P279* wd:Q33506 .
    ?organisation wdt:P131 ?location .
    ?organisation wdt:P7959 wd:Q67479626 . 
    bind("Kent (stated on item)" as ?tag) .
  } # option A, it's in the historic county
  union
  { ?organisation wdt:P31/wdt:P279* wd:Q33506 .
    ?organisation wdt:P131 ?location . ?location wdt:P7959 wd:Q67479626 . 
    filter not exists { ?organisation wdt:P7959 wd:Q67479626 } . # not option A
    filter not exists { ?location wdt:P7959 ?elsewhere . filter (?elsewhere != wd:Q67479626) } # not option C
    bind("Kent (deduced via location)" as ?tag) .
  } # option B, it's in somewhere in historic Kent but not tagged as Kent itself, and no other historic county
  union
  { ?organisation wdt:P31/wdt:P279* wd:Q33506 .
    ?organisation wdt:P131 ?location . ?location wdt:P7959 wd:Q67479626 . 
    ?location wdt:P7959 ?elsewhere . filter (?elsewhere != wd:Q67479626) .
    filter not exists { ?organisation wdt:P7959 wd:Q67479626 } . # not option A
    bind("Maybe (location is somewhere which was partly in Kent)" as ?tag) 
  } # option C, it's in somewhere in historic Kent and another historic county
  
  filter not exists { ?organisation wdt:P576 ?closed }
  filter not exists { ?organisation wdt:P3999 ?closed }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }

} order by ?organisationLabel
Try it!

Vicarage (talk) 10:53, 7 November 2022 (UTC)

fortifications with rejected in description[edit]

SELECT ?item ?label ?description
WHERE
{
      ?item p:P17 ?statement2.
      ?statement2 (ps:P17/(wdt:P279*)) wd:Q145.
  ?item wdt:P31 wd:Q57821;
         schema:description ?description;
         rdfs:label ?label.
  FILTER(LANG(?description) = "en").
  FILTER(CONTAINS(?description, "rejected")).
}
Try it!

Vicarage (talk) 18:12, 24 November 2022 (UTC)

battleships without a vessel_class, even a null one[edit]

As documented at https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Novalue

SELECT ?item ?itemLabel 
WHERE 
{
  ?item p:P31/ps:P31/wdt:P279* wd:Q182531.
  filter not exists {?item a wdno:P289.}
  filter not exists {?item p:P289 [].}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
}
Try it!

Vicarage (talk) 12:08, 27 November 2022 (UTC)

Royal Navy ships without vessel_class after 1900[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      MINUS {
        ?item p:P289 ?statement1.
        ?statement1 (ps:P289/(wdt:P279*)) _:anyValueP289.
      }
      ?item p:P729 ?statement_2.
      ?statement_2 psv:P729 ?statementValue_2.
      ?statementValue_2 wikibase:timePrecision ?precision_2.
      hint:Prior hint:rangeSafe "true"^^xsd:boolean.
      FILTER(?precision_2 >= 9 )
      ?statementValue_2 wikibase:timeValue ?P729_2.
      hint:Prior hint:rangeSafe "true"^^xsd:boolean.
      FILTER(?P729_2 >= "+1901-00-00T00:00:00Z"^^xsd:dateTime)
      ?item p:P31 ?statement3.
      ?statement3 (ps:P31/(wdt:P279*)) wd:Q1229765.
  filter not exists {?item a wdno:P289.}
  filter not exists {?item p:P289 [].}
    }
  }
}
Try it!

Vicarage (talk) 11:33, 28 November 2022 (UTC)

Castles that are different to disambiguation pages[edit]

SELECT DISTINCT ?item ?itemLabel ?different ?differentLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?different WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q23413.
      ?item p:P17 ?statement1.
      ?statement1 (ps:P17/(wdt:P279*)) wd:Q145.
      ?item wdt:P1889 ?different.
      ?different p:P31 ?statement2.
      ?statement2 (ps:P31/(wdt:P279*)) wd:Q4167410
    }
  }
}
Try it!

Vicarage (talk) 20:30, 2 December 2022 (UTC)

Imported from Canmore[edit]

SELECT ?item ?label ?description
WHERE
{
  ?item wdt:P31 wd:Q852190;
         schema:description ?description;
         rdfs:label ?label.
  FILTER(LANG(?description) = "en").
  FILTER(CONTAINS(?description, " imported from Canmore")).
  FILTER(LANG(?label) = "en").
  FILTER(CONTAINS(?label, "Sms")).
}
Try it!

Vicarage (talk) 11:17, 5 December 2022 (UTC)

ships without service entry[edit]

SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q559026.
      ?item p:P495 ?statement1.
      ?statement1 (ps:P495/(wdt:P279*)) wd:Q145.
      MINUS {
        ?item p:P729 ?statement_2.
        ?statement_2 psv:P729 ?statementValue_2.
        ?statementValue_2 wikibase:timeValue ?P729_2.
      }
    }
  }
}
Try it!

Vicarage (talk) 11:19, 5 December 2022 (UTC)

Castles heritage registers found dynamically[edit]

SELECT DISTINCT ?castleLabel ?registerLabel ?link WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?castle ?register ?link WHERE {
      ?register wdt:P31/wdt:P279* wd:Q18618628.
      ?register wdt:P17 wd:Q145.
      ?register wdt:P1630 ?URLprefix. 
      ?register wikibase:directClaim ?pred .
      ?castle wdt:P31/wdt:P279* wd:Q23413.
      ?castle wdt:P7959 wd:Q67479626.
      ?castle ?pred ?entry .
      BIND(URI(REPLACE(?URLprefix, "\\$1", STR(?entry))) AS ?link)
    }
  }
}
Try it!

Vicarage (talk) 21:26, 10 December 2022 (UTC)

Forts with wikimedia but no photos[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q1785071.
      ?item p:P17 ?statement1.
      ?statement1 (ps:P17/(wdt:P279*)) wd:Q145.
      MINUS {
        ?item p:P18 ?statement2.
        ?statement2 (ps:P18) _:anyValueP18.
      }
      ?item p:P373 ?statement3.
      ?statement3 (ps:P373) _:anyValueP373.
    }
  }
}
Try it!

Vicarage (talk) 18:47, 23 January 2023 (UTC)

Fortifications changed in the last 2 days[edit]

SELECT ?item ?itemLabel ?change
WHERE {
  ?item wdt:P31/wdt:P279* wd:Q57821.
  MINUS {?item wdt:P31/wdt:P279* wd:Q744099.}
  ?item schema:dateModified ?change .
    FILTER(BOUND(?change) && DATATYPE(?change) = xsd:dateTime).
    # not in the future, and not more than 2 days ago
    BIND(NOW() - ?change AS ?distance).
    FILTER(0 <= ?distance && ?distance < 2).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }             
} ORDER BY DESC(?change)
Try it!

Vicarage (talk) 21:32, 17 February 2023 (UTC)

Offical names for compromised ships[edit]

SELECT DISTINCT ?item ?itemLabel ?name WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
  {
    SELECT DISTINCT ?item ?name WHERE {
      ?item wdt:P31 wd:Q11446.
      ?item rdfs:label ?label. FILTER (lang(?label) = "en")
      OPTIONAL {
        ?item wdt:P1448 ?officialname.
      }
      BIND(COALESCE(?officialname,?label) AS ?name)
    }
  }
}
Try it!

Vicarage (talk) 09:59, 17 April 2023 (UTC)

Ship classes mislabelled as ships[edit]

SELECT DISTINCT ?item ?itemLabel ?name WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
  {
    SELECT DISTINCT ?item ?name WHERE {
      ?item wdt:P31/wdt:P279* wd:Q11446.
      ?item rdfs:label ?label. FILTER (lang(?label) = "en")
      FILTER(CONTAINS(?label, "class")).
      OPTIONAL {
        ?item wdt:P1448 ?officialname.
      }
      BIND(COALESCE(?officialname,?label) AS ?name)
    }
  }
}
Try it!

Vicarage (talk) 15:51, 18 April 2023 (UTC)

Ship names with '('[edit]

SELECT DISTINCT ?item ?itemLabel ?name ?classLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
  {
    SELECT DISTINCT ?item ?name ?class WHERE {
      ?item wdt:P31 wd:Q11446.
      ?item rdfs:label ?label. FILTER (lang(?label) = "en")
      OPTIONAL {
        ?item wdt:P1448 ?officialname.
      }
      BIND(COALESCE(?officialname,?label) AS ?name)
      FILTER(CONTAINS(?name, "(")).
      OPTIONAL { ?item wdt:P289 ?class.}
    }
    #LIMIT 100
  }
}
Try it!

Vicarage (talk) 23:28, 28 April 2023 (UTC)

Fortifications that are not part of a larger fortification (not working)[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P31/wdt:P279* wd:Q57821.
      ?item wdt:P17 wd:Q145.
      MINUS {
        ?item p:P361 ?partof.
        ?partof ps:P361/wdt:P31/wdt:P279* wd:Q57821.
        MINUS {
          ?partof wdt:P31 wd:Q1516079.
        }
      }
      MINUS {
        ?item wdt:P31 wd:Q1516079.
      }
      ?item rdfs:label ?name. 
      FILTER (lang(?name) = "en")
      FILTER(CONTAINS(?name, "Brougham")).
    }
  }
}
Try it!

Vicarage (talk) 10:42, 1 May 2023 (UTC)

Ship pennant edits[edit]

Hello! Regarding your recent edits like this and this, I'm assuming this was some kind of script error? Huntster (t @ c) 17:19, 9 May 2023 (UTC)

Oops, yes, I'm doing about 1000 copying from aliases, and the regexp must have got confused. I've fixed those examples, and will do a final check Vicarage (talk) 17:32, 9 May 2023 (UTC)
Thanks! And yes, there are several dozen in the same group that are likewise affected. Huntster (t @ c) 17:55, 9 May 2023 (UTC)
Fixed it, thanks for pointing it out Vicarage (talk) 18:40, 9 May 2023 (UTC)

Cor, there were a lot! I wish quickstatments had spotted my obvious syntax error. Anyway, all fixed now. see

SELECT DISTINCT ?item ?itemLabel ?itemAltLabel ?pennant WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?pennant WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q11220.
      {
        ?item p:P879 ?statement1.
        ?statement1 (ps:P879) _:anyValueP879.
      }
      ?item p:P31 ?statement2.
     ?statement2 (ps:P31/(wdt:P279*)) wd:Q3114762.
    ?item wdt:P879 ?pennant.
  ?item schema:dateModified ?change .
    FILTER(BOUND(?change) && DATATYPE(?change) = xsd:dateTime).
    # not in the future, and not more than 1 day ago
    BIND(NOW() - ?change AS ?distance).
    FILTER(0 <= ?distance && ?distance < 1).
    }
  }
Try it!

}

Thanks for pointing it out Vicarage (talk) 18:27, 9 May 2023 (UTC)

Royal Navy vessels called ships, when they could be more specific[edit]

SELECT DISTINCT ?item ?itemLabel ?classtype ?classLabel ?classtypeLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?class ?classtype WHERE {
      ?item wdt:P137  wd:Q172771.
      ?item wdt:P31 wd:Q11446.
      ?item p:P289 ?statement1.
      ?statement1 ps:P289 ?class.
      ?class wdt:P279 ?classtype.
      #?item wdt:P31 wd:Q11446.
      #?item p:P289 ?statement2.
      #?statement2 (ps:P289/(wdt:P279*)) _:anyValueP289.
    }
  }
}
Try it!
sed -Ee 's`http://www.wikidata.org/entity/(Q[0-9]*),([^,]*),http://www.wikidata.org/entity/(Q[0-9]*),([^,]*),([^,]*)`-\1|P31|Q11446 /*\2 ship*/\n\1|P31|\3 /*\2 \5*/`' query.csv Vicarage (talk) 06:05, 10 May 2023 (UTC)

Royal Navy ships without vessel_class, including no_value, optional inception or launch date[edit]

SELECT DISTINCT ?item ?label ?date WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?label ?date WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      ?item wdt:P31 wd:Q11446;
         schema:description ?description;
         rdfs:label ?label.
      OPTIONAL {?item wdt:P571 ?inception}
      OPTIONAL {?item p:P793 ?statement1. ?statement1 (ps:P793/(wdt:P279*)) wd:Q596643.
                ?statement1 pq:P585 ?launchdate}
      BIND(COALESCE(?launchdate,?inception) as ?date)
  FILTER(LANG(?label) = "en").
  FILTER(CONTAINS(?label, "HMS")).
      MINUS {
        ?item p:P289 ?statement2.
        ?statement2 (ps:P289/(wdt:P279*)) _:anyValueP289.
      }
    }
  }
}
Try it!

Vicarage (talk) 22:53, 10 May 2023 (UTC)

Royal Navy ships with no launch date[edit]

SELECT DISTINCT ?item ?itemLabel ?article WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?article WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      MINUS {
        ?item p:P793 ?statement1.
        ?statement1 (ps:P793/(wdt:P279*)) wd:Q596643.
      }
      ?item p:P31 ?statement2.
      ?statement2 (ps:P31/(wdt:P279*)) wd:Q11446.
      ?article schema:about ?item .
      ?article schema:isPartOf <https://en.wikipedia.org/>.
    }
  }
}
Try it!

with their wikipedia article, so script

cat nolaunch.csv | sed -Ee 's`http://www.wikidata.org/entity/(Q[0-9]*),([^,]*),.*wiki/(.*)`curl --silent "https://en.wikipedia.org/wiki/Special:Export/\3"  | grep -i "Ship launched" | sed -Ee \x27s\`.*=.*([0-9]{4})\`\1|P793|Q596643|P585|+\\1-00-00T00:00:00Z\/9 /* \2 */\`\x27 | grep P793`' > commands

produces commands to add the missing launch dates, at year level

Vicarage (talk) 09:37, 14 May 2023 (UTC)

ships without launch dates[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
      MINUS {
        ?item p:P793 ?statement1.
        ?statement1 (ps:P793/(wdt:P279*)) wd:Q596643.
      }
      ?item p:P31 ?statement2.
      ?statement2 (ps:P31/(wdt:P279*)) wd:Q177597.
    }
  }
}
Try it!

Vicarage (talk) 11:02, 14 May 2023 (UTC)

Forts with English and any possible foreign names[edit]

SELECT DISTINCT ?item ?itemLabel ?en_label ?label WHERE {
  SELECT DISTINCT ?item ?en_label (SAMPLE(COALESCE(?en_label, ?item_label)) as ?label) WHERE {
    ?item p:P31 ?statement0.
    ?statement0 (ps:P31/(wdt:P279*)) wd:Q1785071.
    OPTIONAL {?item rdfs:label ?en_label . FILTER(LANG(?en_label) = "en")}
    OPTIONAL {?item rdfs:label ?item_label}
    #?item wdt:P17 wd:Q794.
  }
  GROUP BY ?item ?en_label
}
Try it!

Martello Tower checks[edit]

SELECT DISTINCT ?item ?itemLabel ?itemDescription ?locationLabel ?describedLabel ?coords ?gridref WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?conservation ?location ?inception ?end ?use ?gridref ?coords ?described ?ordinal WHERE {
      ?item wdt:P31 wd:Q91285. 
      OPTIONAL {?item wdt:P31 wd:Q91285; 
        p:P31 [pq:P1545 ?ordinal]}
      ?item wdt:P17 wd:Q145.
      OPTIONAL {?item wdt:P5816 ?conservation}
      OPTIONAL {?item wdt:P131 ?location}
      OPTIONAL {?item wdt:P571 ?inception}
      OPTIONAL {?item wdt:P571 ?inception}
      OPTIONAL {?item wdt:P576 ?end}
      OPTIONAL {?item wdt:P613 ?gridref}
      OPTIONAL {?item wdt:P625 ?coords}
      OPTIONAL {?item wdt:P366 ?use}
      #OPTIONAL {?item wdt:P7959 ?county}
      OPTIONAL {?item wdt:P18 ?image}
      OPTIONAL {?item wdt:P1343 ?described}
    }
  }
}
Try it!

Vicarage (talk) 15:33, 21 July 2023 (UTC)

fortifications that have tripadvisor ids with English and foreign labels[edit]

SELECT DISTINCT ?item ?itemLabel ?en_label ?label WHERE {
  SELECT DISTINCT ?item ?en_label (SAMPLE(COALESCE(?en_label, ?item_label)) as ?label) WHERE {
    ?item p:P31 ?statement0.
    #?statement0 (ps:P31/(wdt:P279*)) wd:Q1785071.
    #?statement0 (ps:P31/(wdt:P279*)) wd:Q91122.
    ?statement0 (ps:P31/(wdt:P279*)) wd:Q16748868.
    OPTIONAL {?item rdfs:label ?en_label . FILTER(LANG(?en_label) = "en")}
    OPTIONAL {?item rdfs:label ?item_label}
    #?item wdt:P17 wd:Q794.
      ?item p:P3134 ?statement2.
      ?statement2 (ps:P3134) _:anyValueP3134.
  }
  GROUP BY ?item ?en_label
}
Try it!

Vicarage (talk) 08:44, 24 July 2023 (UTC)

Fortifications with a commons category but no image[edit]

SELECT ?item ?itemLabel ?comm ?p373 ?cat ?image WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  #?item wdt:P17 wd:Q142.

  {?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .}
  #BIND(replace(wikibase:decodeUri(SUBSTR(STR(?comm), 45)),"_"," ") AS ?comm_decode)
  #?item wdt:P373 ?p373 .
  
 #bind(COALESCE(?comm_decode, ?p373) as ?cat) .
 VALUES ?trida { wd:Q1785071 wd:Q23413 wd:Q56344492}     # fort, castle, battery
 ?item wdt:P31 ?trida.  
     MINUS { ?item wdt:P18 ?image } .
  }
Try it!

Vicarage (talk) 17:19, 24 July 2023 (UTC)

Brazillian/Soviet warships with official name by preference[edit]

SELECT DISTINCT ?item ?itemLabel ?label WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?label WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q3114762.
      VALUES ?navies { wd:Q1750688 wd:Q796754}
      ?item wdt:P137  ?navies.
      OPTIONAL {?item wdt:P1448 ?officialname}
      OPTIONAL {?item rdfs:label ?en_label . FILTER(LANG(?en_label) = "en")}
      BIND(COALESCE (?officialname, ?en_label) AS ?label)
    }
  }
}
Try it!

download query.csv then

sed -Ee 's`http://www.wikidata.org/entity/(Q[0-9]*),Japanese submarine (.*),(.*)`\1|P1448|mul:"\2" /* \3 */`' query.csv
| grep Japan Vicarage (talk) 20:12, 24 July 2023 (UTC)

Royal Navy ship classes without a named_after, with the ships that are part of the class, and match the name[edit]

SELECT DISTINCT ?item ?itemLabel ?ship ?shipLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?namedafter ?class ?ship ?shipLabel WHERE {
      ?item wdt:P31 wd:Q559026;
      rdfs:label ?itemlabel.
      MINUS {?item wdt:P138 ?namedafter.    
      ?namedafter wdt:P289 ?class.}
      ?item wdt:P137 wd:Q172771.
      ?ship wdt:P289 ?item;
      rdfs:label ?shiplabel.
      FILTER(LANG(?shiplabel) = "en").
      BIND (SUBSTR(?shiplabel,4) AS ?shiplabel1)
      FILTER (CONTAINS(?itemlabel, ?shiplabel1))
    }
  }
}
Try it!

Vicarage (talk) 09:25, 8 August 2023 (UTC)

Polish Fort Tour[edit]

SELECT DISTINCT ?item ?itemLabel ?label ?coords WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?label ?coords WHERE {
      VALUES ?item {wd:Q50774 wd:Q9363193 wd:Q9261647 wd:Q2560386 wd:Q2560391 
                    wd:Q33308522 wd:Q9261564 wd:Q33308551
                    wd:Q6424065 wd:Q104731 wd:Q160556 wd:Q5606 wd:Q41599
                    wd:Q313960 wd:Q123511 wd:Q1792 wd:Q110011}
      ?item wdt:P625 ?coords.
    }
  }
}
Try it!

Vicarage (talk) 12:54, 13 August 2023 (UTC)

Forts with 2 coordinates mentioned, sorted by distance apart[edit]

SELECT ?fort ?fortLabel ?location1 ?location2 ?distance
WHERE 
{
  ?fort wdt:P31 wd:Q1785071.
  ?fort wdt:P625 ?location1.
  ?fort wdt:P625 ?location2.
  BIND(geof:distance(?location1, ?location2) as ?distance).
  
  # deduplicate (by picking location1 to be either east or exactly north of location2)
  FILTER (
    geof:longitude(?location1) < geof:longitude($location2)|
Try it!

Forts claimed to be different, by distance apart[edit]

SELECT ?fort1 ?fort1Label ?fort2 ?fort2Label ?location1 ?location2 ?distance
WHERE 
{
  ?fort1 wdt:P31/wdt:P279* wd:Q1785071.
  ?fort1 wdt:P625 ?location1.
  ?fort1 wdt:P1889 ?fort2.
  #?fort1 wdt:P1889 ?fort2.
  ?fort2 wdt:P31/wdt:P279* wd:Q1785071.
  ?fort2 wdt:P625 ?location2.
  BIND(geof:distance(?location1, ?location2) as ?distance). 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?distance
Try it!

Vicarage (talk) 14:41, 21 August 2023 (UTC)

lead ships that don't mention it in their vessel_class[edit]

SELECT DISTINCT ?item ?itemLabel ?named ?namedLabel ?roleLabel ?classLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?named ?class ?role WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q559026.
      ?item p:P137 ?statement1.
      ?statement1 (ps:P137/(wdt:P279*)) wd:Q172771.
        ?item wdt:P138 ?named.
        #?named wdt:P289 ?class;
        #?statement2 (ps:P138/(wdt:P279*)) _:anyValueP138.
      ?named wdt:P31/wdt:P279* wd:Q1229765.
      #OPTIONAL {?named p:P289 [ ps:P289 ?class ; pq:P2868 ?role]. FILTER (?role != wd:Q2095057)}
      OPTIONAL {?named p:P289 [ ps:P289 ?class ; pq:P2868 ?role]}
      
      MINUS { ?item wdt:P31 wd:Q21514702}
  }
Try it!

}} Vicarage (talk) 07:10, 1 September 2023 (UTC)

Portugese Fortification Map[edit]

SELECT DISTINCT ?item ?itemLabel ?coords WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?coords WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q57821.
      {?item wdt:P17  wd:Q45} 
      UNION 
      {?item wdt:P17  wd:Q29}
      ?item wdt:P625 ?coords.
    }
  }
}
Try it!

Vicarage (talk) 18:51, 5 September 2023 (UTC)

Warships with more than one operator that do not map them to official name[edit]

SELECT distinct ?item ?operator1 ?operator2 ?operator1Label ?operator2Label ?itemLabel ?itemAltLabel WHERE {
  ?item wdt:P31/wdt:P279* wd:Q3114762 .
  ?item wdt:P137 ?operator1.
  ?item wdt:P137 ?operator2.
  filter (str(?operator1) != str(?operator2) )
  filter not exists {?item p:P1448/pq:P137 ?operator1 . }
  ?item wdt:P137 wd:Q172771.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }  
} order by ?itemLabel
Try it!

Use with

cat query.csv  | sed -Ee 's`http://www.wikidata.org/entity/(Q[0-9]*),http://www.wikidata.org/entity/(Q[0-9]*),http://www.wikidata.org/entity/(Q[0-9]*),(.*),(.*),(.*),(.*)`\1|P1448|mul:"\6"|P137|\2 /* \4 */\n\1|P1448|mul:"\7"|P137|\2 /* \4*/`' | grep -vEe ',"|""' Vicarage (talk) 21:35, 22 October 2023 (UTC)

Vessel classes where members have operators the class does not[edit]

SELECT DISTINCT ?item ?class ?operator ?itemLabel ?classLabel ?operatorLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?class ?operator WHERE {
      ?item wdt:P31/wdt:P279* wd:Q3114762.
      ?item wdt:P137 ?operator.
      ?item wdt:P289 ?class.
      MINUS {?class p:P137/ps:P137 ?operator .}
    }
    #LIMIT 300
  }
}
Try it!

Vicarage (talk) 13:35, 27 October 2023 (UTC)

military operations between 1707 and 1800 that have UK as participant[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GN,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q645883.
      ?item p:P580 ?statement_1.
      ?statement_1 psv:P580 ?statementValue_1.
      ?statementValue_1 wikibase:timePrecision ?precision_1.
      hint:Prior hint:rangeSafe "true"^^xsd:boolean.
      FILTER(?precision_1 >= 9 )
      ?statementValue_1 wikibase:timeValue ?P580_1.
      hint:Prior hint:rangeSafe "true"^^xsd:boolean.
      FILTER(?P580_1 >= "+1707-00-00T00:00:00Z"^^xsd:dateTime)
      #MINUS {?item p:P580 ?statement_2}
      ?item p:P582 ?statement_2.
      ?statement_2 psv:P582 ?statementValue_2.
      ?statementValue_2 wikibase:timePrecision ?precision_2.
      hint:Prior hint:rangeSafe "true"^^xsd:boolean.
      FILTER(?precision_2 >= 9 )
      ?statementValue_2 wikibase:timeValue ?P582_2.
      hint:Prior hint:rangeSafe "true"^^xsd:boolean.
      FILTER(?P582_2 < "+1800-00-00T00:00:00Z"^^xsd:dateTime)
      ?item p:P710 ?statement3.
      ?statement3 (ps:P710/(wdt:P279*)) wd:Q145.
    }
  }
Try it!

combine with

cat query.csv  | sed -Ee 's`http://www.wikidata.org/entity/(Q[0-9]*),(.*)`-\1|P710|Q145\n\1|P710|Q161885 /* \2 */`' Vicarage (talk) 13:52, 29 October 2023 (UTC)

Royal Navy ships with wrong country of origin by date[edit]

SELECT DISTINCT ?item ?itemLabel ?date WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?date WHERE {
      ?item wdt:P31/wdt:P279*  wd:Q11446.
      ?item wdt:P137 wd:Q172771.
        ?item p:P793 ?statement1.
        ?statement1 (ps:P793/(wdt:P279*)) wd:Q596643.
        ?statement1 pq:P585 ?date.
      FILTER(?date >= "+1801-00-00T00:00:00Z"^^xsd:dateTime)
      FILTER(?date < "+1922-00-00T00:00:00Z"^^xsd:dateTime)
      ?item wdt:P495 wd:Q145.
    }
  }
}
Try it!

Vicarage (talk) 13:38, 31 October 2023 (UTC)

Royal Navy ship names with official names as well[edit]

SELECT DISTINCT ?label ?item ?en_label WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?label ?en_label WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q11446.
      ?item p:P137 ?statement1.
      ?statement1 (ps:P137/(wdt:P279*)) wd:Q172771.
      OPTIONAL {?item wdt:P1448 ?officialname}
      OPTIONAL {?item rdfs:label ?en_label . FILTER(LANG(?en_label) = "en")}
      BIND(COALESCE (?officialname, ?en_label) AS ?label)
    }
Try it!

}} Vicarage (talk) 15:46, 31 October 2023 (UTC)

Forts that don't have a valid current country[edit]

SELECT ?item ?itemLabel ?country ?countryLabel WHERE {
  ?item wdt:P31 wd:Q1785071 .
  OPTIONAL {?item wdt:P17 ?country.}
  MINUS {VALUES ?countries {wd:Q35 wd:Q55 wd:Q1183 wd:Q21203 wd:Q25279 wd:Q31354462 wd:Q25305 wd:Q25230 wd:Q785  wd:Q26273
                           wd:Q26180 wd:Q25228 wd:Q9676 wd:Q4628 wd:Q42620 wd:Q1246 wd:Q244165 wd:Q23635}. ?item wdt:P17 ?countries}
  MINUS {?item wdt:P17 ?new_country . ?new_country wdt:P31 wd:Q3624078 . FILTER NOT EXISTS {?new_country wdt:P31 wd:Q3024240
Try it!
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 

} }} Vicarage (talk) 15:31, 15 November 2023 (UTC)

Military operations in admin area, not location[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P31/wdt:P279* wd:Q645883.
      ?item p:P131 ?admin_area.
      MINUS {?item p:P276 ?location}
    }
  }
}
Try it!

Vicarage (talk) 10:56, 17 November 2023 (UTC)

First commissioning date for naval vessels without service entry[edit]

SELECT DISTINCT ?item ?itemLabel ?date1 WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item (MIN(?date) as ?date1) WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q172771.
        ?item p:P793 ?statement1.
        ?statement1 (ps:P793/(wdt:P279*)) wd:Q14475832. ?statement1 pq:P585 ?date.
      ?item p:P31 ?statement2.
      ?statement2 (ps:P31/(wdt:P279*)) wd:Q177597.
      MINUS {?item wdt:P729 ?entry}
    }
    GROUP BY ?item
  } 
}
Try it!

Vicarage (talk) 21:57, 9 December 2023 (UTC)

battleships without uboat.net descriptions[edit]

SELECT DISTINCT ?item ?itemLabel ?pennant ?launchdate WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?pennant ?launchdate WHERE {
      ?item p:P31 ?statement2.
      ?statement2 (ps:P31/(wdt:P279*)) wd:Q182531.
      ?item p:P137 ?statement3.
      ?statement3 (ps:P137/(wdt:P279*)) wd:Q172771.
      ?item p:P793 ?statement1.
      ?statement1 (ps:P793/(wdt:P279*)) wd:Q596643.
      ?statement1 pq:P585 ?launchdate.
      ?statement1 (ps:P793/(wdt:P279*)) wd:Q596643.
      ?statement1 pq:P585 ?launchdate.
      FILTER (?launchdate >= "1918-01-01T00:00:00Z"^^xsd:dateTime && ?launchdate < "1946-01-01T00:00:00Z"^^xsd:dateTime)
      OPTIONAL {?item wdt:P879 ?pennant}
      MINUS {?item wdt:P1343 wd:Q21713173}
    }
  }
}
Try it!

Vicarage (talk) 11:35, 10 December 2023 (UTC)

For ships with more than one operator, report if multiple pennants are not present and characterised[edit]

SELECT ?item ?itemLabel ?oper1Label ?oper2Label ?pen1 ?pen2 ?poper1Label ?poper2Label
WHERE 
{
  ?item wdt:P137 wd:Q172771.
  ?item wdt:P31/wdt:P279* wd:Q177597.
  ?item wdt:P137 ?oper1.
  ?item wdt:P137 ?oper2.
  filter(str(?oper1) > str(?oper2))
  
  ?item p:P879 ?pstat1.
  ?item p:P879 ?pstat2.
  ?pstat1 ps:P879 ?pen1. 
  ?pstat2 ps:P879 ?pen2.
  OPTIONAL {?pstat1 pq:P137 ?poper1}
  OPTIONAL {?pstat2 pq:P137 ?poper2}
  FILTER(!BOUND(?poper1)||!BOUND(?poper2))
 
  filter(str(?pen1) > str(?pen2))
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }  
}
Try it!

Vicarage (talk) 10:59, 11 December 2023 (UTC)

naval vessels without uboat.net id[edit]

SELECT DISTINCT ?item ?label ?pennant ?launchdate WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?label ?pennant ?launchdate ?type WHERE {
      #?item wdt:P31 ?type.
      ?item wdt:P31/wdt:P279* wd:Q177597.
      #?item wdt:P137 wd:Q172771.
      ?item p:P793 ?statement1.
      ?statement1 (ps:P793/(wdt:P279*)) wd:Q596643.
      ?statement1 pq:P585 ?launchdate.
      FILTER (?launchdate >= "1918-01-01T00:00:00Z"^^xsd:dateTime && ?launchdate < "1946-01-01T00:00:00Z"^^xsd:dateTime)
      MINUS {?item wdt:P1343 wd:Q21713173}
      OPTIONAL {?item wdt:P879 ?pennant}
      OPTIONAL {?item wdt:P1448 ?officialname}
      OPTIONAL {?item rdfs:label ?en_label . FILTER(LANG(?en_label) = "en")}
      BIND(COALESCE (?officialname, ?en_label) AS ?label)
    }
  }
} ORDER BY ?label
Try it!

Vicarage (talk) 22:14, 11 December 2023 (UTC)

Properties of Maunsell forts[edit]

SELECT DISTINCT ?item ?itemLabel ?coords ?stateLabel ?operatorLabel ?locationLabel ?url ?countryLabel ?inception WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?coords ?state ?operator ?location ?url ?country ?inception WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q1911186.
      OPTIONAL {?item wdt:P625 ?coords.}
      OPTIONAL {?item wdt:P5816 ?state.}
      OPTIONAL {?item wdt:P137 ?operator.}
      OPTIONAL {?item wdt:P276 ?location.}
      OPTIONAL {?item wdt:P973 ?url.}
      OPTIONAL {?item wdt:P17 ?country.}
      OPTIONAL {?item wdt:P571 ?inception.}
    }
    LIMIT 100
  }
}
Try it!

Vicarage (talk) 11:03, 16 December 2023 (UTC)

Forts in a real country, even if historical country mentioned[edit]

SELECT DISTINCT ?item ?itemLabel ?country1Label ?country2Label WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?country1 ?country2 WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q1785071.
      ?item wdt:P17 ?country1.
      ?item wdt:P17 ?country2.
      filter(str(?country1) != str(?country2))
      {{?country1 wdt:P31 wd:Q3024240}. MINUS{?country2 wdt:P31 wd:Q3024240}}
      {{?country2 wdt:P31 wd:Q3024240}. MINUS{?country1 wdt:P31 wd:Q3024240}}
    }
  }
}
Try it!

Vicarage (talk) 15:28, 16 December 2023 (UTC)

Battles with identical names[edit]

SELECT DISTINCT ?item ?time1 ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item (SAMPLE(?time) as ?time1) WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q645883.
      OPTIONAL {?item wdt:P580 ?start.}
      OPTIONAL {?item wdt:P585 ?point}
      BIND(COALESCE(?point,?start) as ?time)
      MINUS {?item wdt:P1889 ?different}
      
    }
    GROUP BY ?item
  }
}
Try it!

and then run

grep -v ',,' query.csv | sort -k3 -t,| sed -Ee 's` `_`g;s`,` `g' | uniq -f 2 -D Vicarage (talk) 16:27, 16 December 2023 (UTC)

Battles with dodgy participants[edit]

Not countries, humans or ethnic groups

SELECT DISTINCT ?item ?itemLabel ?participant ?participantLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?participant WHERE {
      #?item wdt:P31/wd:P279* wd:Q178561.
      ?item wdt:P31 wd:Q178561.
      ?item wdt:P710 ?participant.
      MINUS {{?participant wdt:P31 wd:Q5} UNION {?participant wdt:P31 ?country} UNION {?participant wdt:P31/wdt:P279* wd:Q41710}}
    }
  }
}
Try it!

Vicarage (talk) 10:33, 19 December 2023 (UTC)

Military occupations with dodgy countries[edit]

SELECT DISTINCT ?item ?itemLabel ?country ?countryLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?country WHERE {
      ?item wdt:P31/wdt:P279* wd:Q645883.
      ?item wdt:P17 ?country.
      MINUS {{?country wdt:P31/wdt:P279* wd:Q1048835} UNION {?country wdt:P31/wdt:P279* wd:Q164950}
             UNION {?country wdt:P31/wdt:P279* wd:Q170156} UNION {?country wdt:P31/wdt:P279* wd:Q1620908}}
    }
  }
}
Try it!

Vicarage (talk) 09:22, 22 December 2023 (UTC)

country demonyms[edit]

SELECT DISTINCT ?itemLabel ?item ?demonym  WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?item wdt:P31 wd:Q6256.
  MINUS {?item wdt:P31 wd:Q3024240}
  ?item wdt:P1549 ?demonym. FILTER (lang(?demonym) = "en")
}
Try it!

Vicarage (talk) 08:54, 15 January 2024 (UTC)

current navies[edit]

SELECT DISTINCT ?itemLabel ?item ?country WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en,fr,de,es,pt,pl,nl,cs". }
    ?item wdt:P31 wd:Q4508.
    ?item wdt:P17 ?country
    MINUS {?country wdt:P31 wd:Q3024240} # historical country
    MINUS {?item wdt:P576 ?end}
  } ORDER BY ?itemLabel
Try it!

Vicarage (talk) 08:45, 17 January 2024 (UTC)

Battles where the county wasn't extant at the time[edit]

Changes made on 2nd Feb 2024

SELECT ?item ?itemLabel ?country ?poi ?min_inception ?max_dissolved WITH {
  SELECT ?item ?country (MIN(?inception) as ?min_inception) (MAX(?dissolved) as ?max_dissolved) WHERE
  {
 
  ?item wdt:P31/wdt:P279* wd:Q178561. # battle
  ?item schema:dateModified ?date . hint:Prior hint:rangeSafe true.
  FILTER("2024-02-02"^^xsd:dateTime <= ?date &&
         ?date < "2024-02-03"^^xsd:dateTime)
  ?item wdt:P17 ?country.
  ?country wdt:P571 ?inception.
  ?country wdt:P576 ?dissolved.
  } GROUP BY ?item ?country } as %i
WHERE
{
  INCLUDE %i
  ?item wdt:P585 ?poi.
  FILTER (?poi - ?max_dissolved > 600|| ?poi - ?min_inception < -600)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". } 
}
Try it!

Battles without English labels[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
    ?item wdt:P31 wd:Q178561.
    MINUS {?item rdfs:label ?en_label . FILTER(LANG(?en_label) = "en")}
  ?item wdt:P585 ?poi.
#  ?item wdt:P17 wd:Q183.
 #   ?article schema:about ?item .
#    ?article schema:isPartOf <https://en.wikipedia.org/>.
#  ?item wdt:P17 ?country.
#  ?article2 schema:about ?item ;
#            schema:inLanguage ?lang ;
#            schema:isPartOf [ wikibase:wikiGroup "wikipedia" ] .
#  ?country wdt:P37/wdt:P424 ?lang.

}{ bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
}
Try it!

Properties where the URL format doesn't have a language qualifier[edit]

SELECT DISTINCT ?item ?itemLabel ?itemDescription ?formatter ?languageLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?formatter ?language WHERE { 
      ?item wdt:P1630 ?for.
      MINUS {?item wdt:P31 ?instance;
      p:P1630 [ ps:P1630 ?formatter ; pq:P407 ?language].}
      ?item wdt:P17 wd:Q145.
    }
  }
}
Try it!

Qualifiers[edit]

SELECT DISTINCT ?item ?ordinal ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
  {
    SELECT DISTINCT ?item ?ordinal WHERE {
      ?item wdt:P31 wd:Q91285;
      p:P31 [ pq:P1545 ?ordinal].
    }
  }
}
Try it!