VIVO-907 make the the check for isomorphism more efficient.
Read the file graph into memory and check against that.
This commit is contained in:
parent
ac39b0799e
commit
7639bf43e3
1 changed files with 14 additions and 1 deletions
|
@ -47,7 +47,7 @@ public class TDBTripleStoreQuirks extends DefaultTripleStoreQuirks {
|
||||||
Model mangled = ModelFactory.createDefaultModel();
|
Model mangled = ModelFactory.createDefaultModel();
|
||||||
mangled.read(mangleStream, null, "N-TRIPLE");
|
mangled.read(mangleStream, null, "N-TRIPLE");
|
||||||
|
|
||||||
return !mangled.isIsomorphicWith(previous);
|
return !isIsomorphic(previous, mangled);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("Failed to test for changes in filegraph. "
|
log.warn("Failed to test for changes in filegraph. "
|
||||||
+ "Change assumed.", e);
|
+ "Change assumed.", e);
|
||||||
|
@ -55,4 +55,17 @@ public class TDBTripleStoreQuirks extends DefaultTripleStoreQuirks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If we check isomorphism with a dbModel directly, we issue many ASK
|
||||||
|
* queries against the underlying RDFService.
|
||||||
|
*
|
||||||
|
* It's faster to read the entire model from the RDFService and then issue
|
||||||
|
* all of those ASKs against a memory-resident model.
|
||||||
|
*/
|
||||||
|
private boolean isIsomorphic(Model previous, Model mangled) {
|
||||||
|
Model previousInMemory = ModelFactory.createDefaultModel()
|
||||||
|
.add(previous);
|
||||||
|
return mangled.isIsomorphicWith(previousInMemory);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue