简体   繁体   中英

How to read from Java a RDF freebase concept?

I would like to read a freebase dump like this from Java:

http://rdf.freebase.com/ns/m.0cycc

I tried to read it from Jena using the following code:

    OntModel om = ModelFactory.createOntologyModel();
    om.read(freebaseURL, "N3");

But I got an Exception:

org.apache.jena.riot.RiotException: [line: 34, col: 37] illegal escape sequence value: x (0x78)

Is there a way to..

a) automatically escape these characters? (I found this post, but it seems to be a manual solution, and I need an automatic one: How to read Freebase RDF data? It seems to be a bit broken )

or

b) read the file content using some other API? At the end I want to obtain some concrete values. I think that I can develop a parsing algorithm for this kind of file structure, but if something is already done..

Thanks

I've created a code that "fix" my current problems. Probably this is not an universal fix (in fact, my fix is adapted to my needs, and in this case the fix makes that some content will be lost.. but for me is ok at this moment).

I attach a link to the code:

https://github.com/alejandrorg/VariousCodes/blob/master/FreebaseFixer.java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM