Ivo
Ivo

Reputation: 11

How find "main" type for given topic in freebase RDF?


I need find "main type" for a given topic in the RDF file.
When I am typing question to search box on http://www.freebase.com, auto-completer give me name of topic with this "main type".
For example:

  1. When I write "Barack Oba", I can see "Barack Obama - U.S. President". Topic "Barack Obama" has many types, but how can I find in the RDF file that major is a "U.S. President"?
  2. Similary "Woody Allen" => "screenwriter"
  3. "EOS 400D" => "Digital Camera"

How can I find this "main type" in the RDF representation?

Thank you for your help.

Upvotes: 1

Views: 157

Answers (2)

Tom Morris
Tom Morris

Reputation: 10540

Notable types aren't included the RDF dump yet. Google has said that they will be, but hasn't provided a schedule.

Upvotes: 1

RobV
RobV

Reputation: 28655

Presumably you define "main type" fairly loosely i.e. you aren't too worried about exact contextual matching and just want the "most popular" option?

Assuming you can write and run SPARQL queries the best way to do this is likely to run a query that finds a textual match for the text to auto-complete and finds the most used term associated with that e.g.

SELECT ?term (COUNT(*) AS ?triples)
{
  ?term ?property ?value .
  FILTER(REGEX(?value, "Barack Oba", "i"))
} GROUP BY ?term ORDER BY DESC(?triples) LIMIT 1

Note that use of REGEX here can seriously hurt performance, depending on the underlying SPARQL implementation there may be much more efficient ways to do this kind of textual search query.

Upvotes: 0

Related Questions