modifications for NIHVIVO-246.
changed the getSuperPropertyURIs and getSuperClassURIs methods in the property and class DaoJenas (and the interfaces that they implement, and the filtering code) to take an additional boolean argument named direct and to pass it to the Jena call. changed the edit controllers to invoke the above methods with direct=false. changed the recursive methods within the daos to invoke the above methods with direct=true
This commit is contained in:
parent
3105e29bca
commit
8d538b5fc6
11 changed files with 20 additions and 19 deletions
|
@ -138,7 +138,7 @@ public class DatapropEditController extends BaseEditController {
|
|||
? getAssertionsWebappDaoFactory().getDataPropertyDao()
|
||||
: getWebappDaoFactory().getDataPropertyDao();
|
||||
|
||||
List superURIs = assertionsDpDao.getSuperPropertyURIs(dp.getURI());
|
||||
List superURIs = assertionsDpDao.getSuperPropertyURIs(dp.getURI(),false);
|
||||
List superProperties = new ArrayList();
|
||||
Iterator superURIit = superURIs.iterator();
|
||||
while (superURIit.hasNext()) {
|
||||
|
|
|
@ -171,7 +171,7 @@ public class PropertyEditController extends BaseEditController {
|
|||
} else {
|
||||
opDao = getWebappDaoFactory().getObjectPropertyDao();
|
||||
}
|
||||
List superURIs = opDao.getSuperPropertyURIs(p.getURI());
|
||||
List superURIs = opDao.getSuperPropertyURIs(p.getURI(),false);
|
||||
List superProperties = new ArrayList();
|
||||
Iterator superURIit = superURIs.iterator();
|
||||
while (superURIit.hasNext()) {
|
||||
|
|
|
@ -150,7 +150,7 @@ public class VclassEditController extends BaseEditController {
|
|||
} else {
|
||||
vcDao = getWebappDaoFactory().getVClassDao();
|
||||
}
|
||||
List superURIs = vcDao.getSuperClassURIs(vcl.getURI());
|
||||
List superURIs = vcDao.getSuperClassURIs(vcl.getURI(),false);
|
||||
List superVClasses = new ArrayList();
|
||||
Iterator superURIit = superURIs.iterator();
|
||||
while (superURIit.hasNext()) {
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface ObjectPropertyDao extends PropertyDao {
|
|||
|
||||
public List <ObjectProperty> getObjectPropertiesForObjectPropertyStatements(List /*of ObjectPropertyStatement */ objectPropertyStatements);
|
||||
|
||||
public List<String> getSuperPropertyURIs(String objectPropertyURI);
|
||||
public List<String> getSuperPropertyURIs(String objectPropertyURI, boolean direct);
|
||||
|
||||
public List<String> getSubPropertyURIs(String objectPropertyURI);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public interface PropertyDao {
|
|||
|
||||
List <String> getAllSubPropertyURIs(String propertyURI);
|
||||
|
||||
List <String> getSuperPropertyURIs(String propertyURI);
|
||||
List <String> getSuperPropertyURIs(String propertyURI, boolean direct);
|
||||
|
||||
List <String> getAllSuperPropertyURIs(String propertyURI);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public interface VClassDao {
|
|||
|
||||
List <String> getAllSubClassURIs(String classURI);
|
||||
|
||||
List <String> getSuperClassURIs(String classURI);
|
||||
List <String> getSuperClassURIs(String classURI, boolean direct);
|
||||
|
||||
List <String> getAllSuperClassURIs(String classURI);
|
||||
|
||||
|
|
|
@ -133,8 +133,8 @@ class DataPropertyDaoFiltering extends BaseFiltering implements DataPropertyDao{
|
|||
return innerDataPropertyDao.getAllSubPropertyURIs(propertyURI);
|
||||
}
|
||||
|
||||
public List <String> getSuperPropertyURIs(String propertyURI) {
|
||||
return innerDataPropertyDao.getSuperPropertyURIs(propertyURI);
|
||||
public List <String> getSuperPropertyURIs(String propertyURI, boolean direct) {
|
||||
return innerDataPropertyDao.getSuperPropertyURIs(propertyURI, direct);
|
||||
}
|
||||
|
||||
public List <String> getAllSuperPropertyURIs(String propertyURI) {
|
||||
|
|
|
@ -120,8 +120,8 @@ class ObjectPropertyDaoFiltering extends BaseFiltering implements ObjectProperty
|
|||
return innerObjectPropertyDao.getAllSubPropertyURIs(propertyURI);
|
||||
}
|
||||
|
||||
public List <String> getSuperPropertyURIs(String propertyURI) {
|
||||
return innerObjectPropertyDao.getSuperPropertyURIs(propertyURI);
|
||||
public List <String> getSuperPropertyURIs(String propertyURI, boolean direct) {
|
||||
return innerObjectPropertyDao.getSuperPropertyURIs(propertyURI, direct);
|
||||
}
|
||||
|
||||
public List <String> getAllSuperPropertyURIs(String propertyURI) {
|
||||
|
|
|
@ -132,8 +132,8 @@ public class VClassDaoFiltering extends BaseFiltering implements VClassDao{
|
|||
return innerVClassDao.getSubClassURIs(classURI);
|
||||
}
|
||||
|
||||
public List<String> getSuperClassURIs(String classURI) {
|
||||
return innerVClassDao.getSuperClassURIs(classURI);
|
||||
public List<String> getSuperClassURIs(String classURI, boolean direct) {
|
||||
return innerVClassDao.getSuperClassURIs(classURI, direct);
|
||||
}
|
||||
|
||||
public VClass getVClassByURI(String URI) {
|
||||
|
|
|
@ -127,11 +127,11 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
|||
return outputList;
|
||||
}
|
||||
|
||||
public List <String> getSuperPropertyURIs(String propertyURI) {
|
||||
public List <String> getSuperPropertyURIs(String propertyURI, boolean direct) {
|
||||
List<String> supURIs = new LinkedList<String>();
|
||||
getOntModel().enterCriticalSection(Lock.READ);
|
||||
try {
|
||||
Iterator supIt = getOntModel().getOntProperty(propertyURI).listSuperProperties(true);
|
||||
Iterator supIt = getOntModel().getOntProperty(propertyURI).listSuperProperties(direct);
|
||||
while (supIt.hasNext()) {
|
||||
try {
|
||||
OntProperty prop = (OntProperty) supIt.next();
|
||||
|
@ -147,7 +147,7 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
|||
}
|
||||
|
||||
private void getAllSuperPropertyURIs(String propertyURI, HashSet<String> subtree){
|
||||
List<String> directSuperproperties = getSuperPropertyURIs(propertyURI);
|
||||
List<String> directSuperproperties = getSuperPropertyURIs(propertyURI,true);
|
||||
Iterator<String> it=directSuperproperties.iterator();
|
||||
while(it.hasNext()){
|
||||
String uri = (String)it.next();
|
||||
|
|
|
@ -417,7 +417,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
|||
}
|
||||
|
||||
public void getAllSuperClassURIs(String classURI, HashSet<String> subtree){
|
||||
List<String> directSuperclasses = getSuperClassURIs(classURI);
|
||||
List<String> directSuperclasses = getSuperClassURIs(classURI, true);
|
||||
Iterator<String> it=directSuperclasses.iterator();
|
||||
while(it.hasNext()){
|
||||
String uri = (String)it.next();
|
||||
|
@ -607,16 +607,17 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
|||
return subURIs;
|
||||
}
|
||||
|
||||
public List <String> getSuperClassURIs(String classURI) {
|
||||
public List <String> getSuperClassURIs(String classURI, boolean direct) {
|
||||
List supURIs = new ArrayList();
|
||||
OntClass subClass = getOntClass(getOntModel(), classURI);
|
||||
try {
|
||||
Iterator supIt = subClass.listSuperClasses(true);
|
||||
Iterator supIt = subClass.listSuperClasses(direct);
|
||||
while (supIt.hasNext()) {
|
||||
OntClass cls = (OntClass) supIt.next();
|
||||
supURIs.add(getClassURIStr(cls));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//TODO make this attempt respect the direct argument
|
||||
// we'll try this again using a different method that doesn't try to convert to OntClass
|
||||
List<Resource> supList = this.listDirectObjectPropertyValues(getOntModel().getResource(classURI), RDFS.subClassOf);
|
||||
for (Resource res : supList) {
|
||||
|
@ -691,7 +692,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
|||
OntResource superclass = null;
|
||||
if (vclassURI != null) {
|
||||
// TODO need a getAllSuperPropertyURIs method in ObjectPropertyDao
|
||||
List<String> superproperties = getWebappDaoFactory().getObjectPropertyDao().getSuperPropertyURIs(propertyURI);
|
||||
List<String> superproperties = getWebappDaoFactory().getObjectPropertyDao().getSuperPropertyURIs(propertyURI,false);
|
||||
superproperties.add(propertyURI);
|
||||
HashSet<String> subjSuperclasses = new HashSet<String>(getAllSuperClassURIs(vclassURI));
|
||||
subjSuperclasses.add(vclassURI);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue