Minor code improvements

This commit is contained in:
Graham Triggs 2017-09-18 12:20:01 +01:00
parent d97544b991
commit 751d50f93a
44 changed files with 476 additions and 625 deletions

View file

@ -178,18 +178,15 @@ 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()){
Option option = itr.next();
hashMap.put(option.getBody(), option); hashMap.put(option.getBody(), option);
bodyVal.add(option.getBody()); 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;
} }

View file

@ -162,10 +162,9 @@ 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) {

View file

@ -301,9 +301,7 @@ 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()){
ObjectProperty prop = (ObjectProperty)it.next();
prop.sortObjectPropertyStatementsForDisplay(prop, prop.getObjectPropertyStatements()); prop.sortObjectPropertyStatementsForDisplay(prop, prop.getObjectPropertyStatements());
} }
} }

View file

@ -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,9 +167,7 @@ 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()));
} }

View file

@ -211,10 +211,8 @@ 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);
} }
@ -222,9 +220,7 @@ public class EntityRetryController extends BaseEditController {
} }
if (individualForEditing.getDataPropertyList() != null) { if (individualForEditing.getDataPropertyList() != null) {
Iterator<DataProperty> existingDps = individualForEditing.getDataPropertyList().iterator(); for (DataProperty existingDp : individualForEditing.getDataPropertyList()) {
while (existingDps.hasNext()) {
DataProperty existingDp = existingDps.next();
// Since the edit form begins with a "name" field, which gets saved as the rdfs:label, // Since the edit form begins with a "name" field, which gets saved as the rdfs:label,
// do not want to include the label as well. // do not want to include the label as well.
if (!existingDp.getPublicName().equals("label")) { if (!existingDp.getPublicName().equals("label")) {
@ -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());

View file

@ -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);

View file

@ -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);

View file

@ -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,10 +64,7 @@ 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) {

View file

@ -146,12 +146,11 @@ 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);

View file

@ -83,12 +83,11 @@ 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 = (VClass) classesIt.next(); VClass cls = aClass;
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 {

View file

@ -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();

View file

@ -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);
} }

View file

@ -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);
} }

View file

@ -203,9 +203,7 @@ public class GrefinePropertyListServlet extends VitroHttpServlet {
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()) {
DataProperty dp = dataPropIt.next();
if (!(propURIs.contains(dp.getURI()))) { if (!(propURIs.contains(dp.getURI()))) {
propURIs.add(dp.getURI()); propURIs.add(dp.getURI());
DataProperty prop = dao.getDataPropertyByURI(dp.getURI()); DataProperty prop = dao.getDataPropertyByURI(dp.getURI());
@ -256,20 +254,19 @@ 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);
} }

View file

@ -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] + "\"");
} }

View file

@ -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());
} }

View file

@ -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 {

View file

@ -633,9 +633,7 @@ 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()) {
Property pt = pit.next();
if ((!pt.equals(op)) && (!(ontModel.contains(op, OWL.equivalentProperty, pt)) || (ontModel.contains(pt, OWL.equivalentProperty, op)))) { if ((!pt.equals(op)) && (!(ontModel.contains(op, OWL.equivalentProperty, pt)) || (ontModel.contains(pt, OWL.equivalentProperty, op)))) {
isRoot = false; isRoot = false;
} }

View file

@ -66,9 +66,7 @@ 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()){
Statement changedStmt = changed.next();
if (removedStmt.equals(changedStmt)) { if (removedStmt.equals(changedStmt)) {
removed.remove(); removed.remove();
} }

View file

@ -69,9 +69,7 @@ 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())) {

View file

@ -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()));
} }

View file

