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


Java ExtendedIterator.hasNext方法代码示例

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


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

示例1: getAllClasses

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public static List<String> getAllClasses ()
{
   List<String>classes = new ArrayList<String>();
   DrbCortexModel model;
   try
   {
      model = DrbCortexModel.getDefaultModel();
   }
   catch (IOException e)
   {
      return classes;
   }
   ExtendedIterator it= model.getCortexModel().getOntModel().listClasses();
   while (it.hasNext())
   {
      OntClass cl = (OntClass)it.next();
      String uri = cl.getURI();
      if (uri!=null)
         classes.add(uri);
   }
   return classes;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:23,代码来源:ProcessingUtils.java

示例2: getClassLabels

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
/**
 * If class has a label AbraCadabraQualityPerformance --> Abra Cadabra --> abra cadabra : will be returned as a label in the set.
 *
 * @param ocls
 * @return
 */
public Set<String> getClassLabels(OntClass ocls) {
    String name = ocls.getLocalName();
    ExtendedIterator<RDFNode> iterator = ocls.listLabels(null);
    List<String> labels = new ArrayList<String>(3);
    while (iterator.hasNext()) {
        labels.add(iterator.next().asLiteral().getLexicalForm());
    }

    // get trimmed name,labels  then split camel case.
    name = trimName(name);
    name = LingUtil.splitCamelCase(name).toLowerCase();
    for (int i = 0; i < labels.size(); i++) {
        labels.set(i, LingUtil.splitCamelCase(trimName(labels.get(i))).toLowerCase());//trim then split camel case . then make lowercase
    }
    Set<String> lbls = new HashSet<String>(3);
    lbls.add(name);
    lbls.addAll(labels);
    return lbls;
}
 
开发者ID:sasinda,项目名称:OntologyBasedInormationExtractor,代码行数:26,代码来源:LinguisticEnhancer.java

示例3: getChildFeatures

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public Set<FeatureClass> getChildFeatures(boolean direct) {

        if (direct == false) {
            Set<FeatureClass> decendatns = null;

            ExtendedIterator<OntClass> children = f.listSubClasses(false);
            if (children.hasNext()) {
                decendatns = new HashSet<FeatureClass>(15);
            }
            while (children.hasNext()) {
                decendatns.add(new FeatureClass(children.next()));
            }
            return decendatns;
        }
        return cfs;
    }
 
开发者ID:sasinda,项目名称:OntologyBasedInormationExtractor,代码行数:17,代码来源:FeatureClass.java

示例4: getProduct

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public static Product getProduct(Node subject,Graph graph,HashMap<Node,Product> hashmap){
	Product product=hashmap.get(subject);
	if (product!=null){
		return product;
	}
	else{
		product=new Product();
		ExtendedIterator<Node> compositions=GraphUtil.listSubjects(graph,RELATING_OBJECT,subject);
		if(compositions.hasNext()){
			ExtendedIterator<Node> childIterator=GraphUtil.listObjects(graph,compositions.next(),RELATED_OBJECTS);
			while (childIterator.hasNext()){
				Node childNode=childIterator.next();
				Product child=hashmap.get(childNode);
				if (child!=null){
					product.getTriangles().addAll(child.getTriangles());
				}
				else{
					child=getProduct(childNode,graph,hashmap);
					product.getTriangles().addAll(child.getTriangles());
				}
			}
		}
		return product;
		}			
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:26,代码来源:ProductUtil.java

示例5: getRelatedSubjects

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
@Override
protected HashSet<Node> getRelatedSubjects(Node node, ExecutionContext execCxt) {
	HashSet<Node> results = new HashSet<Node>();

	Graph graph = execCxt.getActiveGraph();

	Node clazz = NodeFactory.createURI(Namespace.IFC2X3_TC1 + "IfcBuildingStorey");
	LinkedList<Storey> storeys = new LinkedList<Storey>();
	if (graph.contains(node, RDF.type.asNode(), clazz)) {
		Storey storey = new Storey(node, elevation(node, graph));
		ExtendedIterator<Triple> triples = graph.find(null, RDF.type.asNode(), clazz);
		while (triples.hasNext()) {
			Node subject = triples.next().getSubject();
			Storey s = new Storey(subject, elevation(subject, graph));
			if (s.elevation > storey.elevation) {
				addStorey(storeys, s, graph);
			}
		}
		if (storeys.size() > 0) {
			results.add(storeys.get(0).storey);
		}
	}
	return results;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:25,代码来源:HasLowerStoreyPF.java

示例6: getSpdxPackage

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
/**
 * @return the spdxPackage
 * @throws InvalidSPDXAnalysisException 
 */
public SPDXPackage getSpdxPackage() throws InvalidSPDXAnalysisException {
	if (this.spdxPackage != null) {
		return this.spdxPackage;
	}
	Node spdxDocNode = getSpdxDocNode();
	if (spdxDocNode == null) {
		throw(new InvalidSPDXAnalysisException("Must set an SPDX doc before getting an SPDX package"));
	}
	Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_PACKAGE).asNode();
	Triple m = Triple.createMatch(spdxDocNode, p, null);
	ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);	
	SPDXPackage newSpdxPackage = null;
	while (tripleIter.hasNext()) {
		Triple t = tripleIter.next();
		newSpdxPackage = new SPDXPackage(t.getObject());
	}
	this.spdxPackage = newSpdxPackage;
	return newSpdxPackage;
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:24,代码来源:SPDXDocument.java

示例7: 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

示例8: getSha1

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
/**
 * @return the sha1
 * @throws InvalidSPDXAnalysisException 
 */
public String getSha1() throws InvalidSPDXAnalysisException {
	
	String retval = null;
	Node p = model.getProperty(SPDX_NAMESPACE, PROP_PACKAGE_CHECKSUM).asNode();
	Triple m = Triple.createMatch(this.node, p, null);
	ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);	
	while (tripleIter.hasNext()) {
		Triple t = tripleIter.next();
		SPDXChecksum cksum = new SPDXChecksum(model, t.getObject());
		if (cksum.getAlgorithm().equals(SpdxRdfConstants.ALGORITHM_SHA1)) {
			retval = cksum.getValue();
		}
	}
	return retval;
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:20,代码来源:SPDXDocument.java

示例9: getDeclaredLicense

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
/**
 * @return the declaredLicenses
 * @throws InvalidSPDXAnalysisException 
 */
public SPDXLicenseInfo getDeclaredLicense() throws InvalidSPDXAnalysisException {
	ArrayList<SPDXLicenseInfo> alLic = new ArrayList<SPDXLicenseInfo>();
	Node p = model.getProperty(SPDX_NAMESPACE, PROP_PACKAGE_DECLARED_LICENSE).asNode();
	Triple m = Triple.createMatch(this.node, p, null);
	ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);	
	while (tripleIter.hasNext()) {
		Triple t = tripleIter.next();
		alLic.add(SPDXLicenseInfoFactory.getLicenseInfoFromModel(model, t.getObject()));
	}
	if (alLic.size() > 1) {
		throw(new InvalidSPDXAnalysisException("Too many declared licenses"));
	}
	if (alLic.size() == 0) {
		return null;
	}
	return alLic.get(0);
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:22,代码来源:SPDXDocument.java

示例10: getCreatorInfo

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public SPDXCreatorInformation getCreatorInfo() throws InvalidSPDXAnalysisException {
	Node spdxDocNode = getSpdxDocNode();
	if (spdxDocNode == null) {
		throw(new InvalidSPDXAnalysisException("No SPDX Document was found.  Can not access the creator information"));
	}
	ArrayList<SPDXCreatorInformation> als = new ArrayList<SPDXCreatorInformation>();
	Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_CREATION_INFO).asNode();
	Triple m = Triple.createMatch(spdxDocNode, p, null);
	ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);	
	while (tripleIter.hasNext()) {
		Triple t = tripleIter.next();
		als.add(new SPDXCreatorInformation(model, t.getObject()));
	}
	if (als.size() > 1) {
		throw(new InvalidSPDXAnalysisException("Too many creation information for document.  Only one is allowed."));
	}
	if (als.size() > 0) {
		return als.get(0);
	} else {
		return null;
	}
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:23,代码来源:SPDXDocument.java

示例11: findDocPropertieStringValues

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
/**
 * Find all property string values belonging to the subject
 * @param subject
 * @param nameSpace
 * @param propertyName
 * @return string values of the properties or null if the subject or propertyName is null
 */
private String[] findDocPropertieStringValues(Node subject, String nameSpace, String propertyName) {
	if (subject == null || propertyName == null) {
		return null;
	}
	ArrayList<String> alResult = new ArrayList<String>();
	Node p = model.getProperty(nameSpace, propertyName).asNode();
	Triple m = Triple.createMatch(subject, p, null);
	ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);	
	while (tripleIter.hasNext()) {
		Triple t = tripleIter.next();
		if (t.getObject().isURI()) {
			if (t.getObject().getURI().equals(SpdxRdfConstants.URI_VALUE_NONE)) {
				alResult.add(SpdxRdfConstants.NONE_VALUE);
			} else if (t.getObject().getURI().equals(SpdxRdfConstants.URI_VALUE_NOASSERTION)) {
				alResult.add(SpdxRdfConstants.NOASSERTION_VALUE);
			} else {
				alResult.add(t.getObject().toString(false));
			}
		} else {
			alResult.add(t.getObject().toString(false));
		}
	}
	String[] retval = new String[alResult.size()];
	return alResult.toArray(retval);
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:33,代码来源:SPDXDocument.java

示例12: getDataLicense

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public SPDXStandardLicense getDataLicense() throws InvalidSPDXAnalysisException {
	ArrayList<SPDXLicenseInfo> alLic = new ArrayList<SPDXLicenseInfo>();
	Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_DATA_LICENSE).asNode();
	Triple m = Triple.createMatch(getSpdxDocNode(), p, null);
	ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);	
	while (tripleIter.hasNext()) {
		Triple t = tripleIter.next();
		alLic.add(SPDXLicenseInfoFactory.getLicenseInfoFromModel(model, t.getObject()));
	}
	if (alLic.size() > 1) {
		throw(new InvalidSPDXAnalysisException("Too many data licenses"));
	}
	if (alLic.size() == 0) {
		return null;
	}
	if (!(alLic.get(0) instanceof SPDXStandardLicense)) {
		throw(new InvalidSPDXAnalysisException("Incorrect license for datalicense - must be a standard SPDX license type"));
	}
	return (SPDXStandardLicense)(alLic.get(0));
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:21,代码来源:SPDXDocument.java

