Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree view only maps Wikidata entities to tree nodes #21

Open
1ec5 opened this issue Sep 7, 2020 · 1 comment · May be fixed by Sophox/wikidata-query-gui#2
Open

Tree view only maps Wikidata entities to tree nodes #21

1ec5 opened this issue Sep 7, 2020 · 1 comment · May be fixed by Sophox/wikidata-query-gui#2

Comments

@1ec5
Copy link
Member

1ec5 commented Sep 7, 2020

The Tree view only creates nodes for Wikidata entities, not OSM Wiki data items or OSM elements. For example, this query displays nothing even though the table view shows a row for most of the U.S. states:

#defaultView:Tree
SELECT ?osm ?name WHERE {
  ?osm osmt:boundary "administrative";
       osmt:admin_level "4";
       osmt:is_in:country_code "US";
       osmt:name ?name.
}

But replacing the OSM element with a Wikidata entity in the output results in a node for each state:

#defaultView:Tree
SELECT ?wd ?name WHERE {
  ?osm osmt:boundary "administrative";
       osmt:admin_level "4";
       osmt:is_in:country_code "US";
       osmt:name ?name;
       osmt:wikidata ?wd.
}
@1ec5
Copy link
Member Author

1ec5 commented Sep 7, 2020

The Tree view only displays entities:

https://github.com/Sophox/wikidata-query-gui/blob/3a361428748166f1377f47ac620413df3547f533/wikibase/queryService/ui/resultBrowser/TreeResultBrowser.js#L193-L199

The definition of an entity is limited to Wikidata entities according to a rigid URL pattern:

https://github.com/Sophox/wikidata-query-gui/blob/3a361428748166f1377f47ac620413df3547f533/wikibase/queryService/ui/resultBrowser/helper/FormatterHelper.js#L270-L273

This method is also used in a few other places, all of which seem like they’d benefit from treating OSM Wiki data items and OSM elements the same way as Wikidata entities:

https://github.com/wikimedia/wikidata-query-gui/search?q=isEntityUri

A workaround is to append a corresponding Wikidata entity URL (or a made-up one) to the OSM element URL:

BIND(IRI(CONCAT(STR(?osm), "?entity=", STR(?wd))) AS ?item)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant