Search code examples
sparqlfreebasemqltriplestore4store

Import Freebase to Triplestore


I'm currently planning a big project containing big data.

I already used the search and all results tell me that it's not possible to import Freebase into any triplestore without usage of 3rd Party Tools like BaseKB or Freebase to RDF

As I can see, the dump is already available as RDF, so where is the problem if I want to import the dump into my 4store triplestore and access the data via SPARQL?


Solution

  • For everybody having Problems importing the Freebase Dump:

    1) Keep your RDF/Turtle Parser updated. (Latest Version of raptor 2 can recognize the '.', e.g. at ns:common.topic.notable_for.example

    2) The dump must be cleaned up before you can import it. I used this scipt: http://people.apache.org/~andy/Freebase20121223/ (fixit)

    3) The Turtle specification only allows these characters for URIs:

    ::= '<' ([^#x00-#x20<>\"{}|^`\] | UCHAR)* '>'
    

    So it's very important to add this line to the fixit script at line 80:

    $X =~ s/\\>/%3E/g ;
    $X =~ s/\\.//g ;
    
    # Add this Line
    $X =~ [\x00-\x20\<\>\"\{\}\|\^\`] ;
    
    $obj = "<".$X.">" ;
    

    As a result, invalid syntax like this:

    <http://www.wikipedia.org/object?key={invalid_braces}>
    

    becomes

    <http://www.wikipedia.org/object?key=invalid_braces>