On 01/05/12 19:34, Craig Trim wrote:
When attempting to load multiple OWL files into a named model:
for (String owlModelPath : getOwlModelPaths()) {
try {
model.enterCriticalSection(Lock.WRITE);
model.read(SpaLoaderImpl.toInputStream(owlModelPath), null,
null);
model.commit();
TDB.sync(model);
} finally {
model.leaveCriticalSection();
}
}
I get this error:
java.util.ConcurrentModificationException: Iterator: started at 376, now 377
at
com.hp.hpl.jena.tdb.sys.ConcurrencyPolicyMRSW.policyError(ConcurrencyPolicyMRSW.java:132)
at
com.hp.hpl.jena.tdb.sys.ConcurrencyPolicyMRSW.access$000(ConcurrencyPolicyMRSW.java:17)
at
com.hp.hpl.jena.tdb.sys.ConcurrencyPolicyMRSW$IteratorCheckNotConcurrent.checkCourrentModification(ConcurrencyPolicyMRSW.java:95)
at
com.hp.hpl.jena.tdb.sys.ConcurrencyPolicyMRSW$IteratorCheckNotConcurrent.hasNext(ConcurrencyPolicyMRSW.java:102)
at
com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.removeFromPrefixMap(DatasetPrefixesTDB.java:187)
Looks like some is changing a prefix - remove happens in .set() when a
prefix is redefined.
New versions are available.
I think this is a situation that no longer arises due to a fix since TDB
0.8.10.
A workaround (that looses prefixes) is to read into a temporary model
then add the model to the dataset.
Andy
at
com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.set(GraphPrefixesProjection.java:70)
at
com.hp.hpl.jena.shared.impl.PrefixMappingImpl.setNsPrefix(PrefixMappingImpl.java:58)
at
com.hp.hpl.jena.rdf.arp.JenaHandler.startPrefixMapping(JenaHandler.java:94)
at
com.hp.hpl.jena.rdf.arp.impl.XMLHandler.startPrefixMapping(XMLHandler.java:110)
at
org.apache.xerces.parsers.AbstractSAXParser.startNamespaceMapping(Unknown
Source)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(Unknown
Source)
at org.apache.xerces.impl.XMLNamespaceBinder.startElement(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
<snip>
I've played around with the try/catch blocks, and also passing in an
explicit base URI param, but neither has made much difference. Any help
would be appreciated. Thanks!
Environment:
arq-2.8.8.jar, icu4j-3.4.4.jar, iri-0.8.jar, jena-2.6.4-A.jar,
junit-4.5.jar, log4j-1.2.14.jar, lucene-core-2.3.1.jar,
slf4j-api-1.6.4.jar, slf4j-log4j12-1.6.4.jar, stax-api-1.0.1.jar,
tdb-0.8.10.jar, wstx-asl-3.2.9.jar, xercesImpl-2.7.1.jar
Microsoft Windows [Version 6.1.7601]
java version "1.6.0"
Java(TM) SE Runtime Environment (build pwa6460sr9fp2-20110625_01(SR9 FP2))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Windows 7 amd64-64
jvmwa6460sr9-20110624_85526 (JIT enabled, AOT enabled)