fixes out of memory error with getRelatedRestrictions()
This commit is contained in:
parent
9533717b32
commit
cba46c4f72
1 changed files with 6 additions and 9 deletions
|
@ -525,7 +525,6 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
vclasses.add(vclass);
|
vclasses.add(vclass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return getAllPropInstByVClasses(vclasses);
|
return getAllPropInstByVClasses(vclasses);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -619,10 +618,12 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
private static final int DEPTH_LIMIT = 20;
|
private static final int DEPTH_LIMIT = 20;
|
||||||
|
|
||||||
private List<Restriction> getRelatedRestrictions(OntClass ontClass) {
|
private List<Restriction> getRelatedRestrictions(OntClass ontClass) {
|
||||||
return getRelatedRestrictions(ontClass, new ArrayList<Restriction>(), DEPTH_LIMIT);
|
List<Restriction> restList = new ArrayList<Restriction>();
|
||||||
|
addRelatedRestrictions(ontClass, restList, DEPTH_LIMIT);
|
||||||
|
return restList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Restriction> getRelatedRestrictions(OntClass ontClass,
|
private void addRelatedRestrictions(OntClass ontClass,
|
||||||
List<Restriction> relatedRestrictions, int limit) {
|
List<Restriction> relatedRestrictions, int limit) {
|
||||||
limit--;
|
limit--;
|
||||||
if (ontClass.isRestriction()) {
|
if (ontClass.isRestriction()) {
|
||||||
|
@ -633,9 +634,7 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
while (operIt.hasNext()) {
|
while (operIt.hasNext()) {
|
||||||
OntClass operand = operIt.next();
|
OntClass operand = operIt.next();
|
||||||
if (!relatedRestrictions.contains(operand) && limit > 0) {
|
if (!relatedRestrictions.contains(operand) && limit > 0) {
|
||||||
relatedRestrictions.addAll(
|
addRelatedRestrictions(operand, relatedRestrictions, limit);
|
||||||
getRelatedRestrictions(
|
|
||||||
operand, relatedRestrictions, limit));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -644,12 +643,10 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
for (OntClass sup : superClasses) {
|
for (OntClass sup : superClasses) {
|
||||||
if (sup.isAnon() && !sup.equals(ontClass)
|
if (sup.isAnon() && !sup.equals(ontClass)
|
||||||
&& !relatedRestrictions.contains(ontClass) && limit > 0) {
|
&& !relatedRestrictions.contains(ontClass) && limit > 0) {
|
||||||
relatedRestrictions.addAll(
|
addRelatedRestrictions(sup, relatedRestrictions, limit);
|
||||||
getRelatedRestrictions(sup, relatedRestrictions, limit));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return relatedRestrictions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PropertyInstance> getAllPropInstByVClasses(List<VClass> vclasses) {
|
public List<PropertyInstance> getAllPropInstByVClasses(List<VClass> vclasses) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue