[jira] [Updated] (JENA-362) model.listStatements(s,p,o,lang) has problems with null values in the third and forth argument
[ https://issues.apache.org/jira/browse/JENA-362?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] François-Paul Servant updated JENA-362: --- Attachment: ModelCom.java ModelCom with the proposed patch > model.listStatements(s,p,o,lang) has problems with null values in the third > and forth argument > -- > > Key: JENA-362 > URL: https://issues.apache.org/jira/browse/JENA-362 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Affects Versions: Jena 2.7.4 >Reporter: François-Paul Servant >Priority: Minor > Attachments: ListStatementTest.java, ModelCom.java > > > 1) model.listStatements(s,p,null,lang) doesn't filter on lang param > 2) model.listStatements(s,p,o,null) only returns statements whose object has > lang "" (when o != null) > TEST 1 > import org.junit.Test; > import com.hp.hpl.jena.rdf.model.*; > public class LstStmt1 { > @Test > public final void test() { > Model m = ModelFactory.createDefaultModel(); > Resource s = m.createResource("http://www.a.com/s";); > Property p = m.createProperty("http://www.a.com/p";); > m.add(s,p,m.createResource("http://www.a.com/o";)); > m.add(s,p,"texte","fr"); > m.add(s,p,"text","en"); > > StmtIterator it = m.listStatements(s, p, null,"en"); > // list all the statements - not what one can expect > for (;it.hasNext();) { > System.out.println(it.next()); > } > } > } > TEST2 > public class LstStmt2 { > @Test > public final void test() { > Model m = ModelFactory.createDefaultModel(); > Resource s = m.createResource("http://www.a.com/s";); > Property p = m.createProperty("http://www.a.com/p";); > m.add(s,p,"text","en"); > m.add(s,p,"text"); > > StmtIterator it = m.listStatements(s, p,"text",null); > // should list the 2 statements, but doesn't: only the one > without lang > for (;it.hasNext();) { > System.out.println(it.next()); > } > } > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (JENA-362) model.listStatements(s,p,o,lang) has problems with null values in the third and forth argument
[ https://issues.apache.org/jira/browse/JENA-362?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] François-Paul Servant updated JENA-362: --- Attachment: ListStatementTest.java A JUnit Test for the proposed patch > model.listStatements(s,p,o,lang) has problems with null values in the third > and forth argument > -- > > Key: JENA-362 > URL: https://issues.apache.org/jira/browse/JENA-362 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Affects Versions: Jena 2.7.4 >Reporter: François-Paul Servant >Priority: Minor > Attachments: ListStatementTest.java > > > 1) model.listStatements(s,p,null,lang) doesn't filter on lang param > 2) model.listStatements(s,p,o,null) only returns statements whose object has > lang "" (when o != null) > TEST 1 > import org.junit.Test; > import com.hp.hpl.jena.rdf.model.*; > public class LstStmt1 { > @Test > public final void test() { > Model m = ModelFactory.createDefaultModel(); > Resource s = m.createResource("http://www.a.com/s";); > Property p = m.createProperty("http://www.a.com/p";); > m.add(s,p,m.createResource("http://www.a.com/o";)); > m.add(s,p,"texte","fr"); > m.add(s,p,"text","en"); > > StmtIterator it = m.listStatements(s, p, null,"en"); > // list all the statements - not what one can expect > for (;it.hasNext();) { > System.out.println(it.next()); > } > } > } > TEST2 > public class LstStmt2 { > @Test > public final void test() { > Model m = ModelFactory.createDefaultModel(); > Resource s = m.createResource("http://www.a.com/s";); > Property p = m.createProperty("http://www.a.com/p";); > m.add(s,p,"text","en"); > m.add(s,p,"text"); > > StmtIterator it = m.listStatements(s, p,"text",null); > // should list the 2 statements, but doesn't: only the one > without lang > for (;it.hasNext();) { > System.out.println(it.next()); > } > } > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (JENA-362) model.listStatements(s,p,o,lang) has problems with null values in the third and forth argument
[ https://issues.apache.org/jira/browse/JENA-362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526951#comment-13526951 ] François-Paul Servant commented on JENA-362: Here's a modification to com.hp.hpl.jena.rdf.model.impl.ModelCom that seems to patch the problem: @Override public StmtIterator listStatements( Resource S, Property P, String O, String L ) { // these 2 lines are the code of jena 2.7.4 //return O == null ? listStatements(S, P, Node.ANY) //: listStatements( S, P, Node.createLiteral( O, L, false ) ); if (O != null) { // this is not OK when L is null: returns only the statements whose lang is "" // return listStatements( S, P, Node.createLiteral( O, L, false ) ); if (L != null) return listStatements( S, P, Node.createLiteral( O, L, false ) ); // there's maybe a better way! return new StringFilteredStmtIterator(O, listStatements(S, P, Node.ANY)); } else { return new LangFilteredStmtIterator(L, listStatements(S, P, Node.ANY)); } } private class StringFilteredStmtIterator extends FilterKeepIterator implements StmtIterator { public StringFilteredStmtIterator(final String str, Iterator it ) { super( new Filter() { @Override public boolean accept(Statement s) { RDFNode o = s.getObject(); if (o instanceof Literal) { if (str == null) return true; // should not happen return (str.equals(((Literal) o).getString())); } return false; } }, it ); } public Statement nextStatement() { return next(); } } private class LangFilteredStmtIterator extends FilterKeepIterator implements StmtIterator { public LangFilteredStmtIterator(final String l, Iterator it ) { super( new Filter() { @Override public boolean accept(Statement s) { RDFNode o = s.getObject(); if (o instanceof Literal) { if (l == null) return true; return (l.equals(((Literal) o).getLanguage())); } return false; } }, it ); } public Statement nextStatement() { return next(); } } > model.listStatements(s,p,o,lang) has problems with null values in the third > and forth argument > -- > > Key: JENA-362 > URL: https://issues.apache.org/jira/browse/JENA-362 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Affects Versions: Jena 2.7.4 >Reporter: François-Paul Servant >Priority: Minor > > 1) model.listStatements(s,p,null,lang) doesn't filter on lang param > 2) model.listStatements(s,p,o,null) only returns statements whose object has > lang "" (when o != null) > TEST 1 > import org.junit.Test; > import com.hp.hpl.jena.rdf.model.*; > public class LstStmt1 { > @Test > public final void test() { > Model m = ModelFactory.createDefaultModel(); > Resource s = m.createResource("http://www.a.com/s";); > Property p = m.createProperty("http://www.a.com/p";); > m.add(s,p,m.createResource("http://www.a.com/o";)); > m.add(s,p,"texte","fr"); > m.add(s,p,"text","en"); > > StmtIterator it = m.listStatements(s, p, null,"en"); > // list all the statements - not what one can expect > for (;it.hasNext();) { > System.out.println(it.next()); > } > } > } > TEST2 > public class LstStmt2 { > @Test > public final void test() { > Model m = ModelFactory.createDefaultModel(); > Resource s = m.createResource("http://www.a.com/s";); > Property p = m.createProperty("http://www.a.com/p";); > m.add(s,p,"text","en"); > m.add(s,p,"t
[jira] [Created] (JENA-362) model.listStatements(s,p,o,lang) has problems with null values in the third and forth argument
François-Paul Servant created JENA-362: -- Summary: model.listStatements(s,p,o,lang) has problems with null values in the third and forth argument Key: JENA-362 URL: https://issues.apache.org/jira/browse/JENA-362 Project: Apache Jena Issue Type: Bug Components: Jena Affects Versions: Jena 2.7.4 Reporter: François-Paul Servant Priority: Minor 1) model.listStatements(s,p,null,lang) doesn't filter on lang param 2) model.listStatements(s,p,o,null) only returns statements whose object has lang "" (when o != null) TEST 1 import org.junit.Test; import com.hp.hpl.jena.rdf.model.*; public class LstStmt1 { @Test public final void test() { Model m = ModelFactory.createDefaultModel(); Resource s = m.createResource("http://www.a.com/s";); Property p = m.createProperty("http://www.a.com/p";); m.add(s,p,m.createResource("http://www.a.com/o";)); m.add(s,p,"texte","fr"); m.add(s,p,"text","en"); StmtIterator it = m.listStatements(s, p, null,"en"); // list all the statements - not what one can expect for (;it.hasNext();) { System.out.println(it.next()); } } } TEST2 public class LstStmt2 { @Test public final void test() { Model m = ModelFactory.createDefaultModel(); Resource s = m.createResource("http://www.a.com/s";); Property p = m.createProperty("http://www.a.com/p";); m.add(s,p,"text","en"); m.add(s,p,"text"); StmtIterator it = m.listStatements(s, p,"text",null); // should list the 2 statements, but doesn't: only the one without lang for (;it.hasNext();) { System.out.println(it.next()); } } } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
Listeners and weak references
I am looking at a case where I need to register a listener to the model. The default implementation then converts that to a graph listener, so my question applies to both. I don't have a way to detect when my class will be garbage collected (OK, I could use finalize() but that is not guaranteed to be called). My plan was to have a listener registered with the model that would modify my class instance as appropriate. But when my class instance goes out of scope I want both it and the listener to be garbage collected. This got me wondering if the listener implementation in model (and graph) shouldn't have weak references to the listening entities (e.g. anything registered as a listener). I suppose I can make my listening implementation weakly referred and clean itself up but shouldn't the base implementation of listener do this by default? -- Claude -- I like: Like Like - The likeliest place on the web Identity: https://www.identify.nu/user.php?cla...@xenei.com LinkedIn: http://www.linkedin.com/in/claudewarren
Re: Jena Core Simplification
I am now at the stage where I'd like to merge the simplification branch back into trunk, together with the collateral damage of the internal changes. This notice that (passive consensus) I'll do so sometime after at least 24 hours have passed (actually likely to be several days). At the same time, I propose flipping to version 2.10.0 for core and ARQ. Because TDB also has the factor of it's persistent file layout, and the changes to TDB aren't too great, I'd like to keep that having it's own separate version number either 0.9.X or 0.10.X. Outstanding: + documentation updates + decide on event model - keep the per bulk operation events or switch to event-per-triple-add-delete. Andy On 02/12/12 21:06, Andy Seaborne wrote: I have now got a version of a simplified jena-core [1] which has the simplification applied. To roll it out is a coordinated change to TDB and SDB as interface Graph changes. It's a balance but full deprecated cycle on internal code is very slow. Instead, I'd like to have a version bump to 2.10.0 signalling a non-incremental change. The documentation will need sorting out (assembler and reification howto). == BulkUpdateHandler The Graph.getBulkUpdateHandler and SimpleBulkUpdateHandler remain but are deprecated. To be removed after next release. I'm tempted to remove them now with a next version that is 2.10.0. Model level code calls some helper code, and not BulkUpdateHandler code. Currently, the helper mimics the event model as before but can be switched to simpler event-per-add model. == Reification Removed from the graph level - code to implement in Model, standard mode only added. Graph.getReifier removed and all graph.Reifier code. There is a code library to implement standard - ReifierStd - which is called from all Model operations to do with reification. ReificationStyle left with Minimal and Convenient constants but API code that still takes a ReificationStyle is deprecated and ignores the setting. ReificationStyle itself is deprecated. ModelFactory operations using ReificationStyle are deprecated. == Graph QueryHandler Removed (used in reification). OntModel also exposes it for some bizarre reason, possible OntModel.queryFor I say bizarre because the signature for the method is based on internal class BindingQueryPlan which in turns pulls on lots of graph-level machinary and definitely not Ont* classes. There was use of in in the reasoner tests as well, but I've written replacement code for that. Leaving it means leaving a lot of stuff only used here and then only for code that digs deep into the internals of Jena. As it's 2.10.X, I'd like to remove it. Andy [1] http://mail-archives.apache.org/mod_mbox/jena-dev/201209.mbox/%3C5044E9F3.8060705%40apache.org%3E
[jira] [Closed] (JENA-244) Deadlock during SPARQL execution on an inference model
[ https://issues.apache.org/jira/browse/JENA-244?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andy Seaborne closed JENA-244. -- > Deadlock during SPARQL execution on an inference model > -- > > Key: JENA-244 > URL: https://issues.apache.org/jira/browse/JENA-244 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Reporter: Stephen Owens >Assignee: Andy Seaborne > Fix For: Jena 2.10.0 > > Attachments: JenaDeadLockTest.java, JenaDeadLockTest.java > > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (JENA-244) Deadlock during SPARQL execution on an inference model
[ https://issues.apache.org/jira/browse/JENA-244?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andy Seaborne resolved JENA-244. Resolution: Fixed Fix Version/s: Jena 2.10.0 Assignee: Andy Seaborne > Deadlock during SPARQL execution on an inference model > -- > > Key: JENA-244 > URL: https://issues.apache.org/jira/browse/JENA-244 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Reporter: Stephen Owens >Assignee: Andy Seaborne > Fix For: Jena 2.10.0 > > Attachments: JenaDeadLockTest.java, JenaDeadLockTest.java > > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (JENA-244) Deadlock during SPARQL execution on an inference model
[ https://issues.apache.org/jira/browse/JENA-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526363#comment-13526363 ] Andy Seaborne commented on JENA-244: Good to hear. I didn't get failures but my experience of other similar incidents is that machine, OS, and java version can all play into the probability a test failing. Usually once it is seen to fails, it often/always fails, but it will run clean on another system on the same code. Hence, they sometimes only get solved by code analysis of possible causes. With that positive confirmation, I'll close this JIRA. Thanks. > Deadlock during SPARQL execution on an inference model > -- > > Key: JENA-244 > URL: https://issues.apache.org/jira/browse/JENA-244 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Reporter: Stephen Owens > Attachments: JenaDeadLockTest.java, JenaDeadLockTest.java > > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (JENA-244) Deadlock during SPARQL execution on an inference model
[ https://issues.apache.org/jira/browse/JENA-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526344#comment-13526344 ] Stephen Owens commented on JENA-244: I re-ran my test with 2.7.5-SNAPSHOT and it ran clean. When I fall back to 2.7.4 I can get it to fail reliably. I tried increasing the thread count and the number of threads to add more stress and was not able to get it to fail. I also did a quick review of your change and it looks good, it directly addresses the issue I was seeing. Thanks! I'm surprised you weren't getting the failure before your patch. Were you able to see the failure against 2.7.4? > Deadlock during SPARQL execution on an inference model > -- > > Key: JENA-244 > URL: https://issues.apache.org/jira/browse/JENA-244 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Reporter: Stephen Owens > Attachments: JenaDeadLockTest.java, JenaDeadLockTest.java > > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (JENA-244) Deadlock during SPARQL execution on an inference model
[ https://issues.apache.org/jira/browse/JENA-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526343#comment-13526343 ] Stephen Owens commented on JENA-244: Definitely, I'll give it a try and let you know the results. > Deadlock during SPARQL execution on an inference model > -- > > Key: JENA-244 > URL: https://issues.apache.org/jira/browse/JENA-244 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Reporter: Stephen Owens > Attachments: JenaDeadLockTest.java, JenaDeadLockTest.java > > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (JENA-244) Deadlock during SPARQL execution on an inference model
[ https://issues.apache.org/jira/browse/JENA-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526274#comment-13526274 ] Andy Seaborne commented on JENA-244: Stephen - I recently (last weekend) came across this situation in the Jena Test Suite itself. I believe I have a fix and would be grateful if you could test it. There is a separate branch [1] of jena-core where I have been stripping out several unused features. While these features don't directly affect the reasoner system, they do seem to have caused a timing change and a concurrency test started failing with a deadlock very like the one you have reported here. There is a fix in the branch. For I now, I have retrofitted the fit to jena-core trunk. Would you be able to try the development build? [2] Either copy the jar there, or the latest apache-jena build, or a dependency on jena-core-2.7.5-SNAPSHOT. I ran your test example but wasn't getting failures with jena-core trunk before retrofitting the possible fix. However, precise timing does affect the situation so different machines may act differently. I plan to propose to the team that this branch becomes jena-core trunk but integration is not a simple replacement because it changes some internal APIs (in fairly trivial ways) so ARQ, TDB and SDB need updates at the same time. [1] https://svn.apache.org/repos/asf/jena/branches/jena-core-simplified/ [2] https://repository.apache.org/content/groups/snapshots/org/apache/jena/jena-core/2.7.5-SNAPSHOT/ at least increment 46 > Deadlock during SPARQL execution on an inference model > -- > > Key: JENA-244 > URL: https://issues.apache.org/jira/browse/JENA-244 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Reporter: Stephen Owens > Attachments: JenaDeadLockTest.java, JenaDeadLockTest.java > > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (JENA-244) Deadlock during SPARQL execution on an inference model
[ https://issues.apache.org/jira/browse/JENA-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526264#comment-13526264 ] Hudson commented on JENA-244: - Integrated in Jena__Development_Test #319 (See [https://builds.apache.org/job/Jena__Development_Test/319/]) Fix for JENA-244 integrated into trunk for testing. (Revision 1418235) Result = SUCCESS andy : Files : * /jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/reasoner/rulesys/impl/LPTopGoalIterator.java > Deadlock during SPARQL execution on an inference model > -- > > Key: JENA-244 > URL: https://issues.apache.org/jira/browse/JENA-244 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Reporter: Stephen Owens > Attachments: JenaDeadLockTest.java, JenaDeadLockTest.java > > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira