1

I want to export all data XML/RDF/OWL (ontology) about resource from wikidata or dbpedia. (with all children elements, statements, nested data -database dump)

I'm looking for tool or api or code, and advice how to do that.

Let's say I want all data, and all statements about series How I met your mother, actors, roles, episodes, everything,also their classes and properties (statements).

Link: https://www.wikidata.org/wiki/Q147235 Entity->Q147235

Can maybe SPARQL be written for that, something like this, but with all nested classes, properties, individuals

SELECT ?himym 
WHERE {
  BIND(wd:Q147235 as ?himym) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}

So the main goal is retrieving database data in rdf/owl.

To be more specific, what I'm looking for something like this, view-source:http://dbpedia.org/data/Friends.rdf but, also statements-resources-about nested data ex. characters, actors, ... up to 3-4 levels of nesting?

lostSoul
  • 11
  • 2
  • You can simply use `curl` or `wget` with the entity URI `https://www.wikidata.org/entity/Q147235` - in the accept header you can specify the format, default is JSON as you can see – UninformedUser Jan 17 '21 at 06:10
  • otherwise, indeed you can use SPARQL, use the search next time, you're not the first by far: https://stackoverflow.com/questions/46383784/wikidata-get-all-properties-with-labels-and-values-of-an-item/46385132 – UninformedUser Jan 17 '21 at 06:11
  • thanks for commenting, unfortunately that doesn't help me , it only gets first level data, and I need all nested data and classes,or at least 4-5 nested levels data, like database dump file. – lostSoul Jan 17 '21 at 15:10
  • then yo have to extend the query to get also the data about the connected resources. I don't see the difficulty here. I mean, instead of doing `SELECT * where {:A ?p ?o}` you do `SELECT * where {:A ?p1 ?o1 OPTIONAL {?o1 ?p2 ?o2}}` - and so on and so forth. Indeed, for getting proper RDF data you have to put it into a `CONSTRUCT` query. And indeed, for Wikidata, to not only get the truthy data, you have to use the pattern shown in the link of my previous comment. And yes, for depth 5 or something you might get a timeout on a public service for sure given that this can result in a huge chunk. – UninformedUser Jan 17 '21 at 20:29

1 Answers1

0

You can use the linked data interface as described here.

In your specific case, this link will download as an attachment the record in rdf format:

https://www.wikidata.org/wiki/Special:EntityData/Q147235.rdf

Regarding the level of nesting, is not clear what is the specific query maybe a tool like wikidata-graph-builder by AngryLoki might help:

https://angryloki.github.io/wikidata-graph-builder/?property=P161&item=Q147235&iterations=4&mode=both

G M
  • 20,759
  • 10
  • 81
  • 84