0

I'm using Reality Gem to Query Wikidata, using this code below. But it gives nil output. i've checked using result.methods command but i dont't see any method to view "part_of" or "instance_of" property values

require 'reality'    
result = Reality::Entity("Enterprise JavaBeans")
result.part_of
=> nil

However on wikidata page these properties are available:

https://www.wikidata.org/wiki/Q742961

Can someone help me please?

sondra.kinsey
  • 583
  • 7
  • 18

1 Answers1

1

I don't know why this error is happening.
I guess it's because the document structures on Wikidata and Wikipedia aren't the same.

But you can get around with the following hacky:

require 'reality'

w = Reality::Wikidata::Entity.one_by_id('Q742961')
e = Reality::Entity::WikidataPredicates.parse(w)
e[:part_of]
Lucas Costa
  • 1,109
  • 9
  • 16