Hello
By some reason the workaround below does not work for
OntModel model1 = ModelFactory.createOntologyModel(
OntModelSpec.RDFS_MEM_RDFS_INF);
But works for
Model model = ModelFactory.createDefaultModel();
Do you know what the reason could be? I saw that the fix was done, but do you
know when Maven will be updated?
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 4:
file:ont-policy.rdf
at
java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at
java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at
java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at
java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
at
java.base/jdk.internal.module.Resources.toSafeFilePath(Resources.java:143)
at java.base/jdk.internal.module.Resources.toFilePath(Resources.java:97)
at
java.base/jdk.internal.module.ModuleReferences$ExplodedModuleReader.find(ModuleReferences.java:382)
at
java.base/jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:430)
at
java.base/jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:425)
at
java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
at
java.base/jdk.internal.loader.BuiltinClassLoader.findMiscResource(BuiltinClassLoader.java:424)
at
java.base/jdk.internal.loader.BuiltinClassLoader.findResource(BuiltinClassLoader.java:311)
at java.base/java.lang.ClassLoader.getResource(ClassLoader.java:1400)
at
java.base/java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1736)
at
[email protected]/org.apache.jena.util.LocatorClassLoader.open(LocatorClassLoader.java:63)
at
[email protected]/org.apache.jena.util.FileManager.openNoMapOrNull(FileManager.java:523)
-----Original Message-----
From: Dr. Chavdar Ivanov <[email protected]>
Sent: Tuesday, October 29, 2019 8:43 PM
To: [email protected]
Subject: RE: java.nio.file.InvalidPathException: Illegal char <:> at index 4:
file:location-mapping.rdf
Hello Andy, all,
Adding -DLocationMap=
In the "Edit custom VM options" in Intelij didn't help. I was actually not sure
if this is the right place
However I was trying some other things and I found a good post here:
https://www.oipapio.com/question-8593703
So adding
import org.apache.jena.util.LocationMapper;
and calling LocationMapper.setGlobalLocationMapper(new LocationMapper());
did the trick.
Perhaps https://issues.apache.org/jira/browse/JENA-1775 could be updated
Best regards
-----Original Message-----
From: Andy Seaborne <[email protected]>
Sent: Tuesday, October 29, 2019 11:52 AM
To: [email protected]
Subject: Re: java.nio.file.InvalidPathException: Illegal char <:> at index 4:
file:location-mapping.rdf
file:location-mapping.rdf is a Jena system file.
It's also an area of the code that has not changed for quite some time.
I notice this is running Java13 on Windows.
The project does run the core test suite on Java13 although on Linux.
I would not be surprised if the rules for naming are tighten up in Java13. The
error is from the Windows specific JRE code.
From looking at the code:
Setting the default places to look for the lcoation mapping file is controlled
by system property "DLocationMap" (or
"http://jena.hpl.hp.com/2004/08/LocationMap").
This might work: setting the java system property to the empty string.
-DLocationMap=
(or anything legal and not existing).
sorry - I'm not in a position to recreate the setup just at the moment ... no
Windows machine setup.
If it works, please let us know.
Andy
On 29/10/2019 10:07, Dr. Chavdar Ivanov wrote:
> I attached it in a text file
>
> -----Original Message-----
> From: Lorenz Buehmann <[email protected]>
> Sent: Tuesday, October 29, 2019 10:55 AM
> To: [email protected]
> Subject: Re: java.nio.file.InvalidPathException: Illegal char <:> at
> index 4: file:location-mapping.rdf
>
> Seeing the whole stacktrace would be helpful
>
> On 29.10.19 10:35, Dr. Chavdar Ivanov wrote:
>> 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
>>>