On 12/03/2024 13:02, Anna P wrote:
Hi Lorenz,
Thank you for your reply. Yes, I used maven to build the project. Here are
dependencies details:
Hi Lorenz,

Yes, I used maven to build the project. Here are the dependencies details:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<version>5.0.0-rc1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>

Is that creating a jar file to run?

The assembly plugin does not manage Java's service loader files. Either it needs doing in some way and put into the assembled jar.

There is the shade plugin that manages combined service loader files more easily:

https://jena.apache.org/documentation/notes/jena-repack.html

This is how the combined jar jena-fuseki-server is built:

https://github.com/apache/jena/blob/main/jena-fuseki2/jena-fuseki-server/pom.xml#L87-L138

    Andy

<version>3.6.0</version>
<type>maven-plugin</type>
</dependency>
<dependencies>

Best regards,
Pan

On Tue, Mar 12, 2024 at 7:13 AM Lorenz Buehmann <
[email protected]> wrote:

Hi,

how did you setup your project? Which Jena version? Do you use Maven?
Which dependencies? It looks like ARQ.init() hasn't been called which
should happen automatically if the setup of the project is correct.


Cheers,
Lorenz

On 11.03.24 14:44, Anna P wrote:
Dear Jena support team,

Currently I just started to work on a SPARQL project using Jena and I
could
not get a solution when I query a model.
I imported a turtle file and ran a simple query, and the snippet code is
shown below. However, I got the error.

public class App {
      public static void main(String[] args) {
          try {
              Model model = RDFDataMgr.loadModel('data.ttl', Lang.TURTLE);
              RDFDataMgr.write(System.out, model, Lang.TURTLE);
              String queryString = "SELECT * { ?s ?p ?o }";
              Query query = QueryFactory.create(queryString);
              QueryExecution qe = QueryExecutionFactory.create(query,
model);
              ResultSet results = qe.execSelect();
              ResultSetFormatter.out(System.out, results, query);
              qe.close();
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
}

Here is the error message:

org.apache.jena.riot.RiotException: Not registered as a SPARQL result set
output syntax: Lang:SPARQL-Results-JSON
          at

org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:179)
          at

org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:156)
          at

org.apache.jena.sparql.resultset.ResultsWriter.write(ResultsWriter.java:149)
          at

org.apache.jena.sparql.resultset.ResultsWriter$Builder.write(ResultsWriter.java:96)
          at

org.apache.jena.query.ResultSetFormatter.output(ResultSetFormatter.java:308)
          at

org.apache.jena.query.ResultSetFormatter.outputAsJSON(ResultSetFormatter.java:516)
          at de.unistuttgart.ki.esparql.App.main(App.java:46)


Thank you for your time and help!

Best regards,

Pan

--
Lorenz Bühmann
Research Associate/Scientific Developer

Email [email protected]

Institute for Applied Informatics e.V. (InfAI) | Goerdelerring 9 | 04109
Leipzig | Germany



Reply via email to