当前位置: 首页>>代码示例>>Java>>正文


Java ExtendedIterator.close方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.util.iterator.ExtendedIterator.close方法的典型用法代码示例。如果您正苦于以下问题:Java ExtendedIterator.close方法的具体用法?Java ExtendedIterator.close怎么用?Java ExtendedIterator.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.util.iterator.ExtendedIterator的用法示例。


在下文中一共展示了ExtendedIterator.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractResourceURIs

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private <T> List<String> extractResourceURIs(final ExtendedIterator<T> iterator, final Set<String> namespaces) {
	try {
		final List<String> uris=Lists.newLinkedList();
		while(iterator.hasNext()) {
			final T item=iterator.next();
			if(item instanceof Resource) {
				final Resource resource = (Resource)item;
				if(!resource.isAnon()) {
					final String uri = resource.getURI();
					if(!isReserved(uri)) {
						if(namespaces.contains(resource.getNameSpace())) {
							uris.add(uri);
						}
					}
				}
			}
		}
		return uris;
	} finally {
		iterator.close();
	}
}
 
开发者ID:SmartDeveloperHub,项目名称:sdh-vocabulary,代码行数:23,代码来源:VocabularyHelper.java

示例2: getDomain

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private OntResource getDomain(OntProperty prop) {
	OntResource domain = prop.getDomain();
	if (domain == null) {
		if (prop.canAs(ObjectProperty.class)) {
			ExtendedIterator<? extends OntProperty> titr = ((ObjectProperty) prop
					.as(ObjectProperty.class)).listSuperProperties(true);
			while (titr.hasNext()) {
				OntProperty tr = titr.next();
				domain = getDomain((OntProperty) tr);
				if (domain != null) {
					titr.close();
					return domain;
				}
			}
			titr.close();
		}
	}
	return domain;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:20,代码来源:ModelManager.java

示例3: getRange

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private OntResource getRange(OntProperty prop) {
	OntResource range = prop.getRange();
	if (range == null) {
		ExtendedIterator<? extends OntProperty> titr = null;
		if (prop.canAs(ObjectProperty.class)) {
			titr = ((ObjectProperty) prop.as(ObjectProperty.class))
					.listSuperProperties(true);
		} else if (prop.canAs(DatatypeProperty.class)) {
			titr = ((DatatypeProperty) prop.as(DatatypeProperty.class))
					.listSuperProperties(true);
		}
		if (titr != null) {
			while (titr.hasNext()) {
				OntProperty tr = titr.next();
				range = getRange((OntProperty) tr);
				if (range != null) {
					titr.close();
					return range;
				}
			}
			titr.close();
		}
	}
	return range;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:26,代码来源:ModelManager.java

示例4: maxCardinalityRestrictionAlreadyExists

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private boolean maxCardinalityRestrictionAlreadyExists(OntClass domainCls,
		OntProperty prop, int mxcard) {
	ExtendedIterator<OntClass> eitr = domainCls.listSuperClasses(true);
	while (eitr.hasNext()) {
		OntClass supercls = eitr.next();
		if (supercls.isRestriction()) {
			Restriction rstrctn = supercls.asRestriction();
			if (rstrctn.isMaxCardinalityRestriction()) {
				MaxCardinalityRestriction maxrest = rstrctn.asMaxCardinalityRestriction();
				if (maxrest.getOnProperty().equals(prop) && maxrest.getMaxCardinality() == mxcard) {
					eitr.close();
					return true;
				}
			}
		}
	}
	eitr.close();
	return false;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:20,代码来源:ModelManager.java

示例5: getSadlTypedListType

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public Resource getSadlTypedListType(OntClass lstcls) {
	ExtendedIterator<OntClass> eitr = ((OntClass)lstcls.as(OntClass.class)).listSuperClasses(true);
	while (eitr.hasNext()) {
		OntClass cls = eitr.next();
		if (cls.isRestriction()) {
			if (cls.canAs(AllValuesFromRestriction.class)) {
				if (((AllValuesFromRestriction)cls.as(AllValuesFromRestriction.class)).onProperty(theJenaModel.getProperty(SadlConstants.SADL_LIST_MODEL_FIRST_URI))) {
					Resource avf = ((AllValuesFromRestriction)cls.as(AllValuesFromRestriction.class)).getAllValuesFrom();
					eitr.close();
					return avf;
				}
			}
		}
	}
	return null;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:17,代码来源:JenaBasedSadlModelValidator.java

示例6: getListClassType

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
protected ConceptName getListClassType(OntResource cls) {
	ExtendedIterator<OntClass> eitr = cls.as(OntClass.class).listSuperClasses();
	while (eitr.hasNext()) {
		OntClass supercls = eitr.next();
		if (supercls.isRestriction() && supercls.hasProperty(OWL.onProperty, theJenaModel.getProperty(SadlConstants.SADL_LIST_MODEL_FIRST_URI))) {
			RDFNode avf = supercls.getPropertyValue(OWL.allValuesFrom);
			if (avf.canAs(Resource.class)) {
				Resource r = avf.as(Resource.class);
				if (r.isURIResource()) {
					eitr.close();
					return new ConceptName(r.getURI());
				}
			}
		}
	}
	return null;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:18,代码来源:JenaBasedSadlModelValidator.java

示例7: instancesHaveCommonType

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private boolean instancesHaveCommonType(Individual individualL, Individual individualR) {
	ExtendedIterator<Resource> lcitr = individualL.listRDFTypes(true);
	ExtendedIterator<Resource> rcitr = individualR.listRDFTypes(true);
	while (lcitr.hasNext()) {
		Resource lr = lcitr.next();
		while (rcitr.hasNext()) {
			Resource rr = rcitr.next();
			if (lr.equals(rr)) {
				lcitr.close();
				rcitr.close();
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:17,代码来源:JenaBasedSadlModelValidator.java

示例8: checkObjectPropertyRange

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public boolean checkObjectPropertyRange(OntModel theJenaModel2, OntProperty pred, OntResource obj, boolean isList, EObject expr) throws CircularDependencyException {
	if (pred.isObjectProperty()) {
		if (checkRangeForMatch(theJenaModel2, pred, obj, isList)) {
			return true;
		}
		ExtendedIterator<? extends OntProperty> propitr = pred.listSuperProperties(false);
		while (propitr.hasNext()) {
			OntProperty sprop = propitr.next();
			if (checkRangeForMatch(theJenaModel2, sprop, obj, isList)) {
				propitr.close();
				return true;
			}
		}
		return false;
	}
	return true;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:18,代码来源:JenaBasedSadlModelValidator.java

示例9: instanceOf

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
protected boolean instanceOf(Node node, Node clazz,Graph graph){
	ExtendedIterator<Triple> it=graph.find(node, RDF.type.asNode(), null);
	while(it.hasNext()) {
		Triple s = it.next();
			Node actualType = s.getObject();
			if(actualType.equals(clazz) || hasSuperClass(actualType, clazz,new HashSet<Node>(),graph)) {
				it.close();
				return true;
			}
	}
	return false;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:13,代码来源:IsOutsidePF.java

示例10: extractOntologicalResourceURIs

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private List<String> extractOntologicalResourceURIs(final ExtendedIterator<? extends OntResource> iterator) {
	try {
		final List<String> uris=Lists.newLinkedList();
		while(iterator.hasNext()) {
			final OntResource resource = iterator.next();
			if(!resource.isAnon()) {
				uris.add(resource.getURI());
			}
		}
		return uris;
	} finally {
		iterator.close();
	}
}
 
开发者ID:SmartDeveloperHub,项目名称:sdh-vocabulary,代码行数:15,代码来源:VocabularyHelper.java

示例11: classIsSuperClassOf

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private static boolean classIsSuperClassOf(OntClass cls, OntClass subcls) {
	ExtendedIterator<OntClass> eitr = subcls.listSuperClasses();
	try {
		while (eitr.hasNext()) {
			OntClass sprcls = eitr.next();
			if (sprcls.equals(cls)) {
				return true;
			}
			if (classIsSuperClassOf(cls, sprcls)) {
				return true;
			}
		}
		eitr.close();
		
		eitr = cls.listSuperClasses();
		while (eitr.hasNext()) {
			OntClass equivCls = eitr.next();
			if (classIsSubclassOf(subcls, equivCls, false)) {
				eitr.close();
				return true;
			}
		}
	}
	catch (Throwable t) {
		logger.error("Error checking if class '" + cls.toString() + "' is a superclass of '" + subcls.toString() + 
				"' : " + t.getMessage());
	}
	finally {
		eitr.close();
	}
	return false;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:33,代码来源:ModelManager.java

示例12: validateClassInDomain

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public boolean validateClassInDomain(NamedNode pred, NamedNode domainClass) {
	if (beginDeepValidation()) {
		OntProperty prop = getJenaModel().getOntProperty(
				pred.toFullyQualifiedString());
		if (prop != null) {
			OntResource dr = prop.getDomain();
			OntClass dcls = getJenaModel().getOntClass(
					domainClass.toFullyQualifiedString());
			if (dcls != null) {
				if (dr == null) {
					ExtendedIterator<? extends OntProperty> spitr = prop.listSuperProperties();
					while (spitr.hasNext()) {
						OntProperty sprop = spitr.next();
						dr = sprop.getDomain();
						if (dr != null) {
							if (classIsSubclassOf(dcls, dr, true)) {
								spitr.close();
								endDeepValidation();
								return true;
							}
						}
					}
					spitr.close();
				}
				else {
					boolean bresult = classIsSubclassOf(dcls, dr, true); // dr.as(OntClass.class), dcls);
					endDeepValidation();
					return bresult;
				}
			}
		}
	}
	return true; // annotation properties aren't OntProperties
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:35,代码来源:ModelManager.java

示例13: validateClassInRange

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public boolean validateClassInRange(NamedNode pred, NamedNode rangeClass) {
		if (beginDeepValidation()) {
			OntProperty prop = getJenaModel().getOntProperty(
					pred.toFullyQualifiedString());
			if (prop != null && prop.isObjectProperty()) {
				OntResource rr = prop.getRange();
				OntClass rcls = getJenaModel().getOntClass(
						rangeClass.toFullyQualifiedString());
				if (rcls != null) {
					if (rr == null) {
						ExtendedIterator<? extends OntProperty> spitr = prop.listSuperProperties();
						while (spitr.hasNext()) {
							OntProperty sprop = spitr.next();
							rr = sprop.getDomain();
							if (rr != null) {
								if (classIsSubclassOf(rcls, rr, true)) {
									spitr.close();
									endDeepValidation();
									return true;
								}
							}
						}
						spitr.close();
					}
					else {
						boolean breturn = classIsSubclassOf(rcls, rr, true);
						endDeepValidation();
						return breturn;
					}
				}
			}
			else if (prop == null) {
// TODO this might need more checking awc 9/15/2013				
				return true;
			}
			endDeepValidation();
			return false;
		}
		return true;
	}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:41,代码来源:ModelManager.java

示例14: unionClassContainsSuperclass

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private boolean unionClassContainsSuperclass(UnionClass unionCls, OntClass cls) {
	ExtendedIterator<RDFNode> eitr = unionCls.getOperands().iterator();
	while (eitr.hasNext()) {
		RDFNode node = eitr.next();
		if (node.equals(cls) || (node.canAs(OntClass.class) && cls.hasSuperClass((OntClass)node.as(OntClass.class)))) {
			eitr.close();
			return true;
		}
	}
	return false;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:12,代码来源:OwlToSadl.java

示例15: addInstancePropertyValue

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private void addInstancePropertyValue(Individual inst, Property prop, RDFNode value, EObject ctx) {
	if (prop.getURI().equals(SadlConstants.SADL_IMPLICIT_MODEL_IMPLIED_PROPERTY_URI)) {
		// check for ambiguity through duplication of property range
		if (value.canAs(OntProperty.class)) {
			NodeIterator ipvs = inst.listPropertyValues(prop);
			if (ipvs.hasNext()) {
				List<OntResource> valueRngLst = new ArrayList<OntResource>();
				ExtendedIterator<? extends OntResource> vitr = value.as(OntProperty.class).listRange();
				while (vitr.hasNext()) {
					valueRngLst.add(vitr.next());
				}
				vitr.close();
				boolean overlap = false;
				while (ipvs.hasNext()) {
					RDFNode ipv = ipvs.next();
					if (ipv.canAs(OntProperty.class)) {
						ExtendedIterator<? extends OntResource> ipvitr = ipv.as(OntProperty.class).listRange();
						while (ipvitr.hasNext()) {
							OntResource ipvr = ipvitr.next();
							if (valueRngLst.contains(ipvr)) {
								addError("Ambiguous condition--multiple implied properties ("
										+ value.as(OntProperty.class).getLocalName() + ","
										+ ipv.as(OntProperty.class).getLocalName() + ") have the same range ("
										+ ipvr.getLocalName() + ")", ctx);
							}
						}
					}
				}
			}
		}
		addImpliedPropertyClass(inst);
	} else if (prop.getURI().equals(SadlConstants.SADL_IMPLICIT_MODEL_EXPANDED_PROPERTY_URI)) {
		addExpandedPropertyClass(inst);
	}
	inst.addProperty(prop, value);
	logger.debug("added value '" + value.toString() + "' to property '" + prop.toString() + "' for instance '"
			+ inst.toString() + "'");
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:39,代码来源:JenaBasedSadlModelProcessor.java


注:本文中的com.hp.hpl.jena.util.iterator.ExtendedIterator.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。