Jena read from turtle fails

后端 未结 2 1601
半阙折子戏
半阙折子戏 2021-01-12 11:47

I have just imported jena libraries to eclipse to work on rdf-s and it is my first try, but I cannot read a turtle (.ttl) file.

I tried it in the following way:

2条回答
  •  一向
    一向 (楼主)
    2021-01-12 12:22

    The read method you are using assumes that the input format is RDF/XML.

    you need to use one of the other read methods.

    So it would be:

    public static void main(String[] args) throws IOException {
        Model model=ModelFactory.createDefaultModel();
        model.read(new FileInputStream("simpsons.ttl"),null,"TTL");
    }
    

提交回复
热议问题