gsi-upm / sematch

semantic similarity framework for knowledge graph
http://gsi-upm.github.io/sematch/
Other
426 stars 109 forks source link

Path between entities #15

Open orenpapers opened 6 years ago

orenpapers commented 6 years ago

Hello, Is it possible to get hiererchical path distance between entities?

For example, Madrid -> Cities in spain -> Barcelon (distance = 1) Madria -> Cities in spain -> Cities in europe -> Rome (distance = 2)

Thanks

hopple commented 6 years ago

Yes, for such taxonomical relation, you need to use Sematch to load Wikipedia category taxonomy.

orenpapers commented 6 years ago

Do you mean like here in DBpedia Entity Similarity / DBpedia Concept Similarity? http://gsi-upm.github.io/sematch/similarity/ I tried it but I have some problems:

  1. How can I see the path for a given entity/concept?
  2. What is the difference between entity and concept?
  3. How can I get the entity of a given word? for concept I can use: concept.name2concept(), but there is no such a function for entity.name2entitiy()?

Thanks!

hopple commented 6 years ago

In sematch/semantic/sparql.py you can find a class called NameSPARQL, there you can find name2entities, which is simply implemented based on exact string matching to entity names.

Regarding to your question 1, what I mean is you need to load the corresponding Wikipedia category taxonomy in DBpedia, which you need to download from DBpedia dataset. Then you can use sematch/semantic/graph.py to load the taxonomy data, and then use similarity interface.