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


Java NodeIterator.next方法代码示例

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


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

示例1: getScope

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
/**
 * Finds all RTM_IN_SCOPE properties for this property and returns a
 * collection containing the RDF URIs of the values as URILocators.
 */
private Collection getScope(RDFNode rdfprop, Model model)
  throws JenaException, MalformedURLException {

  Resource subject = (Resource) rdfprop;
  Property prop = model.getProperty(RTM_IN_SCOPE);
  NodeIterator it = model.listObjectsOfProperty(subject, prop);
  ArrayList scope = new ArrayList();

  while (it.hasNext()) {
    Object o = it.next();

    if (!(o instanceof Resource))
      throw new RDFMappingException("Scoping topic must be specified by a resource, not by " + o);

    Resource obj = (Resource) o;
    LocatorIF loc = new URILocator(obj.getURI());
    scope.add(loc);
  }

  return scope;
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:26,代码来源:RDFToTopicMapConverter.java

示例2: getType

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
private TopicIF getType(RDFNode rdfprop, Model model)
  throws JenaException, MalformedURLException {

  Resource subject = (Resource) rdfprop;
  Property prop = model.getProperty(RTM_TYPE);
  NodeIterator it = model.listObjectsOfProperty(subject, prop);
  while (it.hasNext()) {
    Resource obj = (Resource) it.next();
    LocatorIF loc = new URILocator(obj.getURI());
    TopicIF topic = topicmap.getTopicBySubjectIdentifier(loc);
    if (topic == null) {
      topic = builder.makeTopic();
      topic.addSubjectIdentifier(loc);
    }
    return topic;
  }
  return null;
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:19,代码来源:RDFToTopicMapConverter.java

示例3: getVariables

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
private List<String> getVariables(Model model, Resource service_resource) {
	
	Property has_variable_property = model.getProperty(Namespaces.KARMA + "hasVariable");

	List<String> variables = new ArrayList<String>();
	NodeIterator nodeIterator = null;
	RDFNode node = null;

	// hasAttribute
	nodeIterator = model.listObjectsOfProperty(service_resource, has_variable_property);
	while ( nodeIterator.hasNext()) {
		node = nodeIterator.next();
		
		if (!node.isResource()) {
			logger.info("object of the hasAttribute property is not a resource.");
			continue;
		}
		
		variables.add(node.asResource().getLocalName());
	}
	
	return variables;

}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:25,代码来源:WebServiceLoader.java

示例4: generateQuadQualityProblem

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
@Test
public void generateQuadQualityProblem(){
	qr = new QualityReport();
	
	String qualityProblemURI = qr.createQualityProblem(metricURI, quadProblemList);
	Model qualityProblem = qr.getProblemReportFromTBD(qualityProblemURI);
	
	// checks if model contains appropriate data 
	assertEquals(14, qualityProblem.size()); 
	
	assertTrue(qualityProblem.listStatements(null, RDF.type, QPRO.QualityProblem).hasNext());
	assertTrue(qualityProblem.listStatements(null, QPRO.isDescribedBy, metricURI).hasNext());
	
	NodeIterator objects = qualityProblem.listObjectsOfProperty(QPRO.problematicThing);
	assertTrue(objects.hasNext());
	
	RDFNode _node = objects.next();
	assertTrue(_node.asNode().isBlank());
	
	assertTrue(qualityProblem.listStatements(_node.asResource(), RDF.type, RDF.Statement).hasNext());
	assertTrue(qualityProblem.listStatements(_node.asResource(), RDF.subject, (RDFNode) null).hasNext());
	assertTrue(qualityProblem.listStatements(_node.asResource(), RDF.predicate, RDFS.label).hasNext());
	assertTrue(qualityProblem.listStatements(_node.asResource(), RDF.object, (RDFNode) null).hasNext());
	
	qr.flush();
}
 
开发者ID:EIS-Bonn,项目名称:Luzzu,代码行数:27,代码来源:QualityReportTest.java

示例5: createInstances

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
@Override
public Model createInstances(Model model) throws ProcessingException, InvalidRequestException {

	Model createdInstancesModel = super.createInstances(model);
	LOGGER.warning("createInstances override method.");

	String topologyUri = null;

	NodeIterator objects = model.listObjectsOfProperty(Omn.isResourceOf);
	if (objects.hasNext()) {
		RDFNode object = objects.next();
		topologyUri = object.asResource().getURI();
	}


	return createdInstancesModel;
}
 
开发者ID:FITeagle,项目名称:adapters,代码行数:18,代码来源:OpenBatonAdapter.java

示例6: getAllTypes

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
public static Set<String> getAllTypes(Model model, String typePrefix) {
    Resource rootResource = model.createResource(typePrefix);

    com.hp.hpl.jena.rdf.model.Property classProperty = model.createProperty("http://dblab.cs.toronto.edu/project/xcurator/0.1#classes");
    Bag classBag = model.createBag("http://dblab.cs.toronto.edu/project/xcurator/0.1#classBag");
    model.add(rootResource, classProperty, classBag);

    Set<String> ret = new HashSet<String>();

    NodeIterator iterator = classBag.iterator();
    while (iterator.hasNext()) {
        Resource resource = (Resource) iterator.next();
        ret.add(resource.getURI());
    }

    return ret;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:18,代码来源:Mapping.java

示例7: getTopicIndicator

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
private LocatorIF getTopicIndicator(Resource subject, String property,
                                    Model model)
  throws JenaException, MalformedURLException {
  Property prop = model.getProperty(property);
  NodeIterator it = model.listObjectsOfProperty(subject, prop);
  while (it.hasNext()) {
    Resource obj = (Resource) it.next();
    if (obj.isAnon())
      continue; // FIXME: is this really ok?
    return new URILocator(obj.getURI());
  }
  return null;
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:14,代码来源:RDFToTopicMapConverter.java

示例8: getLiteralObject

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
protected static Literal getLiteralObject(final Resource s, final Property p) {
  final NodeIterator nodes = s.getModel().listObjectsOfProperty(s, p);
  if (nodes.hasNext()) {
    final RDFNode node = nodes.next();
    if (node.isLiteral()) {
      return node.asLiteral();
    }
  }
  return null;
}
 
开发者ID:ewie,项目名称:cobalt,代码行数:11,代码来源:ResourceInternalizer.java

示例9: addInstancePropertyValue

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的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

示例10: correctObservationStructure

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
@Test
public void correctObservationStructure(){
	this.setQualityGraphURI();
	Model _qualityGraph = _dataset.getNamedModel(this.qualityGraphURI.getURI());
	NodeIterator iter = _qualityGraph.listObjectsOfProperty(this.metricURI, DAQ.hasObservation);
	while (iter.hasNext()){
		RDFNode node = iter.next();
		assertTrue(_qualityGraph.contains(node.asResource(), RDF.type, DAQ.Observation));
		assertTrue(_qualityGraph.contains(node.asResource(), DAQ.computedOn, this.computedOn));
		assertTrue(_qualityGraph.contains(node.asResource(), SDMXDIMENSION.timePeriod));
		assertTrue(_qualityGraph.contains(node.asResource(), DAQ.value));
		assertTrue(_qualityGraph.contains(node.asResource(), DAQ.metric, this.metricURI));
		assertTrue(_qualityGraph.contains(node.asResource(), CUBE.dataSet, this.qualityGraphURI));
	}
}
 
开发者ID:EIS-Bonn,项目名称:Luzzu,代码行数:16,代码来源:QualityMetadataTest.java

示例11: getRequestedDiskImageUri

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
private String getRequestedDiskImageUri(Resource requestedVM) {
    NodeIterator stmtIterator = requestedVM.getModel().listObjectsOfProperty(Omn_domain_pc.hasDiskimageLabel);
    String requestedType = null;
    while (stmtIterator.hasNext()){
      RDFNode statement = stmtIterator.next();
      String one = statement.asLiteral().getString();
//      boolean isNode =  one.equals(Omn_resource.Node);
//      if(!isNode){
//        requestedType = statement.getObject().asResource().getURI();
//        break;
//      }
      return one;
    }
    return null;
  }
 
开发者ID:FITeagle,项目名称:adapters,代码行数:16,代码来源:OpenstackAdapter.java

示例12: isItemInMarkupItem

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
private boolean isItemInMarkupItem(Resource item, Set<Resource> visitedItems) {
	if (!visitedItems.contains(item)) {
		visitedItems.add(item);
		
		Set<Resource> subjects = model.listResourcesWithProperty(pitem_r, item).toSet();
		subjects.addAll(model.listResourcesWithProperty(pfirstitem_r, item).toSet());
		subjects.addAll(model.listResourcesWithProperty(plastitem_r, item).toSet());
		Iterator<Resource> subjectsIte = subjects.iterator();
		while (subjectsIte.hasNext()) {
			Resource resource = subjectsIte.next();
			if (
					visited.contains(resource) && 
					document.getEntityById(resource.getURI()) instanceof MarkupItem) {
				return true;
			}
		}
		
		Set<Resource> objects = model.listResourcesWithProperty(pnextitem_r, item).toSet();
		NodeIterator nodes = model.listObjectsOfProperty(item, ppreviousitem_r);
		while (nodes.hasNext()) {
			RDFNode node = nodes.next();
			if (node.isResource()) {
				objects.add((Resource) node);
			}
		}
		Iterator<Resource> objectsIte = objects.iterator();
		while (objectsIte.hasNext()) {
			if (isItemInMarkupItem(objectsIte.next(), visitedItems)) {
				return true;
			}
		}
	}
	
	return false;
}
 
开发者ID:essepuntato,项目名称:EarmarkDataStructure,代码行数:36,代码来源:JenaReader.java

示例13: addHigherIncludedDolceClass

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
protected static void addHigherIncludedDolceClass(Set<Resource> classes, Model dolceClassModel,
        Set<Resource> unlinkedDolceClasses) {
    Queue<Resource> queue = new LinkedList<Resource>(classes);
    Resource classResource, superClass, subClass;
    RDFNode node;
    NodeIterator nodeIterator;
    ResIterator resIterator;
    boolean addClass;
    while (!queue.isEmpty()) {
        classResource = queue.poll();
        if (dolceClassModel.containsResource(classResource)) {
            nodeIterator = dolceClassModel.listObjectsOfProperty(classResource, RDFS.subClassOf);
            while (nodeIterator.hasNext()) {
                node = nodeIterator.next();
                if (node.isResource()) {
                    superClass = node.asResource();
                    // get all sub classes of this class
                    resIterator = dolceClassModel.listSubjectsWithProperty(RDFS.subClassOf, superClass);
                    addClass = true;
                    // Check that all sub classes of this super class are
                    // already in
                    // the list of classes or are marked as unlinked classes
                    while (resIterator.hasNext() && addClass) {
                        subClass = resIterator.next();
                        addClass = classes.contains(subClass) || unlinkedDolceClasses.contains(subClass);
                    }
                    if (addClass) {
                        classes.add(superClass);
                        queue.add(superClass);
                        if (LOGGER.isDebugEnabled()) {
                            LOGGER.debug("Added " + superClass.getURI());
                        }
                    }
                } else {
                    LOGGER.error("Expected a resource in the statement (" + classResource + ", rdfs:subClassOf, "
                            + node + "). Ignoring this statement.");
                }
            }
        }
    }
}
 
开发者ID:dice-group,项目名称:Cetus,代码行数:42,代码来源:YagoBasedTypeSearcher.java

示例14: searchDolceSuperClasses

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
protected void searchDolceSuperClasses(Set<Resource> types) {
    Queue<Resource> queue = new LinkedList<Resource>(types);
    Resource classResource, superClass;
    RDFNode node;
    NodeIterator nodeIterator;
    Set<Resource> yagoSuperClasses = new HashSet<Resource>();
    Set<Resource> dolceSuperClasses = new HashSet<Resource>();
    boolean dolceClassFound = false;
    while (!queue.isEmpty()) {
        classResource = queue.poll();
        // If this resource is a DOLCE resource
        if (dolceClassModel.containsResource(classResource)) {
            dolceClassFound = true;
        } else {
            nodeIterator = classesModel.listObjectsOfProperty(classResource, RDFS.subClassOf);
            yagoSuperClasses.clear();
            dolceSuperClasses.clear();
            while (nodeIterator.hasNext()) {
                node = nodeIterator.next();
                if (node.isResource()) {
                    superClass = node.asResource();
                    if (dolceClassModel.containsResource(superClass)) {
                        dolceSuperClasses.add(superClass);
                    } else {
                        yagoSuperClasses.add(superClass);
                    }
                } else {
                    LOGGER.error("Expected a resource in the statement (" + classResource + ", rdfs:subClassOf, "
                            + node + "). Ignoring this statement.");
                }
            }

            // If a DOLCE class has been found
            if (dolceSuperClasses.size() > 0) {
                // add only the DOLCE classes and discard all others
                types.addAll(dolceSuperClasses);
                dolceClassFound = true;
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Added super classes of " + classResource.getURI() + " --> "
                            + Arrays.toString(dolceSuperClasses.toArray()));
                }
            } else {
                for (Resource r : yagoSuperClasses) {
                    // If they have not been found before (and already have
                    // been
                    // added to the queue)
                    if (!types.contains(r)) {
                        types.add(r);
                        queue.add(r);
                    }
                    if (LOGGER.isDebugEnabled()) {
                        LOGGER.debug("Added super classes of " + classResource.getURI() + " --> "
                                + Arrays.toString(yagoSuperClasses.toArray()));
                    }
                }
            }
        }
    }
    if (!dolceClassFound) {
        LOGGER.warn(
                "Couldn't find a DOLCE class for the following list of types: " + Arrays.toString(types.toArray()));
    }
}
 
开发者ID:dice-group,项目名称:Cetus,代码行数:64,代码来源:YagoBasedTypeSearcher.java

示例15: getAttributes

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入方法依赖的package包/类
private List<Attribute> getAttributes(Model model, Resource io_resource, String ioType) {
	
	Property has_attribute_property = model.getProperty(Namespaces.KARMA + "hasAttribute");
	Property has_mandatory_attribute_property = model.getProperty(Namespaces.KARMA + "hasMandatoryAttribute");
	Property has_optional_attribute_property = model.getProperty(Namespaces.KARMA + "hasOptionalAttribute");

	List<Attribute> attList = new ArrayList<Attribute>();
	
	NodeIterator nodeIterator = null;
	RDFNode node = null;

	// hasAttribute
	nodeIterator = model.listObjectsOfProperty(io_resource, has_attribute_property);
	while ( nodeIterator.hasNext()) {
		node = nodeIterator.next();
		
		if (!node.isResource()) {
			logger.info("object of the hasAttribute property is not a resource.");
			continue;
		}
		
		attList.add(getAttribute(model, node.asResource(), ioType, AttributeRequirement.NONE));
	}

	// hasMandatoryAttribute
	nodeIterator = model.listObjectsOfProperty(io_resource, has_mandatory_attribute_property);
	while ( nodeIterator.hasNext()) {
		node = nodeIterator.next();
		
		if (!node.isResource()) {
			logger.info("object of the hasMandatoryAttribute property is not a resource.");
			continue;
		}
		
		attList.add(getAttribute(model, node.asResource(), ioType, AttributeRequirement.MANDATORY));
	}
	
	// hasOptionalAttribute
	nodeIterator = model.listObjectsOfProperty(io_resource, has_optional_attribute_property);
	while ( nodeIterator.hasNext()) {
		node = nodeIterator.next();
		
		if (!node.isResource()) {
			logger.info("object of the hasOptionalAttribute property is not a resource.");
			continue;
		}
		
		attList.add(getAttribute(model, node.asResource(), ioType, AttributeRequirement.OPTIONAL));
	}
	
	return attList;

}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:54,代码来源:WebServiceLoader.java


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