示例13: getUnionClassRangeString

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private String getUnionClassRangeString(UnionClass unionClass) {
	String rslt = "";
	int cnt = 0;
	RDFList uclsses = unionClass.getOperands();
	if (uclsses != null) {
		ExtendedIterator<RDFNode> eitr = uclsses.iterator();
		while (eitr.hasNext()) {
			RDFNode node = eitr.next();
			if (cnt > 0) rslt += " or ";
			if (node.canAs(OntClass.class)) {
				rslt += ontClassToString(node.as(OntClass.class), null);
			}
			cnt++;
		}
		if (cnt > 1) {
			rslt = "{" + rslt + "}";
		}
	}
	return rslt;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:21,代码来源:OwlToSadl.java

示例14: 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

示例15: listSubModelsAndPrefixes

import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private Map<String, String> listSubModelsAndPrefixes(Map<String, String> map, OntModel m, String modelUri) {
	Ontology onto = m.getOntology(modelUri);
	if (onto != null) {
		String prefix = m.getNsURIPrefix(modelUri);
		if (prefix == null) {
			prefix = getGlobalPrefix(modelUri);
		}
		if (!map.containsKey(modelUri)) {
			map.put(modelUri, prefix);
		}
		ExtendedIterator<OntResource> importsItr = onto.listImports();
		if (importsItr.hasNext()) {
			while (importsItr.hasNext()) {
				OntResource or = importsItr.next();
				logger.debug("Ontology of model '" + modelUri + "' has import '" + or.toString() + "' with prefix '" + prefix + "'");
				if (!map.containsKey(or.toString())) {
					OntModel submodel = m.getImportedModel(or.getURI());
					if (submodel != null) {
						map = listSubModelsAndPrefixes(map, submodel, or.getURI());
					}
				}
			}
		}
	}
	return map;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:27,代码来源:ConfigurationManager.java


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