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
>