You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jena.apache.org by "SimonBin (via GitHub)" <gi...@apache.org> on 2023/04/18 16:21:30 UTC

[GitHub] [jena] SimonBin opened a new issue, #1849: Initialisation order headache with sparql-generate+NodeValue(String)->NodeConst->RDFS.*.asNode

SimonBin opened a new issue, #1849:
URL: https://github.com/apache/jena/issues/1849

   ### Version
   
   4.8.0-RC
   
   ### What happened?
   
   Hi,
   
   could be this is not a bug; I don't understand Java Static Initialisers
   
   Anyway I was trying to use [sparql-generate](https://github.com/sparql-generate/sparql-generate) as a subsystem through JenaSubsystemLifecycle (from within [RdfProcessingToolkit](https://github.com/SmartDataAnalytics/RdfProcessingToolkit)) and it crashes with
   
   
   One possible fix that seems to work is 
   
   ```
   diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/graph/NodeConst.java b/jena-arq/src/main/java/org/apache/jena/sparql/graph/NodeConst.java
   index b86c9a16bf..0b27748a32 100644
   --- a/jena-arq/src/main/java/org/apache/jena/sparql/graph/NodeConst.java
   +++ b/jena-arq/src/main/java/org/apache/jena/sparql/graph/NodeConst.java
   @@ -69,7 +69,7 @@ public class NodeConst {
    
    //    public static Node rdfType = RDF.Nodes.type;
        public static Node rdfsClass = RDFS.Nodes.Class;
   -    public static Node rdfsSubclassOf = RDFS.subClassOf.asNode();
   +    public static Node rdfsSubclassOf = RDFS.Nodes.subClassOf;
    
        public static final Node FIRST = RDF.first.asNode() ;
        public static final Node REST = RDF.rest.asNode() ;
   ```
   
   please advise if I should PR that as I don't understand the implications
   
   ### Relevant output and stacktrace
   
   ```shell
   Exception in thread "main" java.lang.ExceptionInInitializerError
   	at org.apache.jena.sparql.expr.NodeValue.<clinit>(NodeValue.java:118)
   	at fr.mines_stetienne.ci.sparql_generate.function.library.ST_Decr.<clinit>(ST_Decr.java:43)
   	at org.aksw.jenax.sparql.generate.Functions.register(Functions.java:32)
   	at org.aksw.jenax.sparql.generate.InitGenerateFunctions.start(InitGenerateFunctions.java:8)
   	at org.apache.jena.base.module.Subsystem.lambda$initialize$1(Subsystem.java:117)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
   	at org.apache.jena.base.module.Subsystem.forEach(Subsystem.java:193)
   	at org.apache.jena.base.module.Subsystem.forEach(Subsystem.java:169)
   	at org.apache.jena.base.module.Subsystem.initialize(Subsystem.java:115)
   	at org.apache.jena.sys.JenaSystem.init(JenaSystem.java:89)
   	at org.apache.jena.graph.NodeFactory.<clinit>(NodeFactory.java:32)
   	at org.apache.jena.rdf.model.impl.ResourceImpl.fresh(ResourceImpl.java:150)
   	at org.apache.jena.rdf.model.impl.ResourceImpl.<init>(ResourceImpl.java:86)
   	at org.apache.jena.rdf.model.ResourceFactory$Impl.createResource(ResourceFactory.java:312)
   	at org.apache.jena.rdf.model.ResourceFactory.createResource(ResourceFactory.java:92)
   	at org.apache.jena.vocabulary.RDFS.resource(RDFS.java:35)
   	at org.apache.jena.vocabulary.RDFS$Init.Class(RDFS.java:68)
   	at org.apache.jena.vocabulary.RDFS.<clinit>(RDFS.java:40)
   	at org.apache.jena.shared.PrefixMapping.<clinit>(PrefixMapping.java:219)
   	at org.aksw.rdf_processing_toolkit.cli.cmd.CliUtils.configPrefixMapping(CliUtils.java:88)
   	at org.aksw.sparql_integrate.cli.main.SparqlIntegrateCmdImpls.sparqlIntegrate(SparqlIntegrateCmdImpls.java:155)
   	at org.aksw.sparql_integrate.cli.cmd.CmdSparqlIntegrateMain.call(CmdSparqlIntegrateMain.java:200)
   	at org.aksw.sparql_integrate.cli.cmd.CmdSparqlIntegrateMain.call(CmdSparqlIntegrateMain.java:26)
   	at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
   	at picocli.CommandLine.access$1300(CommandLine.java:145)
   	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
   	at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
   	at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
   	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
   	at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
   	at picocli.CommandLine.execute(CommandLine.java:2078)
   	at org.aksw.rdf_processing_toolkit.cli.cmd.CmdUtils.callCmd(CmdUtils.java:76)
   	at org.aksw.rdf_processing_toolkit.cli.cmd.CmdUtils.callCmd(CmdUtils.java:39)
   	at org.aksw.rdf_processing_toolkit.cli.cmd.CmdUtils.execCmd(CmdUtils.java:20)
   	at integrate.main(integrate.java:6)
   Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.jena.rdf.model.Property.asNode()" because "org.apache.jena.vocabulary.RDFS.subClassOf" is null
   	at org.apache.jena.sparql.graph.NodeConst.<clinit>(NodeConst.java:72)
   	... 35 more
   
   ```
   ```
   
   
   ### Are you interested in making a pull request?
   
   None


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] SimonBin closed issue #1849: Initialisation order headache with sparql-generate+NodeValue(String)->NodeConst->RDFS.*.asNode

Posted by "SimonBin (via GitHub)" <gi...@apache.org>.
SimonBin closed issue #1849: Initialisation order headache with sparql-generate+NodeValue(String)->NodeConst->RDFS.*.asNode
URL: https://github.com/apache/jena/issues/1849


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] rvesse commented on issue #1849: Initialisation order headache with sparql-generate+NodeValue(String)->NodeConst->RDFS.*.asNode

Posted by "rvesse (via GitHub)" <gi...@apache.org>.
rvesse commented on issue #1849:
URL: https://github.com/apache/jena/issues/1849#issuecomment-1513650778

   > alternatively, I can call JenaSystem.init() before creating a PrefixMapping to correct the order; maybe that's the solution
   
   Yes it's generally advisable to call that at least once prior to touching any other Jena code


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] afs commented on issue #1849: Initialisation order headache with sparql-generate+NodeValue(String)->NodeConst->RDFS.*.asNode

Posted by "afs (via GitHub)" <gi...@apache.org>.
afs commented on issue #1849:
URL: https://github.com/apache/jena/issues/1849#issuecomment-1524943492

   > `at org.apache.jena.shared.PrefixMapping.<clinit>(PrefixMapping.java:219)`
   
   https://github.com/apache/jena/pull/1853 commit 8c5023031269005e5b1f659280a6d194513381dd adds an initializer call to `PrefixMapping.Factory`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] SimonBin commented on issue #1849: Initialisation order headache with sparql-generate+NodeValue(String)->NodeConst->RDFS.*.asNode

Posted by "SimonBin (via GitHub)" <gi...@apache.org>.
SimonBin commented on issue #1849:
URL: https://github.com/apache/jena/issues/1849#issuecomment-1513464582

   alternatively, I can call JenaSystem.init() before creating a PrefixMapping to correct the order; maybe that's the solution


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org