Hello
Thanks. I tried and I am getting the same problem
In fact my file is stored here: C:\Users\chiva\Downloads\test.rdf and the 
output in the console of System.out.println(selectedFile); is 
C:\Users\chiva\Downloads\test.rdf

Even if I do like this RDFDataMgr.read(model, new 
FileInputStream("C:\\Users\\chiva\\Downloads\\test.rdf" ), Lang.RDFXML);

I still get:
 Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 4: 
file:location-mapping.rdf

-----Original Message-----
From: Lorenz Buehmann <[email protected]> 
Sent: Tuesday, October 29, 2019 10:23 AM
To: [email protected]
Subject: Re: java.nio.file.InvalidPathException: Illegal char <:> at index 4: 
file:location-mapping.rdf

file:location-mapping.rdf is not a valid path in Java. Try Model model = 
ModelFactory.createDefaultModel(); RDFDataMgr.read(model, new 
FileInputStream(selectedFile), Lang.RDFXML); maybe this works. Or use the 
absolute path of the file object.

> Hi
>
> I am trying to import rdf schema file (RDF/XML) but when I use this 
> code below I am getting the a lots of messages and I see this
> java.nio.file.InvalidPathException: Illegal char <:> at index 4: 
> file:location-mapping.rdf
>
> I wonder if I need some specific setup or do I need to create 
> location-mapping.rdf?
>
> FileChooser filechooser = new FileChooser(); 
> filechooser.getExtensionFilters().addAll(new 
> FileChooser.ExtensionFilter("RDF files", "*.rdf")); File selectedFile 
> = filechooser.showOpenDialog(null); if (selectedFile != null) {
>     System.out.println(selectedFile);
>     Model model = 
> FileManager.get().loadModel(selectedFile.toString());
>
>
> In general what I would like to achieve is to be able to read rdf schema file 
> and also at later stage to read rdf xml instance data based on the schema.
> I tried to use RDFDataMgr and RDFParser to do the read, but I am kind of 
> hitting to the same “java.nio.file.InvalidPathException: Illegal char <:> at 
> index 4: file:location-mapping.rdf” which leads me to think that I am missing 
> something from the basic setup. I was looking at a lot of examples, but 
> somehow could not get oriented so far.
>
> Regards
> Chavdar
>

Reply via email to