noam-honig / wikiloc

11 stars 8 forks source link

Get more metadata on wikipedia articles and use the to provide some filtering functionality #2

Open noam-honig opened 1 year ago

noam-honig commented 1 year ago

Explore RDF data & DBPedia and Wikidata and SPARQL

There was a great talk by [Daniel Beeke] (https://github.com/danielbeeke) at ViennaJS about querying Wikipedia data; here's the video: https://www.youtube.com/live/MiROHWXA5lo?feature=share&t=4062

And here's the presentation: https://danielbeeke.nl/querying-wikipedia/

danielbeeke commented 1 year ago

He Noam,

Here is a start of a query. I will have a look tomorrow to integrate it.

# Give us all the bindings that we use in the query.
SELECT * WHERE {

  # This select the wikibase non SPARQL Geo service.
  # We request ?place where it fits with the rest of the given parameters.
  # Like the center and the radius.
  SERVICE wikibase:around { 
      ?place wdt:P625 ?location . 
      bd:serviceParam wikibase:center "Point(16.3725 48.208333333)"^^geo:wktLiteral . 
      bd:serviceParam wikibase:radius "100" . 
      bd:serviceParam wikibase:distance ?dist.
  } 

  # Give us the label of the place
  ?place rdfs:label ?label .
  # Just English labels
  FILTER (lang(?label) = 'en')

  # Only give us place where it is an airport via "instance of" or "instance of followed by zero or more relations of subclass of".
  # See https://www.w3.org/TR/sparql11-property-paths/#path-language
  FILTER EXISTS { ?place wdt:P31/wdt:P279* wd:Q1248784 }
} 

# Order by the distance
ORDER BY ASC(?dist)
noam-honig commented 1 year ago

Hi @danielbeeke,

Thanks for that, but I still need some guidance. Consider the result of the following query, which gets additional info based on ids: https://he.wikipedia.org/w/api.php?action=query&pageids=1686801|1224770|7895|97390|97386|926423|887154|51080|372193|1883931|947160|1071565|99384&format=json&prop=description|pageimages&origin=*

I want to be able, for these same ids, to query their metadata - for example, article type.

  1. I would love an example of that
  2. I would love some legends on identifying the different properties.