Minor code improvements
This commit is contained in:
parent
d97544b991
commit
751d50f93a
44 changed files with 476 additions and 625 deletions
|
@ -178,19 +178,16 @@ public class BaseEditController extends VitroHttpServlet {
|
||||||
|
|
||||||
List<String> bodyVal = new ArrayList<String>();
|
List<String> bodyVal = new ArrayList<String>();
|
||||||
List<Option> options = new ArrayList<Option>();
|
List<Option> options = new ArrayList<Option>();
|
||||||
Iterator<Option> itr = optionList.iterator();
|
for (Option option : optionList) {
|
||||||
while(itr.hasNext()){
|
hashMap.put(option.getBody(), option);
|
||||||
Option option = itr.next();
|
bodyVal.add(option.getBody());
|
||||||
hashMap.put(option.getBody(),option);
|
|
||||||
bodyVal.add(option.getBody());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Collections.sort(bodyVal, new ListComparator(vreq.getCollator()));
|
Collections.sort(bodyVal, new ListComparator(vreq.getCollator()));
|
||||||
ListIterator<String> itrStr = bodyVal.listIterator();
|
for (String aBodyVal : bodyVal) {
|
||||||
while(itrStr.hasNext()){
|
options.add(hashMap.get(aBodyVal));
|
||||||
options.add(hashMap.get(itrStr.next()));
|
}
|
||||||
}
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,27 +162,26 @@ public class DynamicFieldsTag extends EditTag {
|
||||||
|
|
||||||
out.print(preWithVars);
|
out.print(preWithVars);
|
||||||
|
|
||||||
Iterator<DynamicFieldRow> rowIt = dynf.getRowList().iterator();
|
for (DynamicFieldRow dynamicFieldRow : dynf.getRowList()) {
|
||||||
while (rowIt.hasNext()) {
|
|
||||||
++i;
|
++i;
|
||||||
DynamicFieldRow row = rowIt.next();
|
DynamicFieldRow row = dynamicFieldRow;
|
||||||
if (row.getValue()==null)
|
if (row.getValue() == null)
|
||||||
row.setValue("");
|
row.setValue("");
|
||||||
if (row.getValue().length()>0) {
|
if (row.getValue().length() > 0) {
|
||||||
StringBuilder taName = new StringBuilder().append("_").append(dynf.getTable()).append("_");
|
StringBuilder taName = new StringBuilder().append("_").append(dynf.getTable()).append("_");
|
||||||
taName.append(row.getId()).append("_");
|
taName.append(row.getId()).append("_");
|
||||||
Iterator paramIt = row.getParameterMap().keySet().iterator();
|
Iterator paramIt = row.getParameterMap().keySet().iterator();
|
||||||
while(paramIt.hasNext()) {
|
while (paramIt.hasNext()) {
|
||||||
String key = (String) paramIt.next();
|
String key = (String) paramIt.next();
|
||||||
String value = (String) row.getParameterMap().get(key);
|
String value = (String) row.getParameterMap().get(key);
|
||||||
byte[] valueInBase64 = Base64.encodeBase64(value.getBytes());
|
byte[] valueInBase64 = Base64.encodeBase64(value.getBytes());
|
||||||
taName.append(key).append(":").append(new String(valueInBase64)).append(";");
|
taName.append(key).append(":").append(new String(valueInBase64)).append(";");
|
||||||
}
|
}
|
||||||
if (row.getValue().length()>0) {
|
if (row.getValue().length() > 0) {
|
||||||
String templateWithVars = templateMarkup;
|
String templateWithVars = templateMarkup;
|
||||||
templateWithVars = strReplace(templateWithVars,type+"NN",Integer.toString(i));
|
templateWithVars = strReplace(templateWithVars, type + "NN", Integer.toString(i));
|
||||||
templateWithVars = strReplace(templateWithVars,"\\$taName",taName.toString());
|
templateWithVars = strReplace(templateWithVars, "\\$taName", taName.toString());
|
||||||
templateWithVars = strReplace(templateWithVars,"\\$\\$",row.getValue());
|
templateWithVars = strReplace(templateWithVars, "\\$\\$", row.getValue());
|
||||||
out.print(templateWithVars);
|
out.print(templateWithVars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,10 +301,8 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
||||||
protected void sortEnts2EntsForDisplay(){
|
protected void sortEnts2EntsForDisplay(){
|
||||||
if( getObjectPropertyList() == null ) return;
|
if( getObjectPropertyList() == null ) return;
|
||||||
|
|
||||||
Iterator it = getObjectPropertyList().iterator();
|
for (ObjectProperty prop : getObjectPropertyList()) {
|
||||||
while(it.hasNext()){
|
prop.sortObjectPropertyStatementsForDisplay(prop, prop.getObjectPropertyStatements());
|
||||||
ObjectProperty prop = (ObjectProperty)it.next();
|
|
||||||
prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,9 +144,7 @@ public class EntityEditController extends BaseEditController {
|
||||||
try {
|
try {
|
||||||
List<Option> externalIdOptionList = new LinkedList<Option>();
|
List<Option> externalIdOptionList = new LinkedList<Option>();
|
||||||
if (ent.getExternalIds() != null) {
|
if (ent.getExternalIds() != null) {
|
||||||
Iterator<DataPropertyStatement> externalIdIt = ent.getExternalIds().iterator();
|
for (DataPropertyStatement eid : ent.getExternalIds()) {
|
||||||
while (externalIdIt.hasNext()) {
|
|
||||||
DataPropertyStatement eid = externalIdIt.next();
|
|
||||||
String multiplexedString = "DatapropURI:" + new String(Base64.encodeBase64(eid.getDatapropURI().getBytes())) + ";" + "Data:" + new String(Base64.encodeBase64(eid.getData().getBytes()));
|
String multiplexedString = "DatapropURI:" + new String(Base64.encodeBase64(eid.getDatapropURI().getBytes())) + ";" + "Data:" + new String(Base64.encodeBase64(eid.getData().getBytes()));
|
||||||
externalIdOptionList.add(new Option(multiplexedString, eid.getData()));
|
externalIdOptionList.add(new Option(multiplexedString, eid.getData()));
|
||||||
}
|
}
|
||||||
|
@ -169,11 +167,9 @@ public class EntityEditController extends BaseEditController {
|
||||||
try {
|
try {
|
||||||
List epiOptionList = new LinkedList();
|
List epiOptionList = new LinkedList();
|
||||||
Collection<PropertyInstance> epiColl = piDao.getExistingProperties(ent.getURI(),null);
|
Collection<PropertyInstance> epiColl = piDao.getExistingProperties(ent.getURI(),null);
|
||||||
Iterator<PropertyInstance> epiIt = epiColl.iterator();
|
for (PropertyInstance pi : epiColl) {
|
||||||
while (epiIt.hasNext()) {
|
|
||||||
PropertyInstance pi = epiIt.next();
|
|
||||||
String multiplexedString = "PropertyURI:" + new String(Base64.encodeBase64(pi.getPropertyURI().getBytes())) + ";" + "ObjectEntURI:" + new String(Base64.encodeBase64(pi.getObjectEntURI().getBytes()));
|
String multiplexedString = "PropertyURI:" + new String(Base64.encodeBase64(pi.getPropertyURI().getBytes())) + ";" + "ObjectEntURI:" + new String(Base64.encodeBase64(pi.getObjectEntURI().getBytes()));
|
||||||
epiOptionList.add(new Option(multiplexedString, pi.getDomainPublic()+" "+pi.getObjectName()));
|
epiOptionList.add(new Option(multiplexedString, pi.getDomainPublic() + " " + pi.getObjectName()));
|
||||||
}
|
}
|
||||||
OptionMap.put("ExistingPropertyInstances", epiOptionList);
|
OptionMap.put("ExistingPropertyInstances", epiOptionList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -211,25 +211,21 @@ public class EntityRetryController extends BaseEditController {
|
||||||
Collections.sort(allApplicableDataprops);
|
Collections.sort(allApplicableDataprops);
|
||||||
|
|
||||||
if (allApplicableDataprops != null) {
|
if (allApplicableDataprops != null) {
|
||||||
Iterator<DataProperty> datapropsIt = allApplicableDataprops.iterator();
|
|
||||||
|
|
||||||
while (datapropsIt.hasNext()){
|
for (DataProperty d : allApplicableDataprops) {
|
||||||
DataProperty d = datapropsIt.next();
|
|
||||||
if (!dpMap.containsKey(d.getURI())) {
|
if (!dpMap.containsKey(d.getURI())) {
|
||||||
dpMap.put(d.getURI(),d);
|
dpMap.put(d.getURI(), d);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (individualForEditing.getDataPropertyList() != null) {
|
if (individualForEditing.getDataPropertyList() != null) {
|
||||||
Iterator<DataProperty> existingDps = individualForEditing.getDataPropertyList().iterator();
|
for (DataProperty existingDp : individualForEditing.getDataPropertyList()) {
|
||||||
while (existingDps.hasNext()) {
|
// Since the edit form begins with a "name" field, which gets saved as the rdfs:label,
|
||||||
DataProperty existingDp = existingDps.next();
|
// do not want to include the label as well.
|
||||||
// Since the edit form begins with a "name" field, which gets saved as the rdfs:label,
|
if (!existingDp.getPublicName().equals("label")) {
|
||||||
// do not want to include the label as well.
|
dpMap.put(existingDp.getURI(), existingDp);
|
||||||
if ( !existingDp.getPublicName().equals("label") ) {
|
}
|
||||||
dpMap.put(existingDp.getURI(),existingDp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,9 +245,7 @@ public class EntityRetryController extends BaseEditController {
|
||||||
rowTemplate.setParameterMap(parameterMap);
|
rowTemplate.setParameterMap(parameterMap);
|
||||||
dynamo.setRowTemplate(rowTemplate);
|
dynamo.setRowTemplate(rowTemplate);
|
||||||
try {
|
try {
|
||||||
Iterator<DataPropertyStatement> existingValues = dp.getDataPropertyStatements().iterator();
|
for (DataPropertyStatement existingValue : dp.getDataPropertyStatements()) {
|
||||||
while (existingValues.hasNext()) {
|
|
||||||
DataPropertyStatement existingValue = existingValues.next();
|
|
||||||
DynamicFieldRow row = new DynamicFieldRow();
|
DynamicFieldRow row = new DynamicFieldRow();
|
||||||
//TODO: UGH
|
//TODO: UGH
|
||||||
//row.setId(existingValue.getId());
|
//row.setId(existingValue.getId());
|
||||||
|
|
|
@ -122,9 +122,7 @@ public class ObjectPropertyStatementRetryController extends BaseEditController {
|
||||||
indList.addAll(possIndSet);
|
indList.addAll(possIndSet);
|
||||||
sortForPickList(indList, vreq);
|
sortForPickList(indList, vreq);
|
||||||
List objectEntOptionList = new LinkedList();
|
List objectEntOptionList = new LinkedList();
|
||||||
Iterator<Individual> indIt = indList.iterator();
|
for (Individual objInd : indList) {
|
||||||
while (indIt.hasNext()) {
|
|
||||||
Individual objInd = indIt.next();
|
|
||||||
Option objIndOpt = new Option(objInd.getURI(), objInd.getName());
|
Option objIndOpt = new Option(objInd.getURI(), objInd.getName());
|
||||||
if (objectForEditing.getObjectEntURI() != null && objectForEditing.getObjectEntURI().equals(objInd.getURI())) {
|
if (objectForEditing.getObjectEntURI() != null && objectForEditing.getObjectEntURI().equals(objInd.getURI())) {
|
||||||
objIndOpt.setSelected(true);
|
objIndOpt.setSelected(true);
|
||||||
|
|
|
@ -203,9 +203,7 @@ public class VclassEditController extends BaseEditController {
|
||||||
|
|
||||||
private List<VClass> getVClassesForURIList(List<String> vclassURIs, VClassDao vcDao) {
|
private List<VClass> getVClassesForURIList(List<String> vclassURIs, VClassDao vcDao) {
|
||||||
List<VClass> vclasses = new ArrayList<VClass>();
|
List<VClass> vclasses = new ArrayList<VClass>();
|
||||||
Iterator<String> urIt = vclassURIs.iterator();
|
for (String vclassURI : vclassURIs) {
|
||||||
while (urIt.hasNext()) {
|
|
||||||
String vclassURI = urIt.next();
|
|
||||||
VClass vclass = vcDao.getVClassByURI(vclassURI);
|
VClass vclass = vcDao.getVClassByURI(vclassURI);
|
||||||
if (vclass != null) {
|
if (vclass != null) {
|
||||||
vclasses.add(vclass);
|
vclasses.add(vclass);
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class IndividualsListingController extends BaseEditController {
|
||||||
String vclassURI = request.getParameter("VClassURI");
|
String vclassURI = request.getParameter("VClassURI");
|
||||||
VClass vc = vcDao.getVClassByURI(vclassURI);
|
VClass vc = vcDao.getVClassByURI(vclassURI);
|
||||||
|
|
||||||
List inds = dao.getIndividualsByVClassURI(vclassURI);
|
List<Individual> inds = dao.getIndividualsByVClassURI(vclassURI);
|
||||||
//List inds = dao.getIndividualsByVClassURI(vclassURI,1,MAX_INDIVIDUALS);
|
//List inds = dao.getIndividualsByVClassURI(vclassURI,1,MAX_INDIVIDUALS);
|
||||||
|
|
||||||
ArrayList results = new ArrayList();
|
ArrayList results = new ArrayList();
|
||||||
|
@ -64,16 +64,13 @@ public class IndividualsListingController extends BaseEditController {
|
||||||
results.add("class");
|
results.add("class");
|
||||||
|
|
||||||
if (inds != null && inds.size()>0) {
|
if (inds != null && inds.size()>0) {
|
||||||
Iterator indsIt = inds.iterator();
|
for (Individual ind : inds) {
|
||||||
while (indsIt.hasNext()) {
|
|
||||||
Individual ind = (Individual) indsIt.next();
|
|
||||||
|
|
||||||
results.add("XX");
|
results.add("XX");
|
||||||
|
|
||||||
if (ind.getName() != null) {
|
if (ind.getName() != null) {
|
||||||
try {
|
try {
|
||||||
String individualName = (ind.getName()==null || ind.getName().length()==0) ? ind.getURI() : ind.getName();
|
String individualName = (ind.getName() == null || ind.getName().length() == 0) ? ind.getURI() : ind.getName();
|
||||||
results.add("<a href=\"./entityEdit?uri="+URLEncoder.encode(ind.getURI(),"UTF-8")+"\">"+individualName+"</a>");
|
results.add("<a href=\"./entityEdit?uri=" + URLEncoder.encode(ind.getURI(), "UTF-8") + "\">" + individualName + "</a>");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
results.add(ind.getName());
|
results.add(ind.getName());
|
||||||
}
|
}
|
||||||
|
@ -84,8 +81,8 @@ public class IndividualsListingController extends BaseEditController {
|
||||||
|
|
||||||
if (vc != null) {
|
if (vc != null) {
|
||||||
try {
|
try {
|
||||||
String vclassName = (vc.getName()==null || vc.getName().length()==0) ? vc.getURI() : vc.getName();
|
String vclassName = (vc.getName() == null || vc.getName().length() == 0) ? vc.getURI() : vc.getName();
|
||||||
results.add("<a href=\"./vclassEdit?uri="+URLEncoder.encode(vc.getURI(),"UTF-8")+"\">"+vclassName+"</a>");
|
results.add("<a href=\"./vclassEdit?uri=" + URLEncoder.encode(vc.getURI(), "UTF-8") + "\">" + vclassName + "</a>");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
results.add(vc.getName());
|
results.add(vc.getName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,42 +146,41 @@ public class ListPropertyWebappsController extends FreemarkerHttpServlet {
|
||||||
if (props.size()==0) {
|
if (props.size()==0) {
|
||||||
json = new StringBuilder("{ \"name\": \"" + noResultsMsgStr + "\" }");
|
json = new StringBuilder("{ \"name\": \"" + noResultsMsgStr + "\" }");
|
||||||
} else {
|
} else {
|
||||||
Iterator<ObjectProperty> propsIt = props.iterator();
|
for (ObjectProperty prop1 : props) {
|
||||||
while (propsIt.hasNext()) {
|
if (counter > 0) {
|
||||||
if ( counter > 0 ) {
|
|
||||||
json.append(", ");
|
json.append(", ");
|
||||||
}
|
}
|
||||||
ObjectProperty prop = propsIt.next();
|
ObjectProperty prop = prop1;
|
||||||
|
|
||||||
String propNameStr = ShowObjectPropertyHierarchyController.getDisplayLabel(prop);
|
String propNameStr = ShowObjectPropertyHierarchyController.getDisplayLabel(prop);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
json.append("{ \"name\": ").append(JacksonUtils.quote("<a href='./propertyEdit?uri=" + URLEncoder.encode(prop.getURI()) + "'>"
|
json.append("{ \"name\": ").append(JacksonUtils.quote("<a href='./propertyEdit?uri=" + URLEncoder.encode(prop.getURI()) + "'>"
|
||||||
+ propNameStr + "</a>")).append(", ");
|
+ propNameStr + "</a>")).append(", ");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
json.append("{ \"name\": \"").append(propNameStr).append("\", ");
|
json.append("{ \"name\": \"").append(propNameStr).append("\", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
json.append("\"data\": { \"internalName\": ").append(JacksonUtils.quote(prop.getLocalNameWithPrefix())).append(", ");
|
json.append("\"data\": { \"internalName\": ").append(JacksonUtils.quote(prop.getLocalNameWithPrefix())).append(", ");
|
||||||
|
|
||||||
ObjectProperty opLangNeut = opDaoLangNeut.getObjectPropertyByURI(prop.getURI());
|
ObjectProperty opLangNeut = opDaoLangNeut.getObjectPropertyByURI(prop.getURI());
|
||||||
if(opLangNeut == null) {
|
if (opLangNeut == null) {
|
||||||
opLangNeut = prop;
|
opLangNeut = prop;
|
||||||
}
|
}
|
||||||
String domainStr = getVClassNameFromURI(opLangNeut.getDomainVClassURI(), vcDao, vcDaoLangNeut);
|
String domainStr = getVClassNameFromURI(opLangNeut.getDomainVClassURI(), vcDao, vcDaoLangNeut);
|
||||||
json.append("\"domainVClass\": ").append(JacksonUtils.quote(domainStr)).append(", ");
|
json.append("\"domainVClass\": ").append(JacksonUtils.quote(domainStr)).append(", ");
|
||||||
|
|
||||||
String rangeStr = getVClassNameFromURI(opLangNeut.getRangeVClassURI(), vcDao, vcDaoLangNeut);
|
String rangeStr = getVClassNameFromURI(opLangNeut.getRangeVClassURI(), vcDao, vcDaoLangNeut);
|
||||||
json.append("\"rangeVClass\": ").append(JacksonUtils.quote(rangeStr)).append(", ");
|
json.append("\"rangeVClass\": ").append(JacksonUtils.quote(rangeStr)).append(", ");
|
||||||
|
|
||||||
if (prop.getGroupURI() != null) {
|
if (prop.getGroupURI() != null) {
|
||||||
PropertyGroup pGroup = pgDao.getGroupByURI(prop.getGroupURI());
|
PropertyGroup pGroup = pgDao.getGroupByURI(prop.getGroupURI());
|
||||||
json.append("\"group\": ").append(JacksonUtils.quote((pGroup == null) ? "unknown group" : pGroup.getName())).append(" } } ");
|
json.append("\"group\": ").append(JacksonUtils.quote((pGroup == null) ? "unknown group" : pGroup.getName())).append(" } } ");
|
||||||
} else {
|
} else {
|
||||||
json.append("\"group\": \"unspecified\" } }");
|
json.append("\"group\": \"unspecified\" } }");
|
||||||
}
|
}
|
||||||
counter += 1;
|
counter += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body.put("jsonTree", json.toString());
|
body.put("jsonTree", json.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,53 +83,52 @@ public class ListVClassWebappsController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
if (classes != null) {
|
if (classes != null) {
|
||||||
sortForPickList(classes, vreq);
|
sortForPickList(classes, vreq);
|
||||||
Iterator<VClass> classesIt = classes.iterator();
|
for (VClass aClass : classes) {
|
||||||
while (classesIt.hasNext()) {
|
if (counter > 0) {
|
||||||
if ( counter > 0 ) {
|
json.append(", ");
|
||||||
json.append(", ");
|
}
|
||||||
}
|
VClass cls = aClass;
|
||||||
VClass cls = (VClass) classesIt.next();
|
if ((ontologyURI == null) || ((ontologyURI != null) && (cls.getNamespace() != null) && (ontologyURI.equals(cls.getNamespace())))) {
|
||||||
if ( (ontologyURI==null) || ( (ontologyURI != null) && (cls.getNamespace()!=null) && (ontologyURI.equals(cls.getNamespace())) ) ) {
|
if (cls.getName() != null)
|
||||||
if (cls.getName() != null)
|
try {
|
||||||
try {
|
json.append("{ \"name\": ").append(JacksonUtils.quote("<a href='./vclassEdit?uri=" + URLEncoder.encode(cls.getURI(), "UTF-8") + "'>" + cls.getPickListName() + "</a>")).append(", ");
|
||||||
json.append("{ \"name\": ").append(JacksonUtils.quote("<a href='./vclassEdit?uri=" + URLEncoder.encode(cls.getURI(), "UTF-8") + "'>" + cls.getPickListName() + "</a>")).append(", ");
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
json.append("{ \"name\": ").append(JacksonUtils.quote(cls.getPickListName())).append(", ");
|
||||||
json.append("{ \"name\": ").append(JacksonUtils.quote(cls.getPickListName())).append(", ");
|
}
|
||||||
}
|
else
|
||||||
else
|
json.append("{ \"name\": \"\"");
|
||||||
json.append("{ \"name\": \"\"");
|
String shortDef = (cls.getShortDef() == null) ? "" : cls.getShortDef();
|
||||||
String shortDef = (cls.getShortDef() == null) ? "" : cls.getShortDef();
|
|
||||||
|
|
||||||
json.append("\"data\": { \"shortDef\": ").append(JacksonUtils.quote(shortDef)).append(", ");
|
json.append("\"data\": { \"shortDef\": ").append(JacksonUtils.quote(shortDef)).append(", ");
|
||||||
|
|
||||||
// get group name
|
// get group name
|
||||||
WebappDaoFactory wadf = vreq.getUnfilteredWebappDaoFactory();
|
WebappDaoFactory wadf = vreq.getUnfilteredWebappDaoFactory();
|
||||||
VClassGroupDao groupDao= wadf.getVClassGroupDao();
|
VClassGroupDao groupDao = wadf.getVClassGroupDao();
|
||||||
String groupURI = cls.getGroupURI();
|
String groupURI = cls.getGroupURI();
|
||||||
String groupName = "";
|
String groupName = "";
|
||||||
VClassGroup classGroup = null;
|
VClassGroup classGroup = null;
|
||||||
if(groupURI != null) {
|
if (groupURI != null) {
|
||||||
classGroup = groupDao.getGroupByURI(groupURI);
|
classGroup = groupDao.getGroupByURI(groupURI);
|
||||||
if (classGroup!=null) {
|
if (classGroup != null) {
|
||||||
groupName = classGroup.getPublicName();
|
groupName = classGroup.getPublicName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
json.append("\"classGroup\": ").append(JacksonUtils.quote(groupName)).append(", ");
|
json.append("\"classGroup\": ").append(JacksonUtils.quote(groupName)).append(", ");
|
||||||
|
|
||||||
// get ontology name
|
// get ontology name
|
||||||
OntologyDao ontDao = wadf.getOntologyDao();
|
OntologyDao ontDao = wadf.getOntologyDao();
|
||||||
String ontName = cls.getNamespace();
|
String ontName = cls.getNamespace();
|
||||||
Ontology ont = ontDao.getOntologyByURI(ontName);
|
Ontology ont = ontDao.getOntologyByURI(ontName);
|
||||||
if (ont != null && ont.getName() != null) {
|
if (ont != null && ont.getName() != null) {
|
||||||
ontName = ont.getName();
|
ontName = ont.getName();
|
||||||
}
|
}
|
||||||
json.append("\"ontology\": ").append(JacksonUtils.quote(ontName)).append("} }");
|
json.append("\"ontology\": ").append(JacksonUtils.quote(ontName)).append("} }");
|
||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body.put("jsonTree", json.toString());
|
body.put("jsonTree", json.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,15 +134,14 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
||||||
List<String> childURIstrs = vcDao.getSubClassURIs(parent.getURI());
|
List<String> childURIstrs = vcDao.getSubClassURIs(parent.getURI());
|
||||||
if ((childURIstrs.size()>0) && position<MAXDEPTH) {
|
if ((childURIstrs.size()>0) && position<MAXDEPTH) {
|
||||||
List<VClass> childClasses = new ArrayList<VClass>();
|
List<VClass> childClasses = new ArrayList<VClass>();
|
||||||
Iterator<String> childURIstrIt = childURIstrs.iterator();
|
for (String URIstr : childURIstrs) {
|
||||||
while (childURIstrIt.hasNext()) {
|
|
||||||
String URIstr = childURIstrIt.next();
|
|
||||||
try {
|
try {
|
||||||
VClass child = vcDao.getVClassByURI(URIstr);
|
VClass child = vcDao.getVClassByURI(URIstr);
|
||||||
if (!child.getURI().equals(OWL.Nothing.getURI())) {
|
if (!child.getURI().equals(OWL.Nothing.getURI())) {
|
||||||
childClasses.add(child);
|
childClasses.add(child);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sortForPickList(childClasses, vreq);
|
sortForPickList(childClasses, vreq);
|
||||||
Iterator<VClass> childClassIt = childClasses.iterator();
|
Iterator<VClass> childClassIt = childClasses.iterator();
|
||||||
|
|
|
@ -147,9 +147,7 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
||||||
List<String> childURIstrs = dpDao.getSubPropertyURIs(parent.getURI());
|
List<String> childURIstrs = dpDao.getSubPropertyURIs(parent.getURI());
|
||||||
if ( (childURIstrs.size() > 0) && (position < MAXDEPTH) ) {
|
if ( (childURIstrs.size() > 0) && (position < MAXDEPTH) ) {
|
||||||
List<DataProperty> childProps = new ArrayList<DataProperty>();
|
List<DataProperty> childProps = new ArrayList<DataProperty>();
|
||||||
Iterator<String> childURIstrIt = childURIstrs.iterator();
|
for (String URIstr : childURIstrs) {
|
||||||
while (childURIstrIt.hasNext()) {
|
|
||||||
String URIstr = childURIstrIt.next();
|
|
||||||
DataProperty child = dpDao.getDataPropertyByURI(URIstr);
|
DataProperty child = dpDao.getDataPropertyByURI(URIstr);
|
||||||
childProps.add(child);
|
childProps.add(child);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,9 +151,7 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet
|
||||||
List<String> childURIstrs = opDao.getSubPropertyURIs(parent.getURI());
|
List<String> childURIstrs = opDao.getSubPropertyURIs(parent.getURI());
|
||||||
if ( (childURIstrs.size() > 0) && (position < MAXDEPTH) ) {
|
if ( (childURIstrs.size() > 0) && (position < MAXDEPTH) ) {
|
||||||
List<ObjectProperty> childProps = new ArrayList<ObjectProperty>();
|
List<ObjectProperty> childProps = new ArrayList<ObjectProperty>();
|
||||||
Iterator<String> childURIstrIt = childURIstrs.iterator();
|
for (String URIstr : childURIstrs) {
|
||||||
while (childURIstrIt.hasNext()) {
|
|
||||||
String URIstr = childURIstrIt.next();
|
|
||||||
ObjectProperty child = opDao.getObjectPropertyByURI(URIstr);
|
ObjectProperty child = opDao.getObjectPropertyByURI(URIstr);
|
||||||
childProps.add(child);
|
childProps.add(child);
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,18 +202,16 @@ public class GrefinePropertyListServlet extends VitroHttpServlet {
|
||||||
HashMap<VClass, List<DataProperty>> classPropertiesMap = new HashMap<VClass, List<DataProperty>>();
|
HashMap<VClass, List<DataProperty>> classPropertiesMap = new HashMap<VClass, List<DataProperty>>();
|
||||||
List<DataProperty> props = new ArrayList<DataProperty>();
|
List<DataProperty> props = new ArrayList<DataProperty>();
|
||||||
VClass topVc = vcDao.getVClassByURI(uri);
|
VClass topVc = vcDao.getVClassByURI(uri);
|
||||||
Collection <DataProperty> dataProps = dao.getDataPropertiesForVClass(uri);
|
Collection <DataProperty> dataProps = dao.getDataPropertiesForVClass(uri);
|
||||||
Iterator<DataProperty> dataPropIt = dataProps.iterator();
|
for (DataProperty dp : dataProps) {
|
||||||
while (dataPropIt.hasNext()) {
|
if (!(propURIs.contains(dp.getURI()))) {
|
||||||
DataProperty dp = dataPropIt.next();
|
propURIs.add(dp.getURI());
|
||||||
if (!(propURIs.contains(dp.getURI()))) {
|
DataProperty prop = dao.getDataPropertyByURI(dp.getURI());
|
||||||
propURIs.add(dp.getURI());
|
if (prop != null) {
|
||||||
DataProperty prop = dao.getDataPropertyByURI(dp.getURI());
|
props.add(prop);
|
||||||
if (prop != null) {
|
}
|
||||||
props.add(prop);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (props.size() > 0) {
|
if (props.size() > 0) {
|
||||||
|
@ -256,22 +254,21 @@ public class GrefinePropertyListServlet extends VitroHttpServlet {
|
||||||
List childURIstrs = vcDao.getSubClassURIs(parent.getURI());
|
List childURIstrs = vcDao.getSubClassURIs(parent.getURI());
|
||||||
if ((childURIstrs.size()>0) && position<MAXDEPTH) {
|
if ((childURIstrs.size()>0) && position<MAXDEPTH) {
|
||||||
List childClasses = new ArrayList();
|
List childClasses = new ArrayList();
|
||||||
Iterator childURIstrIt = childURIstrs.iterator();
|
for (Object childURIstr : childURIstrs) {
|
||||||
while (childURIstrIt.hasNext()) {
|
String URIstr = (String) childURIstr;
|
||||||
String URIstr = (String) childURIstrIt.next();
|
try {
|
||||||
try {
|
VClass child = (VClass) vcDao.getVClassByURI(URIstr);
|
||||||
VClass child = (VClass) vcDao.getVClassByURI(URIstr);
|
if (!child.getURI().equals(OWL.Nothing.getURI())) {
|
||||||
if (!child.getURI().equals(OWL.Nothing.getURI())) {
|
childClasses.add(child);
|
||||||
childClasses.add(child);
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(childClasses);
|
Collections.sort(childClasses);
|
||||||
Iterator childClassIt = childClasses.iterator();
|
for (Object childClass : childClasses) {
|
||||||
while (childClassIt.hasNext()) {
|
VClass child = (VClass) childClass;
|
||||||
VClass child = (VClass) childClassIt.next();
|
addChildren(vcDao, wadf, child, list, position + childShift, ontologyUri);
|
||||||
addChildren(vcDao, wadf, child, list, position + childShift, ontologyUri);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -403,9 +403,7 @@ public class JSONReconcileServlet extends VitroHttpServlet {
|
||||||
query.addFields(VitroSearchTermNames.NAME_RAW, VitroSearchTermNames.URI, "*", "score"); // fields to retrieve
|
query.addFields(VitroSearchTermNames.NAME_RAW, VitroSearchTermNames.URI, "*", "score"); // fields to retrieve
|
||||||
|
|
||||||
// if propertiesList has elements, add extra queries to query
|
// if propertiesList has elements, add extra queries to query
|
||||||
Iterator<String[]> it = propertiesList.iterator();
|
for (String[] pvPair : propertiesList) {
|
||||||
while (it.hasNext()) {
|
|
||||||
String[] pvPair = it.next();
|
|
||||||
query.addFilterQueries(tokenizeNameQuery(pvPair[1]), VitroSearchTermNames.RDFTYPE + ":\"" + pvPair[0] + "\"");
|
query.addFilterQueries(tokenizeNameQuery(pvPair[1]), VitroSearchTermNames.RDFTYPE + ":\"" + pvPair[0] + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -500,9 +500,7 @@ public class JenaIngestController extends BaseEditController {
|
||||||
List<Ontology> ontologiesObj = daoObj.getAllOntologies();
|
List<Ontology> ontologiesObj = daoObj.getAllOntologies();
|
||||||
List<String> prefixList = new ArrayList<>();
|
List<String> prefixList = new ArrayList<>();
|
||||||
if(ontologiesObj !=null && ontologiesObj.size()>0){
|
if(ontologiesObj !=null && ontologiesObj.size()>0){
|
||||||
Iterator<Ontology> ontItr = ontologiesObj.iterator();
|
for (Ontology ont : ontologiesObj) {
|
||||||
while(ontItr.hasNext()){
|
|
||||||
Ontology ont = ontItr.next();
|
|
||||||
prefixList.add(ont.getPrefix() == null ? "(not yet specified)" : ont.getPrefix());
|
prefixList.add(ont.getPrefix() == null ? "(not yet specified)" : ont.getPrefix());
|
||||||
prefixList.add(ont.getURI() == null ? "" : ont.getURI());
|
prefixList.add(ont.getURI() == null ? "" : ont.getURI());
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,11 +190,9 @@ public class VClassDaoFiltering extends BaseFiltering implements VClassDao{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVClassesToGroups(List groups) {
|
public void addVClassesToGroups(List<VClassGroup> groups) {
|
||||||
if ((groups != null) && (groups.size()>0)) {
|
if ((groups != null) && (groups.size()>0)) {
|
||||||
Iterator groupIt = groups.iterator();
|
for (VClassGroup g : groups) {
|
||||||
while (groupIt.hasNext()) {
|
|
||||||
VClassGroup g = (VClassGroup) groupIt.next();
|
|
||||||
this.addVClassesToGroup(g);
|
this.addVClassesToGroup(g);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -633,13 +633,11 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
isRoot = true;
|
isRoot = true;
|
||||||
} else {
|
} else {
|
||||||
isRoot = true;
|
isRoot = true;
|
||||||
Iterator<Property> pit = parentList.iterator();
|
for (Property pt : parentList) {
|
||||||
while (pit.hasNext()) {
|
if ((!pt.equals(op)) && (!(ontModel.contains(op, OWL.equivalentProperty, pt)) || (ontModel.contains(pt, OWL.equivalentProperty, op)))) {
|
||||||
Property pt = pit.next();
|
isRoot = false;
|
||||||
if ( (!pt.equals(op)) && (!(ontModel.contains(op,OWL.equivalentProperty,pt)) || (ontModel.contains(pt,OWL.equivalentProperty,op))) ) {
|
}
|
||||||
isRoot = false;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isRoot = true;
|
isRoot = true;
|
||||||
|
|
|
@ -66,10 +66,8 @@ public class DependentResourceDeleteJena {
|
||||||
ListIterator <Statement>removed = removedStmts.listIterator();
|
ListIterator <Statement>removed = removedStmts.listIterator();
|
||||||
while( removed.hasNext()){
|
while( removed.hasNext()){
|
||||||
Statement removedStmt = removed.next();
|
Statement removedStmt = removed.next();
|
||||||
ListIterator <Statement>changed = changedStmts.listIterator();
|
for (Statement changedStmt : changedStmts) {
|
||||||
while( changed.hasNext()){
|
if (removedStmt.equals(changedStmt)) {
|
||||||
Statement changedStmt = changed.next();
|
|
||||||
if( removedStmt.equals(changedStmt) ){
|
|
||||||
removed.remove();
|
removed.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,17 +69,15 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
HashSet<String> nonExternalIdPropURISet = new HashSet<String>();
|
HashSet<String> nonExternalIdPropURISet = new HashSet<String>();
|
||||||
if (ind != null) {
|
if (ind != null) {
|
||||||
Collection<DataPropertyStatement> dpsColl = getWebappDaoFactory().getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(ind, dataPropertyURI);
|
Collection<DataPropertyStatement> dpsColl = getWebappDaoFactory().getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(ind, dataPropertyURI);
|
||||||
Iterator<DataPropertyStatement> dpsIt = dpsColl.iterator();
|
for (DataPropertyStatement dps : dpsColl) {
|
||||||
while (dpsIt.hasNext()) {
|
|
||||||
DataPropertyStatement dps = dpsIt.next();
|
|
||||||
if (externalIdPropURISet.contains(dps.getDatapropURI())) {
|
if (externalIdPropURISet.contains(dps.getDatapropURI())) {
|
||||||
externalIdStatements.add(dps);
|
externalIdStatements.add(dps);
|
||||||
} else if (!nonExternalIdPropURISet.contains(dps.getDatapropURI())) {
|
} else if (!nonExternalIdPropURISet.contains(dps.getDatapropURI())) {
|
||||||
OntModel tboxOntModel = getOntModelSelector().getTBoxModel();
|
OntModel tboxOntModel = getOntModelSelector().getTBoxModel();
|
||||||
tboxOntModel.enterCriticalSection(Lock.READ);
|
tboxOntModel.enterCriticalSection(Lock.READ);
|
||||||
try {
|
try {
|
||||||
Resource dataprop = tboxOntModel.getResource(dps.getDatapropURI());
|
Resource dataprop = tboxOntModel.getResource(dps.getDatapropURI());
|
||||||
if (dataprop != null && (tboxOntModel.contains(dataprop, DATAPROPERTY_ISEXTERNALID, ResourceFactory.createTypedLiteral(true)) || tboxOntModel.contains(dataprop, DATAPROPERTY_ISEXTERNALID, "TRUE") )) {
|
if (dataprop != null && (tboxOntModel.contains(dataprop, DATAPROPERTY_ISEXTERNALID, ResourceFactory.createTypedLiteral(true)) || tboxOntModel.contains(dataprop, DATAPROPERTY_ISEXTERNALID, "TRUE"))) {
|
||||||
externalIdPropURISet.add(dps.getDatapropURI());
|
externalIdPropURISet.add(dps.getDatapropURI());
|
||||||
externalIdStatements.add(dps);
|
externalIdStatements.add(dps);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -311,10 +311,7 @@ public class IndividualDaoSDB extends IndividualDaoJena {
|
||||||
private void fillIndividualsForObjectPropertyStatements(Individual entity){
|
private void fillIndividualsForObjectPropertyStatements(Individual entity){
|
||||||
getOntModel().enterCriticalSection(Lock.READ);
|
getOntModel().enterCriticalSection(Lock.READ);
|
||||||
try {
|
try {
|
||||||
Iterator e2eIt = entity.getObjectPropertyStatements().iterator();
|
for (ObjectPropertyStatement e2e : entity.getObjectPropertyStatements()) {
|
||||||
while (e2eIt.hasNext()) {
|
|
||||||
ObjectPropertyStatement e2e =
|
|
||||||
(ObjectPropertyStatement) e2eIt.next();
|
|
||||||
e2e.setSubject(makeIndividual(e2e.getSubjectURI()));
|
e2e.setSubject(makeIndividual(e2e.getSubjectURI()));
|
||||||
e2e.setObject(makeIndividual(e2e.getObjectURI()));
|
e2e.setObject(makeIndividual(e2e.getObjectURI()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,15 +517,13 @@ public class IndividualJena extends IndividualImpl implements Individual {
|
||||||
protected void sortEnts2EntsForDisplay(){
|
protected void sortEnts2EntsForDisplay(){
|
||||||
if( getObjectPropertyList() == null ) return;
|
if( getObjectPropertyList() == null ) return;
|
||||||
|
|
||||||
Iterator it = getObjectPropertyList().iterator();
|
for (ObjectProperty prop : getObjectPropertyList()) {
|
||||||
while(it.hasNext()){
|
/* if (prop.getObjectIndividualSortPropertyURI()==null) {
|
||||||
ObjectProperty prop = (ObjectProperty)it.next();
|
|
||||||
/* if (prop.getObjectIndividualSortPropertyURI()==null) {
|
|
||||||
prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements());
|
prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements());
|
||||||
} else {*/
|
} else {*/
|
||||||
prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements());
|
prop.sortObjectPropertyStatementsForDisplay(prop, prop.getObjectPropertyStatements());
|
||||||
/* }*/
|
/* }*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collator collator = Collator.getInstance();
|
private Collator collator = Collator.getInstance();
|
||||||
|
|
|
@ -953,15 +953,13 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
protected void sortEnts2EntsForDisplay(){
|
protected void sortEnts2EntsForDisplay(){
|
||||||
if( getObjectPropertyList() == null ) return;
|
if( getObjectPropertyList() == null ) return;
|
||||||
|
|
||||||
Iterator it = getObjectPropertyList().iterator();
|
for (ObjectProperty prop : getObjectPropertyList()) {
|
||||||
while(it.hasNext()){
|
/* if (prop.getObjectIndividualSortPropertyURI()==null) {
|
||||||
ObjectProperty prop = (ObjectProperty)it.next();
|
|
||||||
/* if (prop.getObjectIndividualSortPropertyURI()==null) {
|
|
||||||
prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements());
|
prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements());
|
||||||
} else {*/
|
} else {*/
|
||||||
prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements());
|
prop.sortObjectPropertyStatementsForDisplay(prop, prop.getObjectPropertyStatements());
|
||||||
/* }*/
|
/* }*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collator collator = Collator.getInstance();
|
private Collator collator = Collator.getInstance();
|
||||||
|
|
|
@ -771,20 +771,18 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Literal getLabel(String lang, List<RDFNode>labelList) {
|
private Literal getLabel(String lang, List<RDFNode>labelList) {
|
||||||
Iterator<RDFNode> labelIt = labelList.iterator();
|
for (RDFNode label : labelList) {
|
||||||
while (labelIt.hasNext()) {
|
if (label.isLiteral()) {
|
||||||
RDFNode label = labelIt.next();
|
Literal labelLit = ((Literal) label);
|
||||||
if (label.isLiteral()) {
|
String labelLanguage = labelLit.getLanguage();
|
||||||
Literal labelLit = ((Literal)label);
|
if ((labelLanguage == null) && (lang == null || lang.isEmpty())) {
|
||||||
String labelLanguage = labelLit.getLanguage();
|
return labelLit;
|
||||||
if ( (labelLanguage == null) && (lang == null || lang.isEmpty()) ) {
|
}
|
||||||
return labelLit;
|
if ((lang != null) && (lang.equals(labelLanguage))) {
|
||||||
}
|
return labelLit;
|
||||||
if ( (lang != null) && (lang.equals(labelLanguage)) ) {
|
}
|
||||||
return labelLit;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1019,22 +1017,20 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
||||||
}
|
}
|
||||||
// Now for each value, work backwards and see if it has an alternate path to the original resource.
|
// Now for each value, work backwards and see if it has an alternate path to the original resource.
|
||||||
// If not, add it to the list of direct values.
|
// If not, add it to the list of direct values.
|
||||||
Iterator<Resource> possibleValueIt = possibleValueSet.iterator();
|
for (Resource possibleRes : possibleValueSet) {
|
||||||
while (possibleValueIt.hasNext()) {
|
StmtIterator pStmtIt = getOntModel().listStatements((Resource) null, prop, possibleRes);
|
||||||
Resource possibleRes = possibleValueIt.next();
|
boolean hasAlternatePath = false;
|
||||||
StmtIterator pStmtIt = getOntModel().listStatements((Resource)null, prop, possibleRes);
|
while (stmtIt.hasNext()) {
|
||||||
boolean hasAlternatePath = false;
|
Statement stmt = stmtIt.nextStatement();
|
||||||
while (stmtIt.hasNext()) {
|
if (possibleValueSet.contains(stmt.getSubject())) {
|
||||||
Statement stmt = stmtIt.nextStatement();
|
hasAlternatePath = true;
|
||||||
if (possibleValueSet.contains(stmt.getSubject())) {
|
break;
|
||||||
hasAlternatePath = true;
|
}
|
||||||
break;
|
}
|
||||||
}
|
if (!hasAlternatePath) {
|
||||||
}
|
directValueList.add(possibleRes);
|
||||||
if (!hasAlternatePath) {
|
}
|
||||||
directValueList.add(possibleRes);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return directValueList;
|
return directValueList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,22 +1044,20 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
||||||
possibleSubjectSet.add(stmt.getSubject());
|
possibleSubjectSet.add(stmt.getSubject());
|
||||||
|
|
||||||
}
|
}
|
||||||
Iterator<Resource> possibleSubjectIt = possibleSubjectSet.iterator();
|
for (Resource possibleRes : possibleSubjectSet) {
|
||||||
while (possibleSubjectIt.hasNext()) {
|
StmtIterator pStmtIt = getOntModel().listStatements(possibleRes, prop, (RDFNode) null);
|
||||||
Resource possibleRes = possibleSubjectIt.next();
|
boolean hasAlternatePath = false;
|
||||||
StmtIterator pStmtIt = getOntModel().listStatements(possibleRes, prop, (RDFNode)null);
|
while (stmtIt.hasNext()) {
|
||||||
boolean hasAlternatePath = false;
|
Statement stmt = stmtIt.nextStatement();
|
||||||
while (stmtIt.hasNext()) {
|
if (stmt.getObject().isResource() && possibleSubjectSet.contains(stmt.getObject())) {
|
||||||
Statement stmt = stmtIt.nextStatement();
|
hasAlternatePath = true;
|
||||||
if (stmt.getObject().isResource() && possibleSubjectSet.contains(stmt.getObject())) {
|
break;
|
||||||
hasAlternatePath = true;
|
}
|
||||||
break;
|
}
|
||||||
}
|
if (!hasAlternatePath) {
|
||||||
}
|
directSubjectList.add(possibleRes);
|
||||||
if (!hasAlternatePath) {
|
}
|
||||||
directSubjectList.add(possibleRes);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return directSubjectList;
|
return directSubjectList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -497,9 +497,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ObjectProperty> props = new ArrayList<ObjectProperty>();
|
List<ObjectProperty> props = new ArrayList<ObjectProperty>();
|
||||||
Iterator<String> keyIt = hash.keySet().iterator();
|
for (String key : hash.keySet()) {
|
||||||
while (keyIt.hasNext()) {
|
|
||||||
Object key = keyIt.next();
|
|
||||||
props.add(hash.get(key));
|
props.add(hash.get(key));
|
||||||
}
|
}
|
||||||
return props;
|
return props;
|
||||||
|
|
|
@ -163,14 +163,12 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
|
|
||||||
private void getAllSubPropertyURIs(String propertyURI, HashSet<String> subtree){
|
private void getAllSubPropertyURIs(String propertyURI, HashSet<String> subtree){
|
||||||
List<String> directSubproperties = getSubPropertyURIs(propertyURI);
|
List<String> directSubproperties = getSubPropertyURIs(propertyURI);
|
||||||
Iterator<String> it=directSubproperties.iterator();
|
for (String uri : directSubproperties) {
|
||||||
while(it.hasNext()){
|
if (!subtree.contains(uri)) {
|
||||||
String uri = it.next();
|
subtree.add(uri);
|
||||||
if (!subtree.contains(uri)) {
|
getAllSubPropertyURIs(uri, subtree);
|
||||||
subtree.add(uri);
|
}
|
||||||
getAllSubPropertyURIs(uri,subtree);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -206,14 +204,12 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
|
|
||||||
private void getAllSuperPropertyURIs(String propertyURI, HashSet<String> subtree){
|
private void getAllSuperPropertyURIs(String propertyURI, HashSet<String> subtree){
|
||||||
List<String> directSuperproperties = getSuperPropertyURIs(propertyURI,true);
|
List<String> directSuperproperties = getSuperPropertyURIs(propertyURI,true);
|
||||||
Iterator<String> it=directSuperproperties.iterator();
|
for (String uri : directSuperproperties) {
|
||||||
while(it.hasNext()){
|
if (!subtree.contains(uri)) {
|
||||||
String uri = it.next();
|
subtree.add(uri);
|
||||||
if (!subtree.contains(uri)) {
|
getAllSuperPropertyURIs(uri, subtree);
|
||||||
subtree.add(uri);
|
}
|
||||||
getAllSuperPropertyURIs(uri,subtree);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -421,17 +417,13 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
List<OntClass> classList = ontClass.listEquivalentClasses().toList();
|
List<OntClass> classList = ontClass.listEquivalentClasses().toList();
|
||||||
classList.addAll(ontClass.listSubClasses().toList());
|
classList.addAll(ontClass.listSubClasses().toList());
|
||||||
|
|
||||||
Iterator<OntClass> it = classList.iterator();
|
for (OntClass oc : classList) {
|
||||||
|
if (!oc.isAnon()) {
|
||||||
while (it.hasNext()) {
|
classSet.add(oc.getURI());
|
||||||
OntClass oc = it.next();
|
} else {
|
||||||
|
classSet.addAll(getRestrictedClasses(oc));
|
||||||
if (!oc.isAnon()) {
|
}
|
||||||
classSet.add(oc.getURI());
|
}
|
||||||
} else {
|
|
||||||
classSet.addAll(getRestrictedClasses(oc));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return classSet;
|
return classSet;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,13 +148,9 @@ public class PropertyInstanceDaoJena extends PropertyDaoJena implements
|
||||||
List existingPropertyInstances = new ArrayList();
|
List existingPropertyInstances = new ArrayList();
|
||||||
if (ent.getObjectPropertyList()==null)
|
if (ent.getObjectPropertyList()==null)
|
||||||
return existingPropertyInstances;
|
return existingPropertyInstances;
|
||||||
Iterator objPropertyIter = ent.getObjectPropertyList().iterator();
|
for (edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty op : ent.getObjectPropertyList()) {
|
||||||
while (objPropertyIter.hasNext()) {
|
for (ObjectPropertyStatement objPropertyStmt : op.getObjectPropertyStatements()) {
|
||||||
edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty op = (edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty) objPropertyIter.next();
|
if (propertyURI == null || objPropertyStmt.getPropertyURI().equals(propertyURI)) {
|
||||||
Iterator objPropertyStmtIter = op.getObjectPropertyStatements().iterator();
|
|
||||||
while (objPropertyStmtIter.hasNext()) {
|
|
||||||
ObjectPropertyStatement objPropertyStmt = (ObjectPropertyStatement) objPropertyStmtIter.next();
|
|
||||||
if (propertyURI==null || objPropertyStmt.getPropertyURI().equals(propertyURI)) {
|
|
||||||
PropertyInstance pi = new PropertyInstance();
|
PropertyInstance pi = new PropertyInstance();
|
||||||
pi.setSubjectSide(true);
|
pi.setSubjectSide(true);
|
||||||
pi.setSubjectEntURI(ent.getURI());
|
pi.setSubjectEntURI(ent.getURI());
|
||||||
|
@ -166,7 +162,7 @@ public class PropertyInstanceDaoJena extends PropertyDaoJena implements
|
||||||
pi.setObjectEntURI(objPropertyStmt.getObjectURI());
|
pi.setObjectEntURI(objPropertyStmt.getObjectURI());
|
||||||
pi.setPropertyURI(objPropertyStmt.getPropertyURI());
|
pi.setPropertyURI(objPropertyStmt.getPropertyURI());
|
||||||
if (objPropertyStmt.getProperty() != null) {
|
if (objPropertyStmt.getProperty() != null) {
|
||||||
pi.setDomainPublic( (objPropertyStmt.getProperty().getDomainPublic()!=null) ? objPropertyStmt.getProperty().getDomainPublic() : objPropertyStmt.getProperty().getLocalName() );
|
pi.setDomainPublic((objPropertyStmt.getProperty().getDomainPublic() != null) ? objPropertyStmt.getProperty().getDomainPublic() : objPropertyStmt.getProperty().getLocalName());
|
||||||
} else {
|
} else {
|
||||||
pi.setDomainPublic(objPropertyStmt.getPropertyURI());
|
pi.setDomainPublic(objPropertyStmt.getPropertyURI());
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,12 +411,10 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
|
|
||||||
public void getAllSubClassURIs(String classURI, HashSet<String> subtree){
|
public void getAllSubClassURIs(String classURI, HashSet<String> subtree){
|
||||||
List<String> directSubclasses = getSubClassURIs(classURI);
|
List<String> directSubclasses = getSubClassURIs(classURI);
|
||||||
Iterator<String> it=directSubclasses.iterator();
|
for (String uri : directSubclasses) {
|
||||||
while(it.hasNext()){
|
|
||||||
String uri = it.next();
|
|
||||||
if (!subtree.contains(uri)) {
|
if (!subtree.contains(uri)) {
|
||||||
subtree.add(uri);
|
subtree.add(uri);
|
||||||
getAllSubClassURIs(uri,subtree);
|
getAllSubClassURIs(uri, subtree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,12 +448,10 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
|
|
||||||
public void getAllSuperClassURIs(String classURI, HashSet<String> subtree){
|
public void getAllSuperClassURIs(String classURI, HashSet<String> subtree){
|
||||||
List<String> directSuperclasses = getSuperClassURIs(classURI, true);
|
List<String> directSuperclasses = getSuperClassURIs(classURI, true);
|
||||||
Iterator<String> it=directSuperclasses.iterator();
|
for (String uri : directSuperclasses) {
|
||||||
while(it.hasNext()){
|
|
||||||
String uri = it.next();
|
|
||||||
if (!subtree.contains(uri)) {
|
if (!subtree.contains(uri)) {
|
||||||
subtree.add(uri);
|
subtree.add(uri);
|
||||||
getAllSuperClassURIs(uri,subtree);
|
getAllSuperClassURIs(uri, subtree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -787,13 +783,11 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
// if this model infers types based on the taxonomy, adding the subclasses will only
|
// if this model infers types based on the taxonomy, adding the subclasses will only
|
||||||
// waste time for no benefit
|
// waste time for no benefit
|
||||||
if (!isUnderlyingStoreReasoned()) {
|
if (!isUnderlyingStoreReasoned()) {
|
||||||
Iterator classURIs = getAllSubClassURIs(getClassURIStr(superclass)).iterator();
|
for (String classURI : getAllSubClassURIs(getClassURIStr(superclass))) {
|
||||||
while (classURIs.hasNext()) {
|
VClass vClass = getVClassByURI(classURI);
|
||||||
String classURI = (String) classURIs.next();
|
if (vClass != null)
|
||||||
VClass vClass = getVClassByURI(classURI);
|
vClasses.add(vClass);
|
||||||
if (vClass != null)
|
}
|
||||||
vClasses.add(vClass);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -919,9 +913,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
getOntModel().enterCriticalSection(Lock.READ);
|
getOntModel().enterCriticalSection(Lock.READ);
|
||||||
try {
|
try {
|
||||||
if (groups != null) {
|
if (groups != null) {
|
||||||
Iterator groupIt = groups.iterator();
|
for (VClassGroup g : groups) {
|
||||||
while (groupIt.hasNext()) {
|
|
||||||
VClassGroup g = (VClassGroup) groupIt.next();
|
|
||||||
addVClassesToGroup(g);
|
addVClassesToGroup(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,7 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
|
||||||
groupIt.close();
|
groupIt.close();
|
||||||
}
|
}
|
||||||
Collections.sort(groups);
|
Collections.sort(groups);
|
||||||
Iterator<VClassGroup> groupsIt = groups.iterator();
|
for (VClassGroup group : groups) {
|
||||||
while (groupsIt.hasNext()) {
|
|
||||||
VClassGroup group = groupsIt.next();
|
|
||||||
map.put(group.getPublicName(), group);
|
map.put(group.getPublicName(), group);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
|
|
|
@ -39,12 +39,10 @@ public class IndividualDataPropertyStatementProcessor implements ChangeListener
|
||||||
|
|
||||||
private void processDataprops (EditProcessObject epo) {
|
private void processDataprops (EditProcessObject epo) {
|
||||||
HashSet<String> deletedDataPropertyURIs = new HashSet<String>();
|
HashSet<String> deletedDataPropertyURIs = new HashSet<String>();
|
||||||
Map dpm = datapropParameterMap(epo.getRequestParameterMap());
|
Map<String, String[]> dpm = datapropParameterMap(epo.getRequestParameterMap());
|
||||||
DataPropertyStatementDao dataPropertyStatementDao = (DataPropertyStatementDao)epo.getAdditionalDaoMap().get("DataPropertyStatement");
|
DataPropertyStatementDao dataPropertyStatementDao = (DataPropertyStatementDao)epo.getAdditionalDaoMap().get("DataPropertyStatement");
|
||||||
Iterator dpmIt = dpm.keySet().iterator();
|
for (String key : dpm.keySet()) {
|
||||||
while (dpmIt.hasNext()) {
|
String[] data = (String[]) dpm.get(key);
|
||||||
String key = (String) dpmIt.next();
|
|
||||||
String[] data = (String[])dpm.get(key);
|
|
||||||
for (String aData : data) {
|
for (String aData : data) {
|
||||||
String[] keyArg = key.split("_");
|
String[] keyArg = key.split("_");
|
||||||
String rowId = keyArg[2];
|
String rowId = keyArg[2];
|
||||||
|
@ -105,13 +103,11 @@ public class IndividualDataPropertyStatementProcessor implements ChangeListener
|
||||||
}
|
}
|
||||||
|
|
||||||
// might want to roll this into the other thing
|
// might want to roll this into the other thing
|
||||||
private HashMap datapropParameterMap(Map requestParameterMap) {
|
private Map<String, String[]> datapropParameterMap(Map<String, String[]> requestParameterMap) {
|
||||||
HashMap dpm = new HashMap();
|
Map<String, String[]> dpm = new HashMap<String, String[]>();
|
||||||
Iterator paramIt = requestParameterMap.keySet().iterator();
|
for (String key : requestParameterMap.keySet()) {
|
||||||
while (paramIt.hasNext()) {
|
|
||||||
String key = (String) paramIt.next();
|
|
||||||
if (key.startsWith("_DataPropertyStatement")) {
|
if (key.startsWith("_DataPropertyStatement")) {
|
||||||
dpm.put(key,requestParameterMap.get(key));
|
dpm.put(key, requestParameterMap.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dpm;
|
return dpm;
|
||||||
|
|
|
@ -463,16 +463,14 @@ public class ProcessRdfForm {
|
||||||
Map<String, List<String>> newUris = new HashMap<String, List<String>>();
|
Map<String, List<String>> newUris = new HashMap<String, List<String>>();
|
||||||
//Check if any values from the submission have the "force new uri" value
|
//Check if any values from the submission have the "force new uri" value
|
||||||
//TODO: Check how to handle multiple new resource values
|
//TODO: Check how to handle multiple new resource values
|
||||||
Iterator<String> keyIterator = urisFromForm.keySet().iterator();
|
for (String key : urisFromForm.keySet()) {
|
||||||
while(keyIterator.hasNext()) {
|
if (urisFromForm.get(key).contains(EditConfigurationConstants.NEW_URI_SENTINEL)) {
|
||||||
String key = keyIterator.next();
|
String newUri = urisForNewResources.get(key);
|
||||||
if(urisFromForm.get(key).contains(EditConfigurationConstants.NEW_URI_SENTINEL)) {
|
List<String> newUrisForKey = new ArrayList<String>();
|
||||||
String newUri = urisForNewResources.get(key);
|
newUrisForKey.add(newUri);
|
||||||
List<String> newUrisForKey = new ArrayList<String>();
|
newUris.put(key, newUrisForKey);
|
||||||
newUrisForKey.add(newUri);
|
}
|
||||||
newUris.put(key, newUrisForKey);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
if(newUris.size() > 0) {
|
if(newUris.size() > 0) {
|
||||||
substituteInMultiURIs(newUris, requiredAsserts, optionalAsserts, uRLToReturnTo);
|
substituteInMultiURIs(newUris, requiredAsserts, optionalAsserts, uRLToReturnTo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,28 +91,24 @@ public class ABoxUpdater {
|
||||||
*/
|
*/
|
||||||
public void processClassChanges(List<AtomicOntologyChange> changes) throws IOException {
|
public void processClassChanges(List<AtomicOntologyChange> changes) throws IOException {
|
||||||
|
|
||||||
Iterator<AtomicOntologyChange> iter = changes.iterator();
|
for (AtomicOntologyChange change : changes) {
|
||||||
|
switch (change.getAtomicChangeType()) {
|
||||||
while (iter.hasNext()) {
|
case ADD:
|
||||||
AtomicOntologyChange change = iter.next();
|
addClass(change);
|
||||||
|
break;
|
||||||
switch (change.getAtomicChangeType()){
|
case DELETE:
|
||||||
case ADD:
|
if ("Delete".equals(change.getNotes())) {
|
||||||
addClass(change);
|
deleteIndividualsOfType(change);
|
||||||
break;
|
} else {
|
||||||
case DELETE:
|
renameClassToParent(change);
|
||||||
if ("Delete".equals(change.getNotes())) {
|
}
|
||||||
deleteIndividualsOfType(change);
|
break;
|
||||||
} else {
|
case RENAME:
|
||||||
renameClassToParent(change);
|
renameClass(change);
|
||||||
}
|
break;
|
||||||
break;
|
default:
|
||||||
case RENAME:
|
logger.logError("unexpected change type indicator: " + change.getAtomicChangeType());
|
||||||
renameClass(change);
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
logger.logError("unexpected change type indicator: " + change.getAtomicChangeType());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,33 +232,29 @@ public class ABoxUpdater {
|
||||||
namedClassList.add(OWL_THING);
|
namedClassList.add(OWL_THING);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<OntClass> classIter = namedClassList.iterator();
|
for (OntClass parentOfAddedClass : namedClassList) {
|
||||||
|
|
||||||
while (classIter.hasNext()) {
|
|
||||||
OntClass parentOfAddedClass = classIter.next();
|
|
||||||
|
|
||||||
if (!parentOfAddedClass.equals(OWL.Thing)) {
|
if (!parentOfAddedClass.equals(OWL.Thing)) {
|
||||||
|
|
||||||
Iterator<String> graphIt = dataset.listNames();
|
Iterator<String> graphIt = dataset.listNames();
|
||||||
while(graphIt.hasNext()) {
|
while (graphIt.hasNext()) {
|
||||||
String graph = graphIt.next();
|
String graph = graphIt.next();
|
||||||
if(!KnowledgeBaseUpdater.isUpdatableABoxGraph(graph)){
|
if (!KnowledgeBaseUpdater.isUpdatableABoxGraph(graph)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Model aboxModel = dataset.getNamedModel(graph);
|
Model aboxModel = dataset.getNamedModel(graph);
|
||||||
|
|
||||||
StmtIterator stmtIter = aboxModel.listStatements(null, RDF.type, parentOfAddedClass);
|
StmtIterator stmtIter = aboxModel.listStatements(null, RDF.type, parentOfAddedClass);
|
||||||
|
|
||||||
int count = stmtIter.toList().size();
|
int count = stmtIter.toList().size();
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
//TODO - take out the detailed logging after our internal testing is completed.
|
//TODO - take out the detailed logging after our internal testing is completed.
|
||||||
logger.log("There " + ((count > 1) ? "are" : "is") + " " + count + " individual" + ((count > 1) ? "s" : "") + " in the model that " + ((count > 1) ? "are" : "is") + " of type " + parentOfAddedClass.getURI() + "," +
|
logger.log("There " + ((count > 1) ? "are" : "is") + " " + count + " individual" + ((count > 1) ? "s" : "") + " in the model that " + ((count > 1) ? "are" : "is") + " of type " + parentOfAddedClass.getURI() + "," +
|
||||||
" and a new subclass of that class has been added: " + addedClass.getURI() + ". " +
|
" and a new subclass of that class has been added: " + addedClass.getURI() + ". " +
|
||||||
"Please review " + ((count > 1) ? "these" : "this") + " individual" + ((count > 1) ? "s" : "") + " to see whether " + ((count > 1) ? "they" : "it") + " should be of type: " + addedClass.getURI() );
|
"Please review " + ((count > 1) ? "these" : "this") + " individual" + ((count > 1) ? "s" : "") + " to see whether " + ((count > 1) ? "they" : "it") + " should be of type: " + addedClass.getURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -415,35 +407,33 @@ public class ABoxUpdater {
|
||||||
|
|
||||||
public void processPropertyChanges(List<AtomicOntologyChange> changes) throws IOException {
|
public void processPropertyChanges(List<AtomicOntologyChange> changes) throws IOException {
|
||||||
|
|
||||||
Iterator<AtomicOntologyChange> propItr = changes.iterator();
|
for (AtomicOntologyChange propChangeObj : changes) {
|
||||||
while(propItr.hasNext()){
|
|
||||||
AtomicOntologyChange propChangeObj = propItr.next();
|
|
||||||
log.debug("processing " + propChangeObj);
|
log.debug("processing " + propChangeObj);
|
||||||
try {
|
try {
|
||||||
if (propChangeObj.getAtomicChangeType() == null) {
|
if (propChangeObj.getAtomicChangeType() == null) {
|
||||||
log.error("Missing change type; skipping " + propChangeObj);
|
log.error("Missing change type; skipping " + propChangeObj);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (propChangeObj.getAtomicChangeType()){
|
switch (propChangeObj.getAtomicChangeType()) {
|
||||||
case ADD:
|
case ADD:
|
||||||
log.debug("add");
|
log.debug("add");
|
||||||
addProperty(propChangeObj);
|
addProperty(propChangeObj);
|
||||||
break;
|
break;
|
||||||
case DELETE:
|
case DELETE:
|
||||||
log.debug("delete");
|
log.debug("delete");
|
||||||
deleteProperty(propChangeObj);
|
deleteProperty(propChangeObj);
|
||||||
break;
|
break;
|
||||||
case RENAME:
|
case RENAME:
|
||||||
log.debug("rename");
|
log.debug("rename");
|
||||||
renameProperty(propChangeObj);
|
renameProperty(propChangeObj);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log.debug("unknown");
|
log.debug("unknown");
|
||||||
logger.logError("unexpected change type indicator: " + propChangeObj.getAtomicChangeType());
|
logger.logError("unexpected change type indicator: " + propChangeObj.getAtomicChangeType());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e,e);
|
log.error(e, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,40 +419,37 @@ public class KnowledgeBaseUpdater {
|
||||||
List<AtomicOntologyChange> changeList, OntModel newTboxModel,
|
List<AtomicOntologyChange> changeList, OntModel newTboxModel,
|
||||||
OntModel oldTboxModel) throws IOException {
|
OntModel oldTboxModel) throws IOException {
|
||||||
|
|
||||||
Iterator<AtomicOntologyChange> listItr = changeList.iterator();
|
for (AtomicOntologyChange changeObj : changeList) {
|
||||||
|
if (changeObj.getSourceURI() != null) {
|
||||||
while(listItr.hasNext()) {
|
log.debug("triaging " + changeObj);
|
||||||
AtomicOntologyChange changeObj = listItr.next();
|
if (oldTboxModel.getOntProperty(changeObj.getSourceURI()) != null) {
|
||||||
if (changeObj.getSourceURI() != null){
|
atomicPropertyChanges.add(changeObj);
|
||||||
log.debug("triaging " + changeObj);
|
log.debug("added to property changes");
|
||||||
if (oldTboxModel.getOntProperty(changeObj.getSourceURI()) != null){
|
|
||||||
atomicPropertyChanges.add(changeObj);
|
|
||||||
log.debug("added to property changes");
|
|
||||||
} else if (oldTboxModel.getOntClass(changeObj.getSourceURI()) != null) {
|
} else if (oldTboxModel.getOntClass(changeObj.getSourceURI()) != null) {
|
||||||
atomicClassChanges.add(changeObj);
|
atomicClassChanges.add(changeObj);
|
||||||
log.debug("added to class changes");
|
log.debug("added to class changes");
|
||||||
} else if ("Prop".equals(changeObj.getNotes())) {
|
} else if ("Prop".equals(changeObj.getNotes())) {
|
||||||
atomicPropertyChanges.add(changeObj);
|
atomicPropertyChanges.add(changeObj);
|
||||||
} else if ("Class".equals(changeObj.getNotes())) {
|
} else if ("Class".equals(changeObj.getNotes())) {
|
||||||
atomicClassChanges.add(changeObj);
|
atomicClassChanges.add(changeObj);
|
||||||
} else{
|
} else {
|
||||||
logger.log("WARNING: Source URI is neither a Property" +
|
logger.log("WARNING: Source URI is neither a Property" +
|
||||||
" nor a Class. " + "Change Object skipped for sourceURI: " + changeObj.getSourceURI());
|
" nor a Class. " + "Change Object skipped for sourceURI: " + changeObj.getSourceURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(changeObj.getDestinationURI() != null){
|
} else if (changeObj.getDestinationURI() != null) {
|
||||||
|
|
||||||
if (newTboxModel.getOntProperty(changeObj.getDestinationURI()) != null) {
|
if (newTboxModel.getOntProperty(changeObj.getDestinationURI()) != null) {
|
||||||
atomicPropertyChanges.add(changeObj);
|
atomicPropertyChanges.add(changeObj);
|
||||||
} else if(newTboxModel.getOntClass(changeObj.
|
} else if (newTboxModel.getOntClass(changeObj.
|
||||||
getDestinationURI()) != null) {
|
getDestinationURI()) != null) {
|
||||||
atomicClassChanges.add(changeObj);
|
atomicClassChanges.add(changeObj);
|
||||||
} else{
|
} else {
|
||||||
logger.log("WARNING: Destination URI is neither a Property" +
|
logger.log("WARNING: Destination URI is neither a Property" +
|
||||||
" nor a Class. " + "Change Object skipped for destinationURI: " + changeObj.getDestinationURI());
|
" nor a Class. " + "Change Object skipped for destinationURI: " + changeObj.getDestinationURI());
|
||||||
}
|
}
|
||||||
} else{
|
} else {
|
||||||
logger.log("WARNING: Source and Destination URI can't be null. " + "Change Object skipped" );
|
logger.log("WARNING: Source and Destination URI can't be null. " + "Change Object skipped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//logger.log("Property and Class change Object lists have been created");
|
//logger.log("Property and Class change Object lists have been created");
|
||||||
|
|
|
@ -171,10 +171,8 @@ public class LanguageFilteringRDFService implements RDFService {
|
||||||
s.sparqlSelectQuery(query, RDFService.ResultFormat.JSON));
|
s.sparqlSelectQuery(query, RDFService.ResultFormat.JSON));
|
||||||
List<QuerySolution> solnList = getSolutionList(resultSet);
|
List<QuerySolution> solnList = getSolutionList(resultSet);
|
||||||
List<String> vars = resultSet.getResultVars();
|
List<String> vars = resultSet.getResultVars();
|
||||||
Iterator<String> varIt = vars.iterator();
|
for (String var : vars) {
|
||||||
while (varIt.hasNext()) {
|
for (int i = 0; i < solnList.size(); i++) {
|
||||||
String var = varIt.next();
|
|
||||||
for (int i = 0 ; i < solnList.size(); i ++ ) {
|
|
||||||
QuerySolution s = solnList.get(i);
|
QuerySolution s = solnList.get(i);
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -186,7 +184,7 @@ public class LanguageFilteringRDFService implements RDFService {
|
||||||
List<RowIndexedLiteral> candidatesForRemoval =
|
List<RowIndexedLiteral> candidatesForRemoval =
|
||||||
new ArrayList<RowIndexedLiteral>();
|
new ArrayList<RowIndexedLiteral>();
|
||||||
candidatesForRemoval.add(new RowIndexedLiteral(node.asLiteral(), i));
|
candidatesForRemoval.add(new RowIndexedLiteral(node.asLiteral(), i));
|
||||||
for (int j = i + 1; j < solnList.size(); j ++) {
|
for (int j = i + 1; j < solnList.size(); j++) {
|
||||||
QuerySolution t = solnList.get(j);
|
QuerySolution t = solnList.get(j);
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -204,7 +202,7 @@ public class LanguageFilteringRDFService implements RDFService {
|
||||||
Iterator<RowIndexedLiteral> candIt = candidatesForRemoval.iterator();
|
Iterator<RowIndexedLiteral> candIt = candidatesForRemoval.iterator();
|
||||||
String langRegister = null;
|
String langRegister = null;
|
||||||
boolean chuckRemaining = false;
|
boolean chuckRemaining = false;
|
||||||
while(candIt.hasNext()) {
|
while (candIt.hasNext()) {
|
||||||
RowIndexedLiteral rlit = candIt.next();
|
RowIndexedLiteral rlit = candIt.next();
|
||||||
if (chuckRemaining) {
|
if (chuckRemaining) {
|
||||||
solnList.set(rlit.getIndex(), null);
|
solnList.set(rlit.getIndex(), null);
|
||||||
|
@ -218,9 +216,7 @@ public class LanguageFilteringRDFService implements RDFService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<QuerySolution> compactedList = new ArrayList<QuerySolution>();
|
List<QuerySolution> compactedList = new ArrayList<QuerySolution>();
|
||||||
Iterator<QuerySolution> solIt = solnList.iterator();
|
for (QuerySolution soln : solnList) {
|
||||||
while(solIt.hasNext()) {
|
|
||||||
QuerySolution soln = solIt.next();
|
|
||||||
if (soln != null) {
|
if (soln != null) {
|
||||||
compactedList.add(soln);
|
compactedList.add(soln);
|
||||||
}
|
}
|
||||||
|
@ -268,10 +264,8 @@ public class LanguageFilteringRDFService implements RDFService {
|
||||||
protected void endProcessing() {
|
protected void endProcessing() {
|
||||||
chainStartProcessing();
|
chainStartProcessing();
|
||||||
|
|
||||||
Iterator<String> varIt = vars.iterator();
|
for (String var : vars) {
|
||||||
while (varIt.hasNext()) {
|
for (int i = 0; i < solnList.size(); i++) {
|
||||||
String var = varIt.next();
|
|
||||||
for (int i = 0 ; i < solnList.size(); i ++ ) {
|
|
||||||
QuerySolution s = solnList.get(i);
|
QuerySolution s = solnList.get(i);
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -283,7 +277,7 @@ public class LanguageFilteringRDFService implements RDFService {
|
||||||
List<RowIndexedLiteral> candidatesForRemoval =
|
List<RowIndexedLiteral> candidatesForRemoval =
|
||||||
new ArrayList<RowIndexedLiteral>();
|
new ArrayList<RowIndexedLiteral>();
|
||||||
candidatesForRemoval.add(new RowIndexedLiteral(node.asLiteral(), i));
|
candidatesForRemoval.add(new RowIndexedLiteral(node.asLiteral(), i));
|
||||||
for (int j = i + 1; j < solnList.size(); j ++) {
|
for (int j = i + 1; j < solnList.size(); j++) {
|
||||||
QuerySolution t = solnList.get(j);
|
QuerySolution t = solnList.get(j);
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -301,7 +295,7 @@ public class LanguageFilteringRDFService implements RDFService {
|
||||||
Iterator<RowIndexedLiteral> candIt = candidatesForRemoval.iterator();
|
Iterator<RowIndexedLiteral> candIt = candidatesForRemoval.iterator();
|
||||||
String langRegister = null;
|
String langRegister = null;
|
||||||
boolean chuckRemaining = false;
|
boolean chuckRemaining = false;
|
||||||
while(candIt.hasNext()) {
|
while (candIt.hasNext()) {
|
||||||
RowIndexedLiteral rlit = candIt.next();
|
RowIndexedLiteral rlit = candIt.next();
|
||||||
if (chuckRemaining) {
|
if (chuckRemaining) {
|
||||||
solnList.set(rlit.getIndex(), null);
|
solnList.set(rlit.getIndex(), null);
|
||||||
|
@ -315,9 +309,7 @@ public class LanguageFilteringRDFService implements RDFService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<QuerySolution> solIt = solnList.iterator();
|
for (QuerySolution soln : solnList) {
|
||||||
while(solIt.hasNext()) {
|
|
||||||
QuerySolution soln = solIt.next();
|
|
||||||
if (soln != null) {
|
if (soln != null) {
|
||||||
chainProcessQuerySolution(soln);
|
chainProcessQuerySolution(soln);
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,9 +142,7 @@ public abstract class RDFServiceImpl implements RDFService {
|
||||||
|
|
||||||
protected void notifyListeners(ModelChange modelChange) throws IOException {
|
protected void notifyListeners(ModelChange modelChange) throws IOException {
|
||||||
modelChange.getSerializedModel().reset();
|
modelChange.getSerializedModel().reset();
|
||||||
Iterator<ChangeListener> iter = registeredListeners.iterator();
|
for (ChangeListener listener : registeredListeners) {
|
||||||
while (iter.hasNext()) {
|
|
||||||
ChangeListener listener = iter.next();
|
|
||||||
listener.notifyModelChange(modelChange);
|
listener.notifyModelChange(modelChange);
|
||||||
}
|
}
|
||||||
log.debug(registeredJenaListeners.size() + " registered Jena listeners");
|
log.debug(registeredJenaListeners.size() + " registered Jena listeners");
|
||||||
|
@ -174,15 +172,11 @@ public abstract class RDFServiceImpl implements RDFService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyListenersOfEvent(Object event) {
|
public void notifyListenersOfEvent(Object event) {
|
||||||
Iterator<ChangeListener> iter = registeredListeners.iterator();
|
for (ChangeListener listener : registeredListeners) {
|
||||||
while (iter.hasNext()) {
|
|
||||||
ChangeListener listener = iter.next();
|
|
||||||
// TODO what is the graphURI parameter for?
|
// TODO what is the graphURI parameter for?
|
||||||
listener.notifyEvent(null, event);
|
listener.notifyEvent(null, event);
|
||||||
}
|
}
|
||||||
Iterator<ModelChangedListener> jenaIter = registeredJenaListeners.iterator();
|
for (ModelChangedListener listener : registeredJenaListeners) {
|
||||||
while (jenaIter.hasNext()) {
|
|
||||||
ModelChangedListener listener = jenaIter.next();
|
|
||||||
listener.notifyEvent(null, event);
|
listener.notifyEvent(null, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,7 @@ public class RDFServiceModel extends RDFServiceJena implements RDFService {
|
||||||
this.notifyListenersOfEvent(o);
|
this.notifyListenersOfEvent(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<ModelChange> csIt = changeSet.getModelChanges().iterator();
|
for (ModelChange modelChange : changeSet.getModelChanges()) {
|
||||||
while (csIt.hasNext()) {
|
|
||||||
ModelChange modelChange = csIt.next();
|
|
||||||
if (!modelChange.getSerializedModel().markSupported()) {
|
if (!modelChange.getSerializedModel().markSupported()) {
|
||||||
byte[] bytes = IOUtils.toByteArray(modelChange.getSerializedModel());
|
byte[] bytes = IOUtils.toByteArray(modelChange.getSerializedModel());
|
||||||
modelChange.setSerializedModel(new ByteArrayInputStream(bytes));
|
modelChange.setSerializedModel(new ByteArrayInputStream(bytes));
|
||||||
|
|
|
@ -178,9 +178,7 @@ public class RDFServiceSparql extends RDFServiceImpl implements RDFService {
|
||||||
this.notifyListenersOfEvent(o);
|
this.notifyListenersOfEvent(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<ModelChange> csIt = changeSet.getModelChanges().iterator();
|
for (ModelChange modelChange : changeSet.getModelChanges()) {
|
||||||
while (csIt.hasNext()) {
|
|
||||||
ModelChange modelChange = csIt.next();
|
|
||||||
if (!modelChange.getSerializedModel().markSupported()) {
|
if (!modelChange.getSerializedModel().markSupported()) {
|
||||||
byte[] bytes = IOUtils.toByteArray(modelChange.getSerializedModel());
|
byte[] bytes = IOUtils.toByteArray(modelChange.getSerializedModel());
|
||||||
modelChange.setSerializedModel(new ByteArrayInputStream(bytes));
|
modelChange.setSerializedModel(new ByteArrayInputStream(bytes));
|
||||||
|
|
|
@ -73,13 +73,11 @@ public class IndividualURIQueue<E> implements Queue<E> {
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean retainAll(Collection<?> c) {
|
public synchronized boolean retainAll(Collection<?> c) {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
Iterator<E> it = m.keySet().iterator();
|
for (E e : m.keySet()) {
|
||||||
while(it.hasNext()) {
|
if (!c.contains(e)) {
|
||||||
E e = it.next();
|
m.remove(e);
|
||||||
if(!c.contains(e)) {
|
q.remove(e);
|
||||||
m.remove(e);
|
changed = true;
|
||||||
q.remove(e);
|
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
|
|
|
@ -563,18 +563,16 @@ public class SimpleReasoner extends StatementListener
|
||||||
|
|
||||||
aboxModel.enterCriticalSection(Lock.READ);
|
aboxModel.enterCriticalSection(Lock.READ);
|
||||||
try {
|
try {
|
||||||
Iterator<Resource> sameIter = sameIndividuals.iterator();
|
for (Resource res : sameIndividuals) {
|
||||||
while (sameIter.hasNext()) {
|
StmtIterator typeIt = aboxModel.listStatements(res, RDF.type, (RDFNode) null);
|
||||||
Resource res = sameIter.next();
|
while (typeIt.hasNext()) {
|
||||||
StmtIterator typeIt = aboxModel.listStatements(res, RDF.type, (RDFNode) null);
|
Statement stmt = typeIt.nextStatement();
|
||||||
while (typeIt.hasNext()) {
|
if (stmt.getObject().isURIResource()) {
|
||||||
Statement stmt = typeIt.nextStatement();
|
String typeURI = stmt.getObject().asResource().getURI();
|
||||||
if (stmt.getObject().isURIResource()) {
|
typeURIs.add(typeURI);
|
||||||
String typeURI = stmt.getObject().asResource().getURI();
|
}
|
||||||
typeURIs.add(typeURI);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
aboxModel.leaveCriticalSection();
|
aboxModel.leaveCriticalSection();
|
||||||
}
|
}
|
||||||
|
@ -802,20 +800,17 @@ public class SimpleReasoner extends StatementListener
|
||||||
if (handleSameAs) {
|
if (handleSameAs) {
|
||||||
List<Resource> sameIndividuals =
|
List<Resource> sameIndividuals =
|
||||||
getSameIndividuals(infStmt.getSubject().asResource(), inferenceModel);
|
getSameIndividuals(infStmt.getSubject().asResource(), inferenceModel);
|
||||||
Iterator<Resource> sameIter = sameIndividuals.iterator();
|
for (Resource subject : sameIndividuals) {
|
||||||
while (sameIter.hasNext()) {
|
|
||||||
Resource subject = sameIter.next();
|
|
||||||
|
|
||||||
Statement sameStmt =
|
Statement sameStmt =
|
||||||
ResourceFactory.createStatement(subject,infStmt.getPredicate(),
|
ResourceFactory.createStatement(subject, infStmt.getPredicate(),
|
||||||
infStmt.getObject());
|
infStmt.getObject());
|
||||||
if (subject.equals(infStmt.getObject())
|
if (subject.equals(infStmt.getObject())
|
||||||
&& OWL.sameAs.equals(infStmt.getPredicate())) {
|
&& OWL.sameAs.equals(infStmt.getPredicate())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inferenceModel.contains(sameStmt)
|
if (!inferenceModel.contains(sameStmt)
|
||||||
&& !aboxModel.contains(sameStmt)) {
|
&& !aboxModel.contains(sameStmt)) {
|
||||||
inferenceModel.add(sameStmt);
|
inferenceModel.add(sameStmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -860,17 +855,16 @@ public class SimpleReasoner extends StatementListener
|
||||||
List<Resource> sameIndividuals =
|
List<Resource> sameIndividuals =
|
||||||
getSameIndividuals(infStmt.getSubject().asResource(), inferenceModel);
|
getSameIndividuals(infStmt.getSubject().asResource(), inferenceModel);
|
||||||
|
|
||||||
Iterator<Resource> sameIter = sameIndividuals.iterator();
|
for (Resource sameIndividual : sameIndividuals) {
|
||||||
while (sameIter.hasNext()) {
|
Statement infStmtSame =
|
||||||
Statement infStmtSame =
|
ResourceFactory.createStatement(sameIndividual,
|
||||||
ResourceFactory.createStatement(sameIter.next(),
|
infStmt.getPredicate(), infStmt.getObject());
|
||||||
infStmt.getPredicate(), infStmt.getObject());
|
if ((!checkEntailment
|
||||||
if ((!checkEntailment
|
|| !entailedStatement(infStmtSame))
|
||||||
|| !entailedStatement(infStmtSame))
|
&& inferenceModel.contains(infStmtSame)) {
|
||||||
&& inferenceModel.contains(infStmtSame)) {
|
inferenceModel.remove(infStmtSame);
|
||||||
inferenceModel.remove(infStmtSame);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
inferenceModel.leaveCriticalSection();
|
inferenceModel.leaveCriticalSection();
|
||||||
}
|
}
|
||||||
|
@ -936,49 +930,39 @@ public class SimpleReasoner extends StatementListener
|
||||||
List<OntClass> types2 = new ArrayList<OntClass>();
|
List<OntClass> types2 = new ArrayList<OntClass>();
|
||||||
types2.addAll(types);
|
types2.addAll(types);
|
||||||
|
|
||||||
Iterator<OntClass> typeIter = types.iterator();
|
for (OntClass type : types) {
|
||||||
|
boolean add = true;
|
||||||
|
for (OntClass type2 : types2) {
|
||||||
|
if (type.equals(type2)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
while (typeIter.hasNext()) {
|
if (type.hasSubClass(type2, false) && !type2.hasSubClass(type, false)) {
|
||||||
OntClass type = typeIter.next();
|
add = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
boolean add = true;
|
if (add) {
|
||||||
Iterator<OntClass> typeIter2 = types2.iterator();
|
typeURIs.add(type.getURI());
|
||||||
while (typeIter2.hasNext()) {
|
|
||||||
OntClass type2 = typeIter2.next();
|
|
||||||
|
|
||||||
if (type.equals(type2)) {
|
ArrayList<Resource> equivalentClasses = new ArrayList<Resource>();
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type.hasSubClass(type2, false) && !type2.hasSubClass(type, false)) {
|
Iterator<Statement> iter = tboxModel.listStatements((Resource) null, OWL.equivalentClass, type);
|
||||||
add = false;
|
while (iter.hasNext()) {
|
||||||
break;
|
Statement stmt = iter.next();
|
||||||
}
|
Resource res = stmt.getSubject();
|
||||||
}
|
if ((res == null) || res.isAnon() || equivalentClasses.contains(res)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
equivalentClasses.add(res);
|
||||||
|
}
|
||||||
|
|
||||||
if (add) {
|
for (Resource equivClass : equivalentClasses) {
|
||||||
typeURIs.add(type.getURI());
|
if (equivClass.isAnon()) continue;
|
||||||
|
typeURIs.add(equivClass.getURI());
|
||||||
ArrayList<Resource> equivalentClasses = new ArrayList<Resource>();
|
}
|
||||||
|
}
|
||||||
Iterator<Statement> iter = tboxModel.listStatements((Resource) null, OWL.equivalentClass, type);
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Statement stmt = iter.next();
|
|
||||||
Resource res = stmt.getSubject();
|
|
||||||
if ((res == null) || res.isAnon() || equivalentClasses.contains(res) ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
equivalentClasses.add(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator<Resource> eIter = equivalentClasses.iterator();
|
|
||||||
|
|
||||||
while (eIter.hasNext()) {
|
|
||||||
Resource equivClass = eIter.next();
|
|
||||||
if (equivClass.isAnon()) continue;
|
|
||||||
typeURIs.add(equivClass.getURI());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
inferenceModel.leaveCriticalSection();
|
inferenceModel.leaveCriticalSection();
|
||||||
|
@ -1019,11 +1003,9 @@ public class SimpleReasoner extends StatementListener
|
||||||
removeInference(rIter.next(), inferenceModel, true, false);
|
removeInference(rIter.next(), inferenceModel, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<String> typeIter = typeURIs.iterator();
|
for (String typeURI : typeURIs) {
|
||||||
while (typeIter.hasNext()) {
|
Statement mstStmt = ResourceFactory.createStatement(individual, mostSpecificType, ResourceFactory.createResource(typeURI));
|
||||||
String typeURI = typeIter.next();
|
addInference(mstStmt, inferenceModel, true);
|
||||||
Statement mstStmt = ResourceFactory.createStatement(individual,mostSpecificType,ResourceFactory.createResource(typeURI));
|
|
||||||
addInference(mstStmt,inferenceModel,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,23 +174,21 @@ public abstract class SimpleBridgingRule implements ReasonerPlugin {
|
||||||
} else if (stmt.getPredicate().equals(assertedProp2)) {
|
} else if (stmt.getPredicate().equals(assertedProp2)) {
|
||||||
z = stmt.getObject();
|
z = stmt.getObject();
|
||||||
}
|
}
|
||||||
Iterator<Statement> sit = aboxInferencesModel.listStatements(x, this.inferredProp, z).toList().iterator();
|
|
||||||
|
|
||||||
while(sit.hasNext()) {
|
for (Statement s : aboxInferencesModel.listStatements(x, this.inferredProp, z).toList()) {
|
||||||
Statement s = sit.next();
|
Query ask = createQuery(this.retractionTestString, stmt, s);
|
||||||
Query ask = createQuery(this.retractionTestString, stmt, s);
|
QueryExecution qe = QueryExecutionFactory.create(ask, aboxAssertionsModel);
|
||||||
QueryExecution qe = QueryExecutionFactory.create(ask, aboxAssertionsModel);
|
try {
|
||||||
try {
|
if (!qe.execAsk()) {
|
||||||
if (!qe.execAsk()) {
|
if (log.isDebugEnabled()) {
|
||||||
if (log.isDebugEnabled()) {
|
log.debug("==> removing " + s);
|
||||||
log.debug("==> removing " + s);
|
}
|
||||||
}
|
if (simpleReasoner != null) simpleReasoner.removeInference(s, aboxInferencesModel);
|
||||||
if (simpleReasoner != null) simpleReasoner.removeInference(s,aboxInferencesModel);
|
}
|
||||||
}
|
} finally {
|
||||||
} finally {
|
qe.close();
|
||||||
qe.close();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRelevantPredicate(Statement stmt) {
|
private boolean isRelevantPredicate(Statement stmt) {
|
||||||
|
|
|
@ -197,18 +197,16 @@ public class PagedSearchController extends FreemarkerHttpServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Individual> individuals = new ArrayList<Individual>(docs.size());
|
List<Individual> individuals = new ArrayList<Individual>(docs.size());
|
||||||
Iterator<SearchResultDocument> docIter = docs.iterator();
|
for (SearchResultDocument doc : docs) {
|
||||||
while( docIter.hasNext() ){
|
|
||||||
try {
|
try {
|
||||||
SearchResultDocument doc = docIter.next();
|
|
||||||
String uri = doc.getStringValue(VitroSearchTermNames.URI);
|
String uri = doc.getStringValue(VitroSearchTermNames.URI);
|
||||||
Individual ind = iDao.getIndividualByURI(uri);
|
Individual ind = iDao.getIndividualByURI(uri);
|
||||||
if(ind != null) {
|
if (ind != null) {
|
||||||
ind.setSearchSnippet( getSnippet(doc, response) );
|
ind.setSearchSnippet(getSnippet(doc, response));
|
||||||
individuals.add(ind);
|
individuals.add(ind);
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Problem getting usable individuals from search hits. ",e);
|
log.error("Problem getting usable individuals from search hits. ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,8 @@ public class GetAllClasses extends BaseEditController {
|
||||||
|
|
||||||
while (classGroupIt.hasNext()) {
|
while (classGroupIt.hasNext()) {
|
||||||
VClassGroup group = (VClassGroup) classGroupIt.next();
|
VClassGroup group = (VClassGroup) classGroupIt.next();
|
||||||
List classes = group.getVitroClassList();
|
List<VClass> classes = group.getVitroClassList();
|
||||||
Iterator classIt = classes.iterator();
|
for (VClass clazz : classes) {
|
||||||
while (classIt.hasNext()) {
|
|
||||||
VClass clazz = (VClass) classIt.next();
|
|
||||||
respo.append("<option>" + "<key>").append(clazz.getPickListName()).append("</key>").append("<value>").append(clazz.getURI()).append("</value>").append("</option>");
|
respo.append("<option>" + "<key>").append(clazz.getPickListName()).append("</key>").append("<value>").append(clazz.getURI()).append("</value>").append("</option>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -644,9 +644,7 @@ public class GroupedPropertyList extends BaseTemplateModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyGroupTemplateModel pullPropertyGroup(String groupName) {
|
public PropertyGroupTemplateModel pullPropertyGroup(String groupName) {
|
||||||
Iterator<PropertyGroupTemplateModel> groupIt = groups.iterator();
|
for (PropertyGroupTemplateModel group : groups) {
|
||||||
while (groupIt.hasNext()) {
|
|
||||||
PropertyGroupTemplateModel group = groupIt.next();
|
|
||||||
if (groupName.equals(group.getName())) {
|
if (groupName.equals(group.getName())) {
|
||||||
groups.remove(group);
|
groups.remove(group);
|
||||||
return group;
|
return group;
|
||||||
|
|
|
@ -426,20 +426,18 @@ public class VClassJenaTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLabel2(String lang, List<RDFNode>labelList) {
|
private String getLabel2(String lang, List<RDFNode>labelList) {
|
||||||
Iterator<RDFNode> labelIt = labelList.iterator();
|
for (RDFNode label : labelList) {
|
||||||
while (labelIt.hasNext()) {
|
if (label.isLiteral()) {
|
||||||
RDFNode label = labelIt.next();
|
Literal labelLit = ((Literal) label);
|
||||||
if (label.isLiteral()) {
|
String labelLanguage = labelLit.getLanguage();
|
||||||
Literal labelLit = ((Literal)label);
|
if ((labelLanguage == null) && (lang == null)) {
|
||||||
String labelLanguage = labelLit.getLanguage();
|
return labelLit.getLexicalForm();
|
||||||
if ( (labelLanguage==null) && (lang==null) ) {
|
}
|
||||||
return labelLit.getLexicalForm();
|
if ((lang != null) && (lang.equals(labelLanguage))) {
|
||||||
}
|
return labelLit.getLexicalForm();
|
||||||
if ( (lang != null) && (lang.equals(labelLanguage)) ) {
|
}
|
||||||
return labelLit.getLexicalForm();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue