0

I want to get triples which has a specific tail. For example get triples with /m/3s31es as their tail and the results like:

/m/111111      /has/name      /m/3s31es
/m/222222      /has/city      /m/3s31es
/m/333333      ...            /m/3s31es
...

Is there an freebase api to implement this? Thank you

finch
  • 97
  • 8
  • The "tail" is usually called the *object* in RDF. If you have this as RDF, then you could query with SPARQL: `select ?s ?p ?o where { values ?o { /m/3s31es } ?s ?p ?o }`. – Joshua Taylor Feb 10 '15 at 14:16

1 Answers1

1

The Freebase RDF endpoint only serves up single RDF documents. There is no API associated with it (SPARQL or otherwise).

You have three choices:

  1. Do your querying using the Freebase MQLRead API (perhaps using the results to retrieve RDF documents if that's the final format that you want).

  2. Download the RDF dump, load it in a RDF triplestore and use SPARQL or whatever query language the triplestore supports.

  3. Download the RDF dump and use zgrep to find all the triples which match your desired pattern.

The first option will be quickest for small amounts of data and #3 will be quickest for larger amounts of data. If you're going to have to do this a lot, the extra upfront costs of #2 may be worth it.

Tom Morris
  • 10,270
  • 29
  • 52
  • Thank for your answer. I want to build a SPARQL server by myself, can you please recommend a system to me which is easy to build? Thank you so much! – finch Feb 11 '15 at 07:36
  • Sorry, I don't have any recommendations in that space. There are some options listed on this W3C page: http://www.w3.org/wiki/LargeTripleStores – Tom Morris Feb 11 '15 at 16:58