queue.offer(t);
}
String uri = this.tree.getOntModel().expandPrefix(
":" + nextToken.term());
if (type.equals(OntologyElementTree.ONTCLASS)) {
OntClass cls = this.tree.getOntModel().getOntClass(uri);
ExtendedIterator it = cls.listSuperClasses();
while (it.hasNext()) {
offer(nextToken, ((OntClass) it.next()).getLocalName(),
tree.getActualWeight(Weights.ONTCLASS_SUPERCLASS));
}
it = cls.listSubClasses();
while (it.hasNext()) {
offer(nextToken, ((OntClass) it.next()).getLocalName(),
tree.getActualWeight(Weights.ONTCLASS_SUBCLASS));
}
for (DatatypeProperty dp : JenaUtil.getDatatypeProperties(cls,
false)) {
offer(
nextToken,
dp.getLocalName(),
tree
.getActualWeight(Weights.ONTCLASS_DECLARED_PROPERTY));
}
for (ObjectProperty op : JenaUtil.getObjectProperties(cls,
false)) {
offer(
nextToken,
op.getLocalName(),
tree
.getActualWeight(Weights.ONTCLASS_DECLARED_PROPERTY));
}
} else if (type.equals(OntologyElementTree.INDIVIDUAL)) {
Individual ind = this.tree.getOntModel().getIndividual(uri);
ExtendedIterator it = ind.listOntClasses(true);
while (it.hasNext()) {
OntClass cls = (OntClass) it.next();
offer(nextToken, cls.getLocalName(), tree
.getActualWeight(Weights.INDIVIDUAL_CLASS));
for (DatatypeProperty dp : JenaUtil.getDatatypeProperties(
cls, false)) {
StmtIterator sit = ind.listProperties(dp);
if (sit.hasNext()) {
offer(
nextToken,
dp.getLocalName(),
tree
.getActualWeight(Weights.INDIVIDUAL_DECLARED_PROPERTY));
}
while (sit.hasNext()) {
offer(nextToken, sit.nextStatement().getLiteral()
.getString(), tree
.getActualWeight(Weights.INDIVIDUAL_OBJECT));
}
}
for (ObjectProperty op : JenaUtil.getObjectProperties(cls,
false)) {
StmtIterator sit = ind.listProperties(op);
if (sit.hasNext()) {
offer(
nextToken,
op.getLocalName(),
tree
.getActualWeight(Weights.INDIVIDUAL_DECLARED_PROPERTY));
}
while (sit.hasNext()) {
offer(nextToken, ((Resource) sit.nextStatement()
.getObject()).getLocalName(), tree
.getActualWeight(Weights.INDIVIDUAL_OBJECT));
}
}
}
ResIterator rit = this.tree.getOntModel()
.listResourcesWithProperty(null, ind);
while (rit.hasNext()) {
offer(nextToken, rit.nextResource().getLocalName(), tree
.getActualWeight(Weights.INDIVIDUAL_SUBJECT));
}
} else if (type.equals(OntologyElementTree.OBJECTPROPERTY)) {
ObjectProperty op = this.tree.getOntModel().getObjectProperty(
uri);
for (OntClass cls : JenaUtil.getCompatibleDeclaredDomains(op)) {
offer(nextToken, cls.getLocalName(), tree
.getActualWeight(Weights.OBJECTPROPERTY_DOMAIN));
}
for (OntClass cls : JenaUtil.getCompatibleDeclaredRanges(op)) {
offer(nextToken, cls.getLocalName(), tree
.getActualWeight(Weights.OBJECTPROPERTY_RANGE));
}
} else if (type.equals(OntologyElementTree.DATATYPEPROPERTY)) {
DatatypeProperty dp = this.tree.getOntModel()
.getDatatypeProperty(uri);
for (OntClass cls : JenaUtil.getCompatibleDeclaredDomains(dp)) {
offer(nextToken, cls.getLocalName(), tree
.getActualWeight(Weights.OBJECTPROPERTY_DOMAIN));
}
}
}