Lucas_Werkmeister_WMDE created this task.
Lucas_Werkmeister_WMDE added a project: Wikidata-Query-Service.
Restricted Application added a subscriber: Aklapper.
Restricted Application added a project: Wikidata.

TASK DESCRIPTION
  Ethan Gruber reported on Twitter 
<https://twitter.com/ewg118/status/1186733937214873601> that this query 
incorrectly returns a Geonames URI without a trailing slash:
  
    CONSTRUCT {
      ?place a skos:Concept; 
                   skos:prefLabel ?placeLabel;
               skos:exactMatch ?osgeo;
               skos:exactMatch ?tgn;
               skos:exactMatch ?geonames ;
               skos:exactMatch ?pleiades ;
               dct:coverage ?coord .
    }
    WHERE {
      ?place wdt:P1667 "7015539" .
      OPTIONAL {?place wdt:P3120 ?osgeoid .
        BIND (uri(concat("http://data.ordnancesurvey.co.uk/id/";, ?osgeoid)) as 
?osgeo)
      }
      OPTIONAL {?place wdt:P1667 ?tgnid .
        BIND (uri(concat("http://vocab.getty.edu/tgn/";, ?tgnid)) as ?tgn)}
      OPTIONAL {?place wdt:P1566 ?geonamesid .
        BIND (uri(concat("http://sws.geonames.org/";, ?geonamesid, "/")) as 
?geonames)}
      OPTIONAL {?place wdt:P1584 ?pleiadesid .
        BIND (uri(concat("https://pleiades.stoa.org/places/";, ?pleiadesid)) as 
?pleiades)}
      OPTIONAL {?place p:P625/ps:P625 ?coord}
      SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en"
      }
    }
  
  Note that he explicitly concatenates a `"/"` to it, yet it’s still not in the 
result:
  
  | subject | predicate                         | object                        
          |
  | ------- | --------------------------------- | 
--------------------------------------- |
  | wd:Q931172    | rdf:type                          | skos:Concept            
                |
  | wd:Q931172    | skos:prefLabel                    | Vulci                   
                |
  | wd:Q931172    | skos:exactMatch                   | 
http://vocab.getty.edu/tgn/7015539      |
  | wd:Q931172    | skos:exactMatch                   | 
http://sws.geonames.org/3163940         |
  | wd:Q931172    | skos:exactMatch                   | 
https://pleiades.stoa.org/places/413393 |
  | wd:Q931172    | http://purl.org/dc/terms/coverage | Point(11.631666666 
42.418888888)                        |
  |
  
  I managed to reduce it to this shorter query:
  
    SELECT ?g {
      BIND(<http://sws.geonames.org/1/> AS ?g)
      OPTIONAL { BIND("" AS ?_) }
    }
  
  If the `BIND` is removed, or made non-optional, the bug doesn’t occur. It 
also doesn’t happen if you change anything in the domain part of the URI.
  
  I assume this is related to the `TrailingSlashRemovingInlineUriHandler` that 
we register for Geonames URIs 
<https://github.com/wikimedia/wikidata-query-rdf/blob/828cf4142f2c715d8cc24d672b3413dc6e530a48/blazegraph/src/main/java/org/wikidata/query/rdf/blazegraph/WikibaseInlineUriFactory.java#L56-L58>,
 though I’m not sure why it only seems to remove the slash in combination with 
an optional bind.

TASK DETAIL
  https://phabricator.wikimedia.org/T236250

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Aklapper, Lucas_Werkmeister_WMDE, darthmon_wmde, DannyS712, Nandana, Lahi, 
Gq86, GoranSMilovanovic, QZanden, EBjune, merbst, LawExplorer, _jensen, 
rosalieper, Jonas, Xmlizer, jkroll, Smalyshev, Wikidata-bugs, Jdouglas, aude, 
Tobias1984, Manybubbles, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to