@ -517,9 +517,7 @@ 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()){
ObjectProperty prop = (ObjectProperty)it.next();
/* if (prop.getObjectIndividualSortPropertyURI()==null) { /* if (prop.getObjectIndividualSortPropertyURI()==null) {
prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements()); prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements());
} else {*/ } else {*/

View file

@ -953,9 +953,7 @@ 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()){
ObjectProperty prop = (ObjectProperty)it.next();
/* if (prop.getObjectIndividualSortPropertyURI()==null) { /* if (prop.getObjectIndividualSortPropertyURI()==null) {
prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements()); prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements());
} else {*/ } else {*/

View file

@ -771,9 +771,7 @@ 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()) {
RDFNode label = labelIt.next();
if (label.isLiteral()) { if (label.isLiteral()) {
Literal labelLit = ((Literal) label); Literal labelLit = ((Literal) label);
String labelLanguage = labelLit.getLanguage(); String labelLanguage = labelLit.getLanguage();
@ -1019,9 +1017,7 @@ 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()) {
Resource possibleRes = possibleValueIt.next();
StmtIterator pStmtIt = getOntModel().listStatements((Resource) null, prop, possibleRes); StmtIterator pStmtIt = getOntModel().listStatements((Resource) null, prop, possibleRes);
boolean hasAlternatePath = false; boolean hasAlternatePath = false;
while (stmtIt.hasNext()) { while (stmtIt.hasNext()) {
@ -1048,9 +1044,7 @@ 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()) {
Resource possibleRes = possibleSubjectIt.next();
StmtIterator pStmtIt = getOntModel().listStatements(possibleRes, prop, (RDFNode) null); StmtIterator pStmtIt = getOntModel().listStatements(possibleRes, prop, (RDFNode) null);
boolean hasAlternatePath = false; boolean hasAlternatePath = false;
while (stmtIt.hasNext()) { while (stmtIt.hasNext()) {

View file

@ -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;

View file

@ -163,9 +163,7 @@ 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()){
String uri = it.next();
if (!subtree.contains(uri)) { if (!subtree.contains(uri)) {
subtree.add(uri); subtree.add(uri);
getAllSubPropertyURIs(uri, subtree); getAllSubPropertyURIs(uri, subtree);
@ -206,9 +204,7 @@ 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()){
String uri = it.next();
if (!subtree.contains(uri)) { if (!subtree.contains(uri)) {
subtree.add(uri); subtree.add(uri);
getAllSuperPropertyURIs(uri, subtree); getAllSuperPropertyURIs(uri, subtree);
@ -421,11 +417,7 @@ 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) {
while (it.hasNext()) {
OntClass oc = it.next();
if (!oc.isAnon()) { if (!oc.isAnon()) {
classSet.add(oc.getURI()); classSet.add(oc.getURI());
} else { } else {

View file

@ -148,12 +148,8 @@ 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();
Iterator objPropertyStmtIter = op.getObjectPropertyStatements().iterator();
while (objPropertyStmtIter.hasNext()) {
ObjectPropertyStatement objPropertyStmt = (ObjectPropertyStatement) objPropertyStmtIter.next();
if (propertyURI == null || objPropertyStmt.getPropertyURI().equals(propertyURI)) { if (propertyURI == null || objPropertyStmt.getPropertyURI().equals(propertyURI)) {
PropertyInstance pi = new PropertyInstance(); PropertyInstance pi = new PropertyInstance();
pi.setSubjectSide(true); pi.setSubjectSide(true);

View file

@ -411,9 +411,7 @@ 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,9 +448,7 @@ 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,9 +783,7 @@ 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()) {
String classURI = (String) classURIs.next();
VClass vClass = getVClassByURI(classURI); VClass vClass = getVClassByURI(classURI);
if (vClass != null) if (vClass != null)
vClasses.add(vClass); 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);
} }
} }

View file

@ -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;

View file

@ -39,11 +39,9 @@ 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 key = (String) dpmIt.next();
String[] data = (String[]) dpm.get(key); String[] data = (String[]) dpm.get(key);
for (String aData : data) { for (String aData : data) {
String[] keyArg = key.split("_"); String[] keyArg = key.split("_");
@ -105,11 +103,9 @@ 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));
} }

View file

@ -463,9 +463,7 @@ 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()) {
String key = keyIterator.next();
if (urisFromForm.get(key).contains(EditConfigurationConstants.NEW_URI_SENTINEL)) { if (urisFromForm.get(key).contains(EditConfigurationConstants.NEW_URI_SENTINEL)) {
String newUri = urisForNewResources.get(key); String newUri = urisForNewResources.get(key);
List<String> newUrisForKey = new ArrayList<String>(); List<String> newUrisForKey = new ArrayList<String>();

View file

@ -91,11 +91,7 @@ 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) {
while (iter.hasNext()) {
AtomicOntologyChange change = iter.next();
switch (change.getAtomicChangeType()) { switch (change.getAtomicChangeType()) {
case ADD: case ADD:
addClass(change); addClass(change);
@ -236,11 +232,7 @@ 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();
@ -415,9 +407,7 @@ 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) {

View file

@ -419,10 +419,7 @@ 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) {
while(listItr.hasNext()) {
AtomicOntologyChange changeObj = listItr.next();
if (changeObj.getSourceURI() != null) { if (changeObj.getSourceURI() != null) {
log.debug("triaging " + changeObj); log.debug("triaging " + changeObj);
if (oldTboxModel.getOntProperty(changeObj.getSourceURI()) != null) { if (oldTboxModel.getOntProperty(changeObj.getSourceURI()) != null) {

View file

@ -171,9 +171,7 @@ 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()) {
String var = varIt.next();
for (int i = 0; i < solnList.size(); i++) { for (int i = 0; i < solnList.size(); i++) {
QuerySolution s = solnList.get(i); QuerySolution s = solnList.get(i);
if (s == null) { if (s == 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,9 +264,7 @@ 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()) {
String var = varIt.next();
for (int i = 0; i < solnList.size(); i++) { for (int i = 0; i < solnList.size(); i++) {
QuerySolution s = solnList.get(i); QuerySolution s = solnList.get(i);
if (s == null) { if (s == 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);
} }

View file

@ -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);
} }
} }

View file

@ -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));

View file

@ -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));

View file

@ -73,9 +73,7 @@ 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()) {
E e = it.next();
if (!c.contains(e)) { if (!c.contains(e)) {
m.remove(e); m.remove(e);
q.remove(e); q.remove(e);

View file

@ -563,9 +563,7 @@ 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()) {
Resource res = sameIter.next();
StmtIterator typeIt = aboxModel.listStatements(res, RDF.type, (RDFNode) null); StmtIterator typeIt = aboxModel.listStatements(res, RDF.type, (RDFNode) null);
while (typeIt.hasNext()) { while (typeIt.hasNext()) {
Statement stmt = typeIt.nextStatement(); Statement stmt = typeIt.nextStatement();
@ -802,10 +800,7 @@ 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());
@ -860,10 +855,9 @@ 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(sameIter.next(), ResourceFactory.createStatement(sameIndividual,
infStmt.getPredicate(), infStmt.getObject()); infStmt.getPredicate(), infStmt.getObject());
if ((!checkEntailment if ((!checkEntailment
|| !entailedStatement(infStmtSame)) || !entailedStatement(infStmtSame))
@ -936,16 +930,9 @@ 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) {
while (typeIter.hasNext()) {
OntClass type = typeIter.next();
boolean add = true; boolean add = true;
Iterator<OntClass> typeIter2 = types2.iterator(); for (OntClass type2 : types2) {
while (typeIter2.hasNext()) {
OntClass type2 = typeIter2.next();
if (type.equals(type2)) { if (type.equals(type2)) {
continue; continue;
} }
@ -971,10 +958,7 @@ public class SimpleReasoner extends StatementListener
equivalentClasses.add(res); equivalentClasses.add(res);
} }
Iterator<Resource> eIter = equivalentClasses.iterator(); for (Resource equivClass : equivalentClasses) {
while (eIter.hasNext()) {
Resource equivClass = eIter.next();
if (equivClass.isAnon()) continue; if (equivClass.isAnon()) continue;
typeURIs.add(equivClass.getURI()); typeURIs.add(equivClass.getURI());
} }
@ -1019,9 +1003,7 @@ 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()) {
String typeURI = typeIter.next();
Statement mstStmt = ResourceFactory.createStatement(individual, mostSpecificType, ResourceFactory.createResource(typeURI)); Statement mstStmt = ResourceFactory.createStatement(individual, mostSpecificType, ResourceFactory.createResource(typeURI));
addInference(mstStmt, inferenceModel, true); addInference(mstStmt, inferenceModel, true);
} }

View file

@ -174,10 +174,8 @@ 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 {

View file

@ -197,10 +197,8 @@ 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) {

View file

@ -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>");
} }
} }

View file

@ -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;

View file

@ -426,9 +426,7 @@ 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()) {
RDFNode label = labelIt.next();
if (label.isLiteral()) { if (label.isLiteral()) {
Literal labelLit = ((Literal) label); Literal labelLit = ((Literal) label);
String labelLanguage = labelLit.getLanguage(); String labelLanguage = labelLit.getLanguage();