0

I have created an Ontology and have run the reasoner successfully. However upon adding a data property called isLocatedExternally and associating it with individual x and running the reasoner I get the following error

 MalformedLiteralException: Literal"C:\Program Files"^^<http://www.w3.org/2001/XMLSchema#anyURI>is malformed.

I am trying to assign the individual to the file being stored locally on my PC.

Is there any fundamental step I am missing?

I had initially had my file on the cloud and thought storing the file on my PC would help but that did not change anything.

Below is the screenshot of the error and the data property created.

enter image description here

What I am trying to do is to use the technique below for assigning an external source to an individual.

enter image description here

So far, based on the comments, I have tried 1- file:///C:\Program%20Files 2- file://C:\Program%20Files 3- File://C:\Program%20Files 4- C:\Program%20Files

Here is the reasoning error that arises when I run the reasoner when assigning the individual to an external file using anyURI

enter image description here

file:///C/Program%20Files resolved the issue. However this raises another issue which is when I change to this address, and lookup for this address in the file explorer in the windows OS, it cannot find the path and gives the following error:

Windows cannot find "file:///C/Program%20Files".Check the spelling and try again

Now the IRI does not direct the individual to an existing folder

arash
  • 141
  • 1
  • 14
  • 1
    Did you try using a `file` URI? I suppose for Windows it might be: `file:///C:\Program%20Files` – Stefan - brox IT-Solutions Jan 11 '23 at 08:10
  • 2
    as the error message indicates, the literal is malformed. `C:\Program Files` is not a valid URI, the scheme is missing and it contains white spaces. Check the specs: https://www.w3.org/TR/xmlschema11-2/#anyURI – UninformedUser Jan 11 '23 at 11:01
  • @Stefan-broxIT-Solutions, Upon your kind suggestion I have tried the following: 1-file://C:\Program%20Files and 2- File://C:\Program%20Files and 3- //C:\Program%20Files and 4- C:\Program%20Files variations. whereas upon running the reasoner I get the following messege : ERROR 13:38:35 An error occurred during reasoning: Literal "file://C:\Program%20Files"^^ is malformed. – arash Jan 13 '23 at 18:37
  • @UninformedUser, Thank you providing me the direct resource, Based on Stefan comment and yours on white spaces I found the following : 4.3.6 whiteSpace preserve No normalization is done, the value is not changed replace All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return) are replaced with #x20 (space) collapse After the processing implied by replace, contiguous sequences of #x20's are collapsed to a single #x20, and any #x20 at the start or end of the string is then removed. I have tried the above % adding to my file path however it did not resolve my issue. – arash Jan 13 '23 at 18:46
  • @UninformedUser, Could you elaborate further on what is meant by scheme is missing and where in the resource I can find related information? I guess if there are any examples in the resource that you can direct me to would help me overcome my inability to understand the documentation provided. – arash Jan 13 '23 at 18:48
  • @arash: Your three variants contain two slashes after `file`, the variant from my comment contains three slashes. Did you try that? – Stefan - brox IT-Solutions Jan 14 '23 at 23:41
  • Hello, @Stefan-broxIT-Solutions; yes, I had initially started with file:///C:\Program%20Files , however, I thought I might need to modify it somehow to make it work, but it did not. Do you have any other suggestions on this? – arash Jan 16 '23 at 01:42
  • @Stefan-broxIT-Solutions , On closer inspection, the malfunction error pop-up does not come on the screen. However, the Reasoner still cannot be performed. Would you happen to know where the problem is coming from? – arash Jan 16 '23 at 01:53

1 Answers1

0

Based on my personal experience you need to retry with other reasoners and see if that helps

  • 1
    I have tried HermiT and Pellet but did not help, and ELK does not provide any support for data properties. Do you have any other opinion on this? – arash Jan 10 '23 at 23:05
  • This is a syntactic issue, reasoners might or might not check, but the problem os in the data not the reasoning. See Uninformeduser's comment. – Ignazio Jan 11 '23 at 21:40
  • @Ignazio, I have tried to look at the documentation and use a more direct answer provided by Stefan by using the following variations 1-file://C:\Program%20Files and 2- File://C:\Program%20Files and 3- //C:\Program%20Files and 4- C:\Program%20Files variations. However the problem persists, can you provide me with your insights? – arash Jan 13 '23 at 18:51
  • 1
    The file: protocol needs a host name and a path; if you skip the host name, you still need the slash, so your IRIs would start with file:/// (three slashes). See https://en.wikipedia.org/wiki/File_URI_scheme and the accepted answer for https://stackoverflow.com/questions/7857416/file-uri-scheme-and-relative-files – Ignazio Jan 14 '23 at 09:05
  • @Ignazio, Thank you for the follow-up, I have used the file:///C:\Program%20Files (IRI with three slashes), and I have updated the error message I get while performing the reasoner. However, the only noticeable change is that the pop-up for the malformed error does not come on the screen, but I still get the error when I perform the reasoning. – arash Jan 16 '23 at 02:04
  • 1
    Replace "C:\" with "C/". Alternatively, run this Java code: ```System.out.println(new File("C:\Program Files").toURI());``` , it should give you a clear example of that the IRI should look like – Ignazio Jan 16 '23 at 10:04
  • @Ignazio, thank you for your prompt answer, indeed file:///C/Program%20Files resolved the issue. However this raises another issue which is when I change to this address, and lookup for this address in the file explorer in the windows OS, it cannot find the path and gives the following error: Windows cannot find "file:///C/Program%20Files".Check the spelling and try again. Now the IRI does not direct the individual to an existing folder, but however, it resolved the reasoner issue, which makes it very interesting to me to understand this behavior. Do you have any opinion on this? – arash Jan 18 '23 at 04:08