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


Java ExtendedIterator类代码示例

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


ExtendedIterator类属于org.apache.jena.util.iterator包,在下文中一共展示了ExtendedIterator类的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: toXML

import org.apache.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
public boolean toXML(Element e, RDFNode rdf, Context ctx) {
	boolean ok =true;
	try {
		schema xsd = (schema) this.get_owner();
		simpleType t = get_type(ctx);
		String type = null;
		if (t==null) type = expandQName(ctx.getDefaultNS(),itemType, ctx.getModel());

		RDFList list = (RDFList) rdf.as(RDFList.class);
		String pack = null;
		for (ExtendedIterator i = list.iterator(); ok && i.hasNext(); ) {
			RDFNode n = (RDFNode) i.next();	
			if (t!=null) ok=t.toXML(e,n,pack,ctx);
			else ok=xsd.toXMLText(e,n,type,pack,ctx);
			pack = " "; // whitespace separator
		}
	} catch (Exception ex) { // non-fatal
		Gloze.logger.warn("failed to list value");
	}
	return ok;
}
 
开发者ID:stevebattle,项目名称:Gloze,代码行数:22,代码来源:list.java

示例5: toXMLText

import org.apache.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
public boolean toXMLText(Element element, RDFNode rdf, String type, String pack, Context ctx) {
	String v;
	Document doc = element.getOwnerDocument();
	
	simpleType s = ctx.getSimpleType(type);
	if (s!=null) return s.toXML(element,rdf,pack,ctx);

	if (type!=null && type.equals(XSD_URI+"#IDREFS") && rdf instanceof Resource
			&& ((Resource)rdf).hasProperty(RDF.first)
			&& rdf.canAs(RDFList.class)) {
		RDFList l = (RDFList) rdf.as(RDFList.class);
		for (ExtendedIterator i=l.iterator(); i.hasNext();) {
			v = toXMLValue(element, (RDFNode) i.next(), XSD.IDREF.getURI(), ctx);
			if (v==null) return false; // failed for this type
			element.appendChild(doc.createTextNode(pack==null?v:pack+v));
			pack = " ";
		}
		return true;
	}
	String val = toXMLValue(element, rdf, type, ctx);
	if (val!=null) {
		element.appendChild(doc.createTextNode(pack==null?val:pack+val));
		return true;
	}
	return false;
}
 
开发者ID:stevebattle,项目名称:Gloze,代码行数:27,代码来源:schema.java

示例6: graphBaseFind

import org.apache.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
@Override
    protected ExtendedIterator<Triple> graphBaseFind(Triple m) {
        try{
            LinkedDataFragment ldf = ldfClient.getFragment(ldfClient.getBaseFragment(), m);
//            ExtendedIterator<Triple> triples = ldf.getTriples();
//            Iterator<LinkedDataFragment> ldfIterator = LinkedDataFragmentIterator.create(ldf, ldfClient);
//            while(ldfIterator.hasNext()) {
//                ldf = ldfIterator.next();
//                triples = triples.andThen(ldf.getTriples());
//            }
            ExtendedIterator<Triple> triples = ExtendedTripleIteratorLDF.create(ldfClient, ldf);
            return triples;
        } catch(Exception e) {
            e.printStackTrace();
            return WrappedIterator.emptyIterator(); //Do not block on error but return empty iterator
        }
    }
 
开发者ID:LinkedDataFragments,项目名称:Client.Java,代码行数:18,代码来源:LinkedDataFragmentGraph.java

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

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

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

示例10: testLastModified

