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


Java ExtendedIterator.hasNext方法代码示例

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


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

示例1: getGroupPaths

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public synchronized Set<PathMetadata> getGroupPaths(Node group, Graph graph) {
	if(groupPaths == null) {
		groupPaths = new HashMap<>();
		if(JenaNodeUtil.isInstanceOf(classNode, SH.Shape.asNode(), graph)) {
			addGroupProperties(classNode, graph, SH.parameter.asNode());
			addGroupProperties(classNode, graph, SH.property.asNode());
		}
		ExtendedIterator<Triple> it = graph.find(null, SH.targetClass.asNode(), classNode);
		while(it.hasNext()) {
			Node shape = it.next().getSubject();
			addGroupProperties(shape, graph, SH.parameter.asNode());
			addGroupProperties(shape, graph, SH.property.asNode());
		}
	}
	return groupPaths.get(group);
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:17,代码来源:ClassMetadata.java

示例2: ClassPropertyMetadata

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
ClassPropertyMetadata(Node classNode, Node predicate, boolean inverse, Graph graph) {
	
	this.inverse = inverse;
	this.predicate = predicate;
	
	// Init from SHACL shapes
	if(SHACLUtil.exists(graph)) {
		if(JenaNodeUtil.isInstanceOf(classNode, SH.Shape.asNode(), graph)) {
			initFromShape(classNode, graph);
		}
		ExtendedIterator<Triple> it = graph.find(null, SH.targetClass.asNode(), classNode);
		while(it.hasNext()) {
			Node shape = it.next().getSubject();
			initFromShape(shape, graph);
		}
	}
	
	if(!inverse) {
		for(Plugin plugin : plugins) {
			plugin.init(this, classNode, graph);
		}
	}
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:24,代码来源:ClassPropertyMetadata.java

示例3: hasSuperTemplate

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
@Override
   public final boolean hasSuperTemplate(Template superTemplate)
   {
if (superTemplate == null) throw new IllegalArgumentException("Template cannot be null");
       
       ExtendedIterator<OntClass> it = listSuperClasses(false);
       try
       {
           while (it.hasNext())
           {
               OntClass nextClass = it.next();
               if (nextClass.canAs(Template.class))
               {
                   Template nextTemplate = nextClass.as(Template.class);
                   if (nextTemplate.equals(superTemplate) || nextTemplate.hasSuperTemplate(superTemplate))
                       return true;
               }
           }
       }
       finally
       {
           it.close();
       }
       
       return false;
   }
 
开发者ID:AtomGraph,项目名称:Processor,代码行数:27,代码来源:TemplateImpl.java

示例4: execAllNodes

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private QueryIterator execAllNodes(Var subjVar, Node nodeLocalname,  Binding input, ExecutionContext execCxt)
{
    if ( ! nodeLocalname.isVariable() )
    {
        if ( ! nodeLocalname.isLiteral() )
            // Not a variable, not a literal=> can't match
            return QueryIterNullIterator.create(execCxt) ;
    
        if( ! NodeUtils.isSimpleString(nodeLocalname) )
            return QueryIterNullIterator.create(execCxt) ;
    }
    
    //Set bindings = new HashSet() ;    // Use a Set if you want unique results. 
    List<Binding> bindings = new ArrayList<Binding>() ;   // Use a list if you want counting results. 
    Graph graph = execCxt.getActiveGraph() ;
    
    ExtendedIterator<Triple>iter = graph.find(Node.ANY, Node.ANY, Node.ANY) ;
    for ( ; iter.hasNext() ; )
    {
        Triple t = iter.next() ;
        slot(bindings, input, t.getSubject(),   subjVar, nodeLocalname) ;
        slot(bindings, input, t.getPredicate(), subjVar, nodeLocalname) ;
        slot(bindings, input, t.getObject(),    subjVar, nodeLocalname) ;
    }
    return new QueryIterPlainWrapper(bindings.iterator(), execCxt) ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:27,代码来源:localname.java

示例5: enrich

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
@Override
public void enrich(StreamRDF stream, Node match) {
    if (match.isURI()) {
        Resource r = rdf.getResource( match.getURI() );
        if (enrichDescribe) {
            Model description = Closure.closure(r, false);
            ExtendedIterator<Triple> it = description.getGraph().find(null, null, null);
            while (it.hasNext()) {
                stream.triple(it.next());
            }
        } else {
            for (Property p : enrich) {
                for (StmtIterator si = r.listProperties(p); si.hasNext(); ) {
                    stream.triple( si.next().asTriple() ); 
                }
            }
        }
    } 
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:20,代码来源:RDFMapSource.java

示例6: fetch

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public Value fetch(String...strings) {
    ConverterProcess proc = ConverterProcess.get();
    String uri = asURI();
    Model model = proc.fetchModel(uri);
    if (model != null) {
        StreamRDF out = proc.getOutputStream();
        for (String puri : strings) {
            puri = proc.getDataContext().getPrefixes().expandPrefix(puri);
            Node p = NodeFactory.createURI(puri);
            Node s = NodeFactory.createURI(uri );
            ExtendedIterator<Triple> it = model.getGraph().find(s, p, null);
            while (it.hasNext()) {
                out.triple(it.next());
            }
        }
    }
    return this;
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:19,代码来源:ValueBase.java

示例7: assertIdenticalGraphs

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private void assertIdenticalGraphs(final Model orig, final Model roundtripped) {
    final Graph roundtrippedGraph = roundtripped.getGraph();
    final ExtendedIterator<Triple> originalTripleIt = orig.getGraph().find(Node.ANY, Node.ANY, Node.ANY);
    while (originalTripleIt.hasNext()) {
        final Triple t = originalTripleIt.next();
        assertTrue("Roundtripped resource should contain triple " + t + "!", roundtrippedGraph.contains(t));
        roundtrippedGraph.delete(t);
    }
    assertTrue("Triples round in roundtripped resource that weren't in original!\n" + roundtrippedGraph,
            roundtrippedGraph.isEmpty());
}
 
开发者ID:fcrepo4-labs,项目名称:fcrepo-import-export,代码行数:12,代码来源:RoundtripIT.java

示例8: getObject

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public static Node getObject(Node subject, Node predicate, Graph graph) {
    ExtendedIterator<Triple> it = graph.find(subject, predicate, Node.ANY);
    try { 
           return it.hasNext() 
               ? it.next().getObject() 
               : null;
    } finally { 
        it.close();
    }
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:11,代码来源:JenaNodeUtil.java

示例9: getObjects

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public static List<Node> getObjects(Node subject, Node predicate, Graph graph) {
	List<Node> results = new LinkedList<>();
	ExtendedIterator<Triple> it = graph.find(subject, predicate, Node.ANY);
	while(it.hasNext()) {
		results.add(it.next().getObject());
	}
	return results;
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:9,代码来源:JenaNodeUtil.java

示例10: getSubjects

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public static List<Node> getSubjects(Node predicate, Node object, Graph graph) {
	List<Node> results = new LinkedList<>();
	ExtendedIterator<Triple> it = graph.find(Node.ANY, predicate, object);
	while(it.hasNext()) {
		results.add(it.next().getSubject());
	}
	return results;
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:9,代码来源:JenaNodeUtil.java

示例11: addGroupProperties

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private void addGroupProperties(Node nodeShape, Graph graph, Node systemPredicate) {
	ExtendedIterator<Triple> it = graph.find(nodeShape, systemPredicate, Node.ANY);
	while(it.hasNext()) {
		Node propertyShape = it.next().getObject();
		if(!graph.contains(propertyShape, SH.deactivated.asNode(), JenaDatatypes.TRUE.asNode())) {
			Node group = JenaNodeUtil.getObject(propertyShape, SH.group.asNode(), graph);
			if(group != null) {
				Node path = JenaNodeUtil.getObject(propertyShape, SH.path.asNode(), graph);
				if(path != null) {
					Set<PathMetadata> paths = groupPaths.get(group);
					if(paths == null) {
						paths = new HashSet<>();
						groupPaths.put(group, paths);
					}
					if(path.isURI()) {
						paths.add(new PathMetadata(path, false));
					}
					else {
						Node inverse = JenaNodeUtil.getObject(path, SH.inversePath.asNode(), graph);
						if(inverse != null && inverse.isURI()) {
							paths.add(new PathMetadata(inverse, true));
						}
					}
				}
			}
		}
	}
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:29,代码来源:ClassMetadata.java

示例12: getSuperClasses

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public synchronized Iterable<ClassMetadata> getSuperClasses(Graph graph) {
	if(superClasses == null) {
		superClasses = new LinkedList<>();
		ExtendedIterator<Triple> it = graph.find(classNode, RDFS.subClassOf.asNode(), Node.ANY);
		while(it.hasNext()) {
			Node superClass = it.next().getObject();
			superClasses.add(OntologyOptimizations.get().getClassMetadata(superClass, graph, graphKey));
		}
	}
	return superClasses;
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:12,代码来源:ClassMetadata.java

示例13: init

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
@Override
public void init(ClassPropertyMetadata cpm, Node classNode, Graph graph) {
	ExtendedIterator<Triple> it = graph.find(classNode, RDFS.subClassOf.asNode(), Node.ANY);
	while(it.hasNext()) {
		Node superClass = it.next().getObject();
		if(superClass.isBlank() && graph.contains(superClass, OWL.onProperty.asNode(), cpm.getPredicate())) {
			if(cpm.getLocalRange() == null) {
				Node localRange = JenaNodeUtil.getObject(superClass, OWL.allValuesFrom.asNode(), graph);
				if(localRange != null) {
					cpm.setLocalRange(localRange);
					it.close();
					break;
				}
			}
			if(cpm.getMaxCount() == null) {
				Node maxCountNode = JenaNodeUtil.getObject(superClass, OWL.maxCardinality.asNode(), graph);
				if(maxCountNode == null) {
					maxCountNode = JenaNodeUtil.getObject(superClass, OWL.cardinality.asNode(), graph);
				}
				if(maxCountNode != null && maxCountNode.isLiteral()) {
					Object value = maxCountNode.getLiteralValue();
					if(value instanceof Number) {
						cpm.setMaxCount(((Number) value).intValue());
					}
				}
			}
		}
	}
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:30,代码来源:OWLClassPropertyMetadataPlugin.java

示例14: addSuperParameters

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
protected Map<Property, Parameter> addSuperParameters(Template template, Map<Property, Parameter> args)
{
    if (template == null) throw new IllegalArgumentException("Template Set cannot be null");        
    if (args == null) throw new IllegalArgumentException("Parameter Map cannot be null");        
    
    ExtendedIterator<OntClass> superIt = template.listSuperClasses();
    try
    {
        while (superIt.hasNext())
        {
            OntClass superClass = superIt.next();
            if (superClass.canAs(Template.class))
            {
                Template superTemplate = superClass.as(Template.class);
                Map<Property, Parameter> superArgs = superTemplate.getLocalParameters();
                Iterator<Entry<Property, Parameter>> entryIt = superArgs.entrySet().iterator();
                while (entryIt.hasNext())
                {
                    Entry<Property, Parameter> entry = entryIt.next();
                    args.putIfAbsent(entry.getKey(), entry.getValue()); // reject Parameters for existing predicates
                }
                
                addSuperParameters(superTemplate, args);  // recursion to super class
            }
        }
    }
    finally
    {
        superIt.close();
    }

    return args;
}
 
开发者ID:AtomGraph,项目名称:Processor,代码行数:34,代码来源:TemplateImpl.java

示例15: getLanguages

import org.apache.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
protected List<Locale> getLanguages(Property property)
{
    if (property == null) throw new IllegalArgumentException("Property cannot be null");
    
    List<Locale> languages = new ArrayList<>();
    Resource langs = getPropertyResourceValue(property);
    if (langs != null)
    {
        if (!langs.canAs(RDFList.class))
        {
            if (log.isErrorEnabled()) log.error("ldt:lang value is not an rdf:List on template '{}'", getURI());
            throw new OntologyException("ldt:lang value is not an rdf:List on template  '" + getURI() +"'");
        }

        // could use list order as priority (quality value q=)
        RDFList list = langs.as(RDFList.class);
        ExtendedIterator<RDFNode> it = list.iterator();
        try
        {
            while (it.hasNext())
            {
                RDFNode langTag = it.next();
                if (!langTag.isLiteral())
                {
                    if (log.isErrorEnabled()) log.error("Non-literal language tag (ldt:lang member) on template '{}'", getURI());
                    throw new OntologyException("Non-literal language tag (ldt:lang member) on template '" + getURI() +"'");
                }

                languages.add(Locale.forLanguageTag(langTag.asLiteral().getString()));
            }
        }
        finally
        {
            it.close();
        }
    }
    
    return languages;
}
 
开发者ID:AtomGraph,项目名称:Processor,代码行数:40,代码来源:TemplateImpl.java


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