You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Kai He (JIRA)" <ji...@apache.org> on 2016/07/05 16:07:11 UTC

[jira] [Updated] (JENA-1207) Adding Decimal Typed Literal Results in TDBException on Dataset Commit

     [ https://issues.apache.org/jira/browse/JENA-1207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kai He updated JENA-1207:
-------------------------
    Description: 
When adding a statement of the form 

[http://www.myhost.com/mysubject, http://www.myhost.com/mysubject, "2.2"^^http://www.w3.org/2001/XMLSchema#decimal]

using the following snippet
{code:java}
               dataset.begin(ReadWrite.WRITE);
		try {
			
			Model model = dataset.getDefaultModel();
			
			// add statements
			model.add(statements);
			dataset.commit();
			
		} catch (Exception e) {
			
			success = false;
			e.printStackTrace();
			dataset.abort();
			
		} finally {

			dataset.end();

		}
{code}

A TDBException is thrown. The stack trace shows the following:

org.apache.jena.tdb.TDBException: Different ids for "1.2"^^http://www.w3.org/2001/XMLSchema#decimal: allocated: expected [00000000000005B7], got [020100000000000C]
	at org.apache.jena.tdb.transaction.NodeTableTrans.inconsistent(NodeTableTrans.java:232) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.NodeTableTrans.append(NodeTableTrans.java:220) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.NodeTableTrans.writeNodeJournal(NodeTableTrans.java:317) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.NodeTableTrans.commitPrepare(NodeTableTrans.java:289) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.Transaction.prepare(Transaction.java:172) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.Transaction.commit(Transaction.java:108) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.DatasetGraphTxn.commit(DatasetGraphTxn.java:54) [jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.DatasetGraphTransaction._commit(DatasetGraphTransaction.java:146) [jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.sparql.core.DatasetGraphTrackActive.commit(DatasetGraphTrackActive.java:46) [jena-arq-3.1.0.jar:3.1.0]
	at org.apache.jena.sparql.core.DatasetImpl.commit(DatasetImpl.java:123) [jena-arq-3.1.0.jar:3.1.0]

The problem goes away when adding statements with integer values like 

[http://www.myhost.com/mysubject, http://www.myhost.com/mysubject, "2"^^http://www.w3.org/2001/XMLSchema#integer] 

  was:
When adding a statement of the form 

[http://www.myhost.com/mysubject, http://www.myhost.com/mysubject, "2.2"^^http://www.w3.org/2001/XMLSchema#decimal]

using the following snippet

               dataset.begin(ReadWrite.WRITE);
		try {
			
			Model model = dataset.getDefaultModel();
			
			// add statements
			model.add(statements);
			dataset.commit();
			
		} catch (Exception e) {
			
			success = false;
			e.printStackTrace();
			dataset.abort();
			
		} finally {

			dataset.end();

		}

A TDBException is thrown. The stack trace shows the following:

org.apache.jena.tdb.TDBException: Different ids for "1.2"^^http://www.w3.org/2001/XMLSchema#decimal: allocated: expected [00000000000005B7], got [020100000000000C]
	at org.apache.jena.tdb.transaction.NodeTableTrans.inconsistent(NodeTableTrans.java:232) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.NodeTableTrans.append(NodeTableTrans.java:220) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.NodeTableTrans.writeNodeJournal(NodeTableTrans.java:317) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.NodeTableTrans.commitPrepare(NodeTableTrans.java:289) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.Transaction.prepare(Transaction.java:172) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.Transaction.commit(Transaction.java:108) ~[jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.DatasetGraphTxn.commit(DatasetGraphTxn.java:54) [jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.tdb.transaction.DatasetGraphTransaction._commit(DatasetGraphTransaction.java:146) [jena-tdb-3.1.0.jar:3.1.0]
	at org.apache.jena.sparql.core.DatasetGraphTrackActive.commit(DatasetGraphTrackActive.java:46) [jena-arq-3.1.0.jar:3.1.0]
	at org.apache.jena.sparql.core.DatasetImpl.commit(DatasetImpl.java:123) [jena-arq-3.1.0.jar:3.1.0]

The problem goes away when adding statements with integer values like 

[http://www.myhost.com/mysubject, http://www.myhost.com/mysubject, "2"^^http://www.w3.org/2001/XMLSchema#integer] 


> Adding Decimal Typed Literal Results in TDBException on Dataset Commit
> ----------------------------------------------------------------------
>
>                 Key: JENA-1207
>                 URL: https://issues.apache.org/jira/browse/JENA-1207
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: TDB
>    Affects Versions: Jena 3.1.0
>         Environment: Mac OSX
>            Reporter: Kai He
>
> When adding a statement of the form 
> [http://www.myhost.com/mysubject, http://www.myhost.com/mysubject, "2.2"^^http://www.w3.org/2001/XMLSchema#decimal]
> using the following snippet
> {code:java}
>                dataset.begin(ReadWrite.WRITE);
> 		try {
> 			
> 			Model model = dataset.getDefaultModel();
> 			
> 			// add statements
> 			model.add(statements);
> 			dataset.commit();
> 			
> 		} catch (Exception e) {
> 			
> 			success = false;
> 			e.printStackTrace();
> 			dataset.abort();
> 			
> 		} finally {
> 			dataset.end();
> 		}
> {code}
> A TDBException is thrown. The stack trace shows the following:
> org.apache.jena.tdb.TDBException: Different ids for "1.2"^^http://www.w3.org/2001/XMLSchema#decimal: allocated: expected [00000000000005B7], got [020100000000000C]
> 	at org.apache.jena.tdb.transaction.NodeTableTrans.inconsistent(NodeTableTrans.java:232) ~[jena-tdb-3.1.0.jar:3.1.0]
> 	at org.apache.jena.tdb.transaction.NodeTableTrans.append(NodeTableTrans.java:220) ~[jena-tdb-3.1.0.jar:3.1.0]
> 	at org.apache.jena.tdb.transaction.NodeTableTrans.writeNodeJournal(NodeTableTrans.java:317) ~[jena-tdb-3.1.0.jar:3.1.0]
> 	at org.apache.jena.tdb.transaction.NodeTableTrans.commitPrepare(NodeTableTrans.java:289) ~[jena-tdb-3.1.0.jar:3.1.0]
> 	at org.apache.jena.tdb.transaction.Transaction.prepare(Transaction.java:172) ~[jena-tdb-3.1.0.jar:3.1.0]
> 	at org.apache.jena.tdb.transaction.Transaction.commit(Transaction.java:108) ~[jena-tdb-3.1.0.jar:3.1.0]
> 	at org.apache.jena.tdb.transaction.DatasetGraphTxn.commit(DatasetGraphTxn.java:54) [jena-tdb-3.1.0.jar:3.1.0]
> 	at org.apache.jena.tdb.transaction.DatasetGraphTransaction._commit(DatasetGraphTransaction.java:146) [jena-tdb-3.1.0.jar:3.1.0]
> 	at org.apache.jena.sparql.core.DatasetGraphTrackActive.commit(DatasetGraphTrackActive.java:46) [jena-arq-3.1.0.jar:3.1.0]
> 	at org.apache.jena.sparql.core.DatasetImpl.commit(DatasetImpl.java:123) [jena-arq-3.1.0.jar:3.1.0]
> The problem goes away when adding statements with integer values like 
> [http://www.myhost.com/mysubject, http://www.myhost.com/mysubject, "2"^^http://www.w3.org/2001/XMLSchema#integer] 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)