import org.apache.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
@Test
public void testLastModified() throws RepositoryException {
    final String pid = getRandomPid();
    containerService.findOrCreate(session, "/" + pid);

    try {
        session.commit();
    } finally {
        session.expire();
    }

    session = repo.login();

    final Container obj2 = containerService.findOrCreate(session, "/" + pid);
    final Instant created = roundDate(obj2.getCreatedDate());
    final Instant modified = roundDate(obj2.getLastModifiedDate());
    assertFalse(modified + " should not be before " + created, modified.isBefore(created));

    final Graph graph = obj2.getTriples(subjects, PROPERTIES).collect(toModel()).getGraph();
    final Node s = createGraphSubjectNode(obj2);
    final ExtendedIterator<Triple> iter = graph.find(s, LAST_MODIFIED_DATE.asNode(), ANY);
    assertEquals("Should have one lastModified triple", 1, iter.toList().size());
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:24,代码来源:FedoraResourceImplIT.java

示例11: importTripleShouldAddAPropertyToTheExistingEntity

import org.apache.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
@Test
public void importTripleShouldAddAPropertyToTheExistingEntity() throws Exception {
  final String tripleString = ABADAN_POINT_TRIPLE + "\n" + ABADAN_LAT_TRIPLE;
  final ExtendedIterator<Triple> tripleExtendedIterator = createTripleIterator(tripleString);

  instance.importTriple(true, tripleExtendedIterator.next());
  instance.importTriple(true, tripleExtendedIterator.next());
  rdfImportSession.commit();
  rdfImportSession.close();

  Optional<ReadEntity> entityOpt = getReadEntity(DEFAULT_COLLECTION_NAME, ABADAN_URI);
  assertThat(entityOpt.get().getProperties(), containsInAnyOrder(
    allOf(hasProperty("name", equalTo("point")), hasProperty("value", equalTo("30.35 48.28333333333333"))),
    allOf(hasProperty("name", equalTo("lat")), hasProperty("value", equalTo("30.35")))
  ));
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:17,代码来源:TripleImporterIntegrationTest.java

示例12: importTripleShouldMapToARelationBetweenTheNewSubjectAndANewObject

import org.apache.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
@Test
public void importTripleShouldMapToARelationBetweenTheNewSubjectAndANewObject() throws Exception {
  final String tripleString = ABADAN_IS_PART_OF_IRAN_TRIPLE;
  final ExtendedIterator<Triple> tripleExtendedIterator = createTripleIterator(tripleString);

  instance.importTriple(true, tripleExtendedIterator.next());
  rdfImportSession.commit();
  rdfImportSession.close();

  Optional<ReadEntity> abadanOpt = getReadEntity(DEFAULT_COLLECTION_NAME, ABADAN_URI);
  assertThat(abadanOpt, is(present()));
  assertThat(abadanOpt.get().getRelations(), hasItem(
    allOf(
      hasProperty("entityAlternativeUris", is(new String[] {IRAN_URI})),
      hasProperty("relationRdfUri", equalTo(IS_PART_OF_URI))
    )
  ));
  Optional<ReadEntity> iranOpt = getReadEntity(DEFAULT_COLLECTION_NAME, IRAN_URI);
  assertThat(iranOpt, is(present()));
  assertThat(iranOpt.get().getRelations(), hasItem(
    allOf(
      hasProperty("entityAlternativeUris", is(new String[] {ABADAN_URI})),
      hasProperty("relationRdfUri", equalTo(IS_PART_OF_URI))
    )
  ));
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:27,代码来源:TripleImporterIntegrationTest.java

示例13: importTripleShouldAddTheSystemPropertiesToANewRelation

import org.apache.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
@Test
public void importTripleShouldAddTheSystemPropertiesToANewRelation() throws Exception {
  final String tripleString = ABADAN_IS_PART_OF_IRAN_TRIPLE;
  final ExtendedIterator<Triple> tripleExtendedIterator = createTripleIterator(tripleString);

  instance.importTriple(true, tripleExtendedIterator.next());
  rdfImportSession.commit();
  rdfImportSession.close();

  Optional<ReadEntity> readEntity = getReadEntity(DEFAULT_COLLECTION_NAME, ABADAN_URI);
  assertThat(readEntity.get().getRelations().get(0), allOf(
    hasProperty("relationRev", equalTo(1)),
    hasProperty("relationAccepted", equalTo(true)),
    hasProperty("relationRdfUri", equalTo(IS_PART_OF_URI)),
    hasProperty("relationId", notNullValue())
  ));
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:18,代码来源:TripleImporterIntegrationTest.java

示例14: importTripleShouldAddTheSystemPropertiesToANewEntity

import org.apache.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
@Test
public void importTripleShouldAddTheSystemPropertiesToANewEntity() throws Exception {
  final String tripleString = ABADAN_IS_PART_OF_IRAN_TRIPLE;
  final ExtendedIterator<Triple> tripleExtendedIterator = createTripleIterator(tripleString);

  instance.importTriple(true, tripleExtendedIterator.next());
  rdfImportSession.commit();
  rdfImportSession.close();

  Optional<ReadEntity> entityOpt = getReadEntity(DEFAULT_COLLECTION_NAME, ABADAN_URI);
  assertThat(entityOpt.get(), allOf(
    hasProperty("rev", equalTo(1)),
    hasProperty("deleted", equalTo(false)),
    hasProperty("id", notNullValue()),
    hasProperty("created", notNullValue()),
    hasProperty("modified", notNullValue())
  ));
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:19,代码来源:TripleImporterIntegrationTest.java

示例15: createIterator

import org.apache.jena.util.iterator.ExtendedIterator; //导入依赖的package包/类
private Iterator<Node> createIterator() {
    Model model = core.getGraphModel(kbId.getId());
    Graph g = model.getGraph();
    ExtendedIterator<Triple> exIt = g.find(Node.ANY, null, null);
    ExtendedIterator<Node> subjIt = exIt.mapWith(Triple::getSubject);
    exIt = g.find(null, null, Node.ANY);
    ExtendedIterator<Node> objIt = exIt.mapWith(Triple::getObject);
    return Iterators.concat(subjIt, objIt);
}
 
开发者ID:Lambda-3,项目名称:Stargraph,代码行数:10,代码来源:EntityIterator.java


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