5

I am struggling with DBpedia. The description is unclear (to the point that for me it is hard to tell which data can be obtain, which - cannot), and (what is worst) it does not have many examples (direct links) I could learn from.

I want to get all "influences" and "influencedBy" fields for all philosophers, preferably in JSON format.

The closest things I found are:

http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=DESCRIBE+%3Chttp://dbpedia.org/resource/Bertrand_Russell%3E&output=application%2Fmicrodata%2Bjson

http://dbpedia.org/data/Bertrand_Russell.json

But it is:

  • per-person (it is not clear if it is only way to query)
  • a lot of other data I don't care about (heavy)
  • even "influences" are passes in complicated format (OK, this thing is not the worst, but I maybe there is something lighter)

Ideally something like:

[{"name": "Bertrand_Russell",
  "influences": ["Euclid", "John_Stuart_Mill", ...],
  "influencedBy": ["Ludwig_Wittgenstein", "A._J._Ayer"]},
 ...
]

(Whether in a single query, or in a few.)

Is it possible? How?

svick
  • 869
  • 4
  • 9
Piotr Migdal
  • 824
  • 6
  • 14

1 Answers1

5

Using this SPARQL end-point: http://dbpedia.org/sparql you can enter this query:

SELECT DISTINCT ?YA ?A ?YB ?B where {
  ?A dbo:influenced ?B.
  ?A a dbo:Philosopher.
  ?B a dbo:Philosopher.
  ?A dbo:birthYear ?YSA.
  ?B dbo:birthYear ?YSB.
  BIND( SUBSTR( xsd:string(?YSA), 1, 4) AS ?YA )
  BIND( SUBSTR( xsd:string(?YSB), 1, 4) AS ?YB )
} LIMIT 10000

which will give you a list of pairs of philosophers (influencer, influencee) and their years of birth. You can choose JSON as the results format.

Bolo
  • 258
  • 1
  • 8