change to insertNewIndividual() to retrieve class from TBox model
This commit is contained in:
parent
3323f9cd53
commit
b39a76bfc5
1 changed files with 13 additions and 6 deletions
|
@ -219,16 +219,22 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
|
|
||||||
String entURI = null;
|
String entURI = null;
|
||||||
|
|
||||||
ontModel.enterCriticalSection(Lock.WRITE);
|
|
||||||
try {
|
|
||||||
|
|
||||||
Resource cls = null;
|
Resource cls = null;
|
||||||
|
OntModel tboxModel = getOntModelSelector().getTBoxModel();
|
||||||
|
tboxModel.enterCriticalSection(Lock.READ);
|
||||||
try {
|
try {
|
||||||
cls = ontModel.getOntClass(ent.getVClassURI());
|
try {
|
||||||
|
cls = tboxModel.getOntClass(ent.getVClassURI());
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
if (cls==null) {
|
if (cls==null) {
|
||||||
cls = OWL.Thing; // This assumes we want OWL-DL compatibility. Individuals cannot be untyped.
|
cls = OWL.Thing; // This assumes we want OWL-DL compatibility. Individuals cannot be untyped.
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
tboxModel.leaveCriticalSection();
|
||||||
|
}
|
||||||
|
|
||||||
|
ontModel.enterCriticalSection(Lock.WRITE);
|
||||||
|
try {
|
||||||
|
|
||||||
entURI = new String(preferredURI);
|
entURI = new String(preferredURI);
|
||||||
com.hp.hpl.jena.ontology.Individual test = ontModel.getIndividual(entURI);
|
com.hp.hpl.jena.ontology.Individual test = ontModel.getIndividual(entURI);
|
||||||
|
@ -605,9 +611,10 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
try {
|
try {
|
||||||
HashSet<String> monikers = new HashSet<String>();
|
HashSet<String> monikers = new HashSet<String>();
|
||||||
OntClass cls = getOntModel().getOntClass(typeURI);
|
OntClass cls = getOntModel().getOntClass(typeURI);
|
||||||
Iterator<? extends OntResource> inds = cls.listInstances();
|
ResIterator inds = getOntModel().listSubjectsWithProperty(
|
||||||
|
RDF.type, ResourceFactory.createResource(typeURI));
|
||||||
while (inds.hasNext()) {
|
while (inds.hasNext()) {
|
||||||
OntResource ind = inds.next();
|
Resource ind = inds.nextResource();
|
||||||
if (MONIKER != null) {
|
if (MONIKER != null) {
|
||||||
Iterator<Statement> monikerIt = ind.listProperties(MONIKER);
|
Iterator<Statement> monikerIt = ind.listProperties(MONIKER);
|
||||||
while (monikerIt.hasNext()) {
|
while (monikerIt.hasNext()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue