Model is for triples. You have to use Dataset for quads.

https://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/query/Dataset.html

On Wed, Apr 22, 2015 at 9:48 PM, Wojciech Ciesielski <[email protected]> wrote:
> Hi
> On start sorry for my bad english.
> I must do small example project for my study with read/write RDF graph from
> file.
> With Turtle,N-Triples, RDF/XML i dont have any problem i use:
>
> FileManager.get().addLocatorClassLoader(Main.class.getClassLoader());
>         Model model = null;
>         try
>         {
>             model= FileManager.get().loadModel("./plik.ttl");
>         }
>         catch(Exception e)
>         {
>             System.out.println(e);
>         }
> model.write(System.out,"TURTLE");
> model.write(System.out,"N-TRIPLES");
> model.write(System.out);
>
> But when i try read TriG or N-Quads file
> my file example (Da.txt):
>
> <http://example/A> <http://example/B> <http://example/C> <http://example/D>
> .
>
> using:
> Model nowy= FileManager.get().loadModel("./Da.txt", "N-QUADS");
> nowy.write(System.out, "TRIG");
> nowy.write(System.out, "NQUADS");
>
> log4j: reset attribute= "false".
> log4j: Threshold ="null".
> log4j: Level value for root is  [DEBUG].
> log4j: root level set to DEBUG
> log4j: Class name: [org.apache.log4j.ConsoleAppender]
> log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
> log4j: Setting property [conversionPattern] to [%d{yyyy-MM-dd HH:mm:ss} %-5p
> %c{1}:%L - %m%n].
> log4j: Adding appender named [console] to category [root].
> 2015-04-22 21:45:28 DEBUG JenaIOEnvironment:181 - Failed to find
> configuration:
> location-mapping.ttl;location-mapping.rdf;location-mapping.n3;etc/location-mapping.rdf;etc/location-mapping.n3;etc/location-mapping.ttl
> 2015-04-22 21:45:28 DEBUG FileManager:257 - loadModel(./plik.ttl)
> 2015-04-22 21:45:28 DEBUG StreamManager:112 - Not mapped: ./plik.ttl
> 2015-04-22 21:45:28 DEBUG StreamManager:93 - open(./plik.ttl)
> 2015-04-22 21:45:28 DEBUG StreamManager:112 - Not mapped: ./plik.ttl
> 2015-04-22 21:45:28 DEBUG StreamManager:142 - Found: ./plik.ttl
> (LocatorFile)
> 2015-04-22 21:45:28 DEBUG RDFDataMgr:875 - Found: ./plik.ttl
> 2015-04-22 21:45:28 DEBUG FileManager:274 - loadModel(./Da.txt, N-QUADS)
> 2015-04-22 21:45:28 DEBUG StreamManager:112 - Not mapped: ./Da.txt
> 2015-04-22 21:45:28 DEBUG StreamManager:93 - open(./Da.txt)
> 2015-04-22 21:45:28 DEBUG StreamManager:112 - Not mapped: ./Da.txt
> 2015-04-22 21:45:28 DEBUG StreamManager:142 - Found: ./Da.txt (LocatorFile)
> 2015-04-22 21:45:28 DEBUG RDFDataMgr:875 - Found: ./Da.txt
> 2015-04-22 21:45:28 WARN  riot:77 - Only triples or default graph data
> expected : named graph data ignored
> com.hp.hpl.jena.shared.NoWriterForLangException: TRIG
>
> Im realy "green" in Jena and RDF.
> I use Windows 7 64bit and NetBeans 8.0.2
>
> Can someone explain me how to read/write N-Quads and TriG?
> Realy thx for any anwser
>
> --
> Pozdrawiam
> Wojciech Ciesielski
>

Reply via email to