本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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);
}
示例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;
}
}
示例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);
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}