Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTL flavor of the LinkedDataAPI is broken #2443

Closed
joerivandervelde opened this issue Jun 21, 2023 · 1 comment
Closed

TTL flavor of the LinkedDataAPI is broken #2443

joerivandervelde opened this issue Jun 21, 2023 · 1 comment
Labels
broken bug Something isn't working

Comments

@joerivandervelde
Copy link
Member

Version: EMX2 8.195.0

The TTL flavor of the LinkedDataAPI in question runs at: <server>/<schema>/api/ttl. When calling this API, the original JSON-LD linked data string is converted into TTL format in LinkedDataService.java:

RDFParser rdfParser = Rio.createParser(RDFFormat.JSONLD);
Model model = new LinkedHashModel();
rdfParser.setRDFHandler(new StatementCollector(model));
rdfParser.parse(new StringReader(sw.toString()), "http://localhost/");
Rio.write(model, printWriter, RDFFormat.TURTLE);

But this fails when there are multiple ontology terms because apparently the JSON-LD notation cannot be parsed. For example [http://purl.obolibrary.org/obo/NCIT_C15607, http://semanticscience.org/resource/SIO_001003] throws the following exception:

org.molgenis.emx2.MolgenisException: generation of ttl failed: Could not parse JSONLD
	at org.molgenis.emx2.semantics.LinkedDataService.convertToTtl(LinkedDataService.java:235) ~[molgenis-emx2-semantics-8.195.1-fix-jsonldapi-SNAPSHOT.jar:a45b18b70]
	at org.molgenis.emx2.semantics.LinkedDataService.getTtlForSchema(LinkedDataService.java:218) ~[molgenis-emx2-semantics-8.195.1-fix-jsonldapi-SNAPSHOT.jar:a45b18b70]
	at org.molgenis.emx2.web.LinkedDataFragmentsApi.ttl(LinkedDataFragmentsApi.java:49) ~[molgenis-emx2-webapi-8.195.1-fix-jsonldapi-SNAPSHOT.jar:a45b18b70]
	at spark.RouteImpl$1.handle(RouteImpl.java:72) ~[spark-core-2.9.4.jar:?]
	at spark.http.matching.Routes.execute(Routes.java:61) ~[spark-core-2.9.4.jar:?]
	at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:134) ~[spark-core-2.9.4.jar:?]
	at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50) ~[spark-core-2.9.4.jar:?]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1598) ~[jetty-server-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[jetty-server-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) ~[jetty-server-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) [jetty-server-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) [jetty-server-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) [jetty-server-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [jetty-io-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [jetty-io-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [jetty-io-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [jetty-util-9.4.48.v20220622.jar:9.4.48.v20220622]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [jetty-util-9.4.48.v20220622.jar:9.4.48.v20220622]
	at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: org.eclipse.rdf4j.rio.RDFParseException: Could not parse JSONLD
	at org.eclipse.rdf4j.rio.jsonld.JSONLDParser.parse(JSONLDParser.java:136) ~[rdf4j-rio-jsonld-4.2.4.jar:4.2.4]
	at org.eclipse.rdf4j.rio.jsonld.JSONLDParser.parse(JSONLDParser.java:103) ~[rdf4j-rio-jsonld-4.2.4.jar:4.2.4]
	at org.molgenis.emx2.semantics.LinkedDataService.convertToTtl(LinkedDataService.java:232) ~[molgenis-emx2-semantics-8.195.1-fix-jsonldapi-SNAPSHOT.jar:a45b18b70]
	... 20 more
Caused by: com.github.jsonldjava.core.JsonLdError: invalid term definition: [http://purl.obolibrary.org/obo/NCIT_C15607, http://semanticscience.org/resource/SIO_001003]
	at com.github.jsonldjava.core.Context.createTermDefinition(Context.java:349) ~[jsonld-java-0.13.4.jar:?]
	at com.github.jsonldjava.core.Context.parse(Context.java:289) ~[jsonld-java-0.13.4.jar:?]
	at com.github.jsonldjava.core.Context.parse(Context.java:150) ~[jsonld-java-0.13.4.jar:?]
	at com.github.jsonldjava.core.Context.parse(Context.java:305) ~[jsonld-java-0.13.4.jar:?]
	at com.github.jsonldjava.core.JsonLdApi.expand(JsonLdApi.java:550) ~[jsonld-java-0.13.4.jar:?]
	at com.github.jsonldjava.core.JsonLdApi.expand(JsonLdApi.java:524) ~[jsonld-java-0.13.4.jar:?]
	at com.github.jsonldjava.core.JsonLdApi.expand(JsonLdApi.java:1027) ~[jsonld-java-0.13.4.jar:?]
	at com.github.jsonldjava.core.JsonLdProcessor.expand(JsonLdProcessor.java:139) ~[jsonld-java-0.13.4.jar:?]
	at com.github.jsonldjava.core.JsonLdProcessor.toRDF(JsonLdProcessor.java:528) ~[jsonld-java-0.13.4.jar:?]
	at org.eclipse.rdf4j.rio.jsonld.JSONLDParser.parse(JSONLDParser.java:134) ~[rdf4j-rio-jsonld-4.2.4.jar:4.2.4]
	at org.eclipse.rdf4j.rio.jsonld.JSONLDParser.parse(JSONLDParser.java:103) ~[rdf4j-rio-jsonld-4.2.4.jar:4.2.4]
	at org.molgenis.emx2.semantics.LinkedDataService.convertToTtl(LinkedDataService.java:232) ~[molgenis-emx2-semantics-8.195.1-fix-jsonldapi-SNAPSHOT.jar:a45b18b70]
	... 20 more
Caused by: org.eclipse.rdf4j.rio.RDFParseException: Could not parse JSONLD

Caused by: com.github.jsonldjava.core.JsonLdError: invalid term definition: [http://purl.obolibrary.org/obo/NCIT_C15607, http://semanticscience.org/resource/SIO_001003]


@joerivandervelde joerivandervelde added bug Something isn't working broken labels Jun 21, 2023
@esthervanenckevort
Copy link
Member

Resolved in #2903

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broken bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants