[Mulgara-dev] Question about: INSERT/SELECT regression bug

David Moll DMoll at viewpointusa.com
Tue Oct 31 18:05:17 UTC 2006


One of the operations that we do a fair amount in Mulgara/TKS that gives
us a bit of a headache is doing modify/deletes.  Mainly because we need
to ensure that when deleting a triple, we don't leave any "orphaned"
triples lower on the graph.
 
My end goal is to fully automate the ability to insert, modify and
delete information in the data store with a thin client that will
automatically generate the proper iTQL queries based on user input.  In
building up to this, I am trying to determine exactly what queries I
need to run in order to successfully modify information in the data
store.
 
To "modify" I am performing an "insert" followed by a "delete."  I
created the following "insert" query:
 
insert 
    select
    <modifiedURI> $p $o
    from <rmi://localhost/server1#model> 
    where <originalURI> $p $o
into <rmi://localhost/server1#model> 
; 
 
The inner select statement creates the triples that I want to insert,
but because <modifiedURI> is a "constant" to Mulgara/TKS, it is assigned
a negative node number.  So the result message is:
 
org.mulgara.query.QueryException: Unable to modify
rmi://localhost/server1#model
 
And the stack trace is:
 
2006-10-31 11:09:39,333 WARN  [RMI TCP Connection(249)-192.168.10.205]
store.StatementStoreResolver - Note: if any of the query nodes are
negative this is a known bug [ 1089540 ] INSERT/SELECT regression in
sourceforge
<snip>
Caused by: org.mulgara.query.QueryException:
org.mulgara.store.statement.StatementStoreException: Attempt to add a
triple with node number out of range: -1 2 1808329 39
 at
org.mulgara.store.statement.xa.XAStatementStoreImpl.addTriple(XAStatemen
tStoreImpl.java:441)
 at
org.mulgara.resolver.store.StatementStoreResolver.modifyModel(StatementS
toreResolver.java:363)
 ... 18 more

I cut out most of the stack trace, I didn't think it was that important
to the issue.  I found the listing on Sourceforge
(http://sourceforge.net/tracker/index.php?func=detail&aid=1089540&group_
id=89874&atid=591704).  Then I went to XAStatementStoreImpl.java to
investigate what was happening.  I added the method from
XAStatementStoreImpl.java where the exception occurs below.
 
My question has two parts.
 
Where are the values from NodePool assigned to the nodes created in the
select query?
Is there a reason that constants created in the "select" portion of the
above query are assigned negative node values?  It seems that they could
be assigned a new value from the NodePool, which would allow for them to
then be inserted into the data store.
 
~Dave
 
>From XAStatementStoreImpl.java:
 
  /**
   * Adds a new triple to the graph if it doesn't already exist.
   *
   * @param node0 the first element of the new triple
   * @param node1 the second element of the new triple
   * @param node2 the third element of the new triple
   * @param node3 the fourth element of the new triple
   * @throws StatementStoreException EXCEPTION TO DO
   */
  public synchronized void addTriple(
      long node0, long node1, long node2, long node3
  ) throws StatementStoreException {
    checkInitialized();
    if (
        node0 < NodePool.MIN_NODE ||
        node1 < NodePool.MIN_NODE ||
        node2 < NodePool.MIN_NODE ||
        node3 < NodePool.MIN_NODE
    ) {
      throw new StatementStoreException(
          "Attempt to add a triple with node number out of range: " +
          node0 + " " + node1 + " " + node2 + " " + node3
      );
    }
 
    if (!dirty && currentPhase.isInUse()) {
      try {
        new Phase();
      } catch (IOException ex) {
        throw new StatementStoreException("I/O error", ex);
      }
    }
 
    currentPhase.addTriple(node0, node1, node2, node3);
  }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mulgara.org/pipermail/mulgara-dev/attachments/20061031/d06b066b/attachment.htm>


More information about the Mulgara-dev mailing list