Skip to content

Did not recognise RDF format object Turtle #5313

@luisramosbosch

Description

@luisramosbosch

Current Behavior

I developed an app to read ttl files, the app runs very well using eclipse: run as -> java app.
But, when I developed the exe file, I got the following result:

The file format is not supported or the file is not a valid Turtle file.
org.eclipse.rdf4j.rio.UnsupportedRDFormatException: Did not recognise RDF format object Turtle (mimeTypes=text/turtle, application/x-turtle; ext=ttl)
at org.eclipse.rdf4j.rio.Rio.lambda$unsupportedFormat$0(Rio.java:761)
at java.base/java.util.Optional.orElseThrow(Optional.java:403)
at org.eclipse.rdf4j.rio.Rio.createParser(Rio.java:99)
at org.eclipse.rdf4j.rio.Rio.createParser(Rio.java:117)
at org.eclipse.rdf4j.rio.Rio.parse(Rio.java:342)
at org.eclipse.rdf4j.rio.Rio.parse(Rio.java:314)
at org.eclipse.rdf4j.rio.Rio.parse(Rio.java:261)
at rdf4j2.ReadTTLFileRDF4J.main(ReadTTLFileRDF4J.java:84).

The part of the code where I read the ttl file is the following:

// Read the TTL file into a model
Model model;
try (FileInputStream inputStream = new FileInputStream(ttlFilePath)) {
model = Rio.parse(inputStream, "", RDFFormat.TURTLE);
} catch (IOException e) {
e.printStackTrace();
return;
} catch (UnsupportedRDFormatException e) {
System.err.println("The file format is not supported or the file is not a valid Turtle file.");
e.printStackTrace();
return;
}

In my pom, I have the following dependencies:

org.eclipse.rdf4j rdf4j-storage pom org.slf4j slf4j-simple runtime org.eclipse.rdf4j rdf4j-queryalgebra-geosparql org.eclipse.rdf4j rdf4j-sparqlbuilder org.json json 20230227 org.eclipse.rdf4j rdf4j-rio-turtle

What I really do not understand is why the app works in eclipse ide, but not as exe jar file.

Hope somebody could tell me what I am doing wrong.

Best regards

Luis Ramos

Expected Behavior

ttl file should be read, and requested report should be generated

Steps To Reproduce

  1. generate exe file
  2. run exe file, and read ttl
  3. get report about ttl content and changes done

Version

latest

Are you interested in contributing a solution yourself?

Yes

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixissue won't be fixed (close reason)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions