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


Java NodeIterator类代码示例

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


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

示例1: getName

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入依赖的package包/类
@Override
public String getName() {
  NodeIterator ni;
  try {
    ni = KBObjectImpl.getBaseContextModel().listObjectsOfProperty(
            ((Individual)((VariableImpl)this).getCore()),
            (OntProperty)((KBPredicateImpl)Constants.getInstance().RIF_VARNAME_PRED).getCore());
    if (ni.hasNext()) {
    return ni.next().asLiteral().getString();
  }
  } catch (Exception ex) {
    Logger.getLogger(VariableImpl.class.getName()).log(Level.SEVERE, null, ex);
  }
  return "";
  
}
 
开发者ID:vijayrajak,项目名称:JenaKBClient,代码行数:17,代码来源:VariableImpl.java

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

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

示例4: createSubjectMaps

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入依赖的package包/类
private List<Resource> createSubjectMaps(Resource mappingResource, KR2RMLMapping kr2rmlMapping) throws JSONException {
	List<Resource> subjectMapResources = new ArrayList<Resource>();
	Property hasTrMapUri = model.getProperty(Uris.KM_HAS_TRIPLES_MAP_URI);
	
	// Get all the triple maps
	NodeIterator trMapsResItr = model.listObjectsOfProperty(mappingResource, hasTrMapUri);
	while (trMapsResItr.hasNext()) {
		Resource trMapRes = trMapsResItr.next().asResource();
		SubjectMap subjMap = addSubjectMapForTripleMap(trMapRes, kr2rmlMapping, subjectMapResources);
		
		// Add the Triples map
		TriplesMap trMap = new TriplesMap(trMapRes.getURI(), subjMap);
		kr2rmlMapping.getTriplesMapIndex().put(trMapRes.getURI(), trMap);
		kr2rmlMapping.addTriplesMap(trMap);
		kr2rmlMapping.getAuxInfo().getTriplesMapGraph().addTriplesMap(trMap);
	}
	return subjectMapResources;
}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:19,代码来源:WorksheetR2RMLJenaModelParser.java

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

示例6: test_buildTblToTM_1

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入依赖的package包/类
@Test
public void test_buildTblToTM_1() {
    Model r2rml = readR2RML(r2rml1);
    R2RMLSpec spec = new R2RMLSpec(r2rml);

    Resource expectedTMSubject = ResourceFactory.createResource(prefix + "TriplesMap1");
    NodeIterator tmpRes = r2rml.listObjectsOfProperty(expectedTMSubject, RR.logicalTable);
    Resource expectedTblSubject = tmpRes.next().asResource();
    LogicalTable logTbl = new LogicalTable(r2rml, expectedTblSubject);
    Pair<LogicalTable, TriplesMap> expectedLtTm =
            new Pair<LogicalTable, TriplesMap>(
                    logTbl, new TriplesMap(r2rml, expectedTMSubject));
    int expectedNumLtTmEntries = 1;

    Map<LogicalTable, Collection<TriplesMap>> tableToTMs =
            R2RML2SMLConverter.buildTblToTM(spec);
    assertEquals(expectedNumLtTmEntries, tableToTMs.size());
    assertEquals(expectedNumLtTmEntries, tableToTMs.keySet().size());
    Set<LogicalTable> tbls = tableToTMs.keySet();
    assertTrue(tbls.contains(expectedLtTm.first));
    Collection<TriplesMap> triplesMaps = tableToTMs.get(logTbl);
    assertTrue(triplesMaps.contains(expectedLtTm.second));
}
 
开发者ID:AKSW,项目名称:sml-converters,代码行数:24,代码来源:R2RML2SMLConverterTest.java

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

示例8: NetworkingAdapter

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入依赖的package包/类
public NetworkingAdapter(Model adapterModel, Resource adapterABox) {
this.uuid = UUID.randomUUID().toString();
this.adapterTBox = adapterModel;
this.adapterABox = adapterABox;
Resource adapterType =getAdapterClass();
this.adapterABox.addProperty(RDF.type,adapterType);
this.adapterABox.addProperty(RDFS.label,  this.adapterABox.getLocalName());
this.adapterABox.addProperty(RDFS.comment, "A networking adapter that can create virtual link among resources.");

NodeIterator resourceIterator = this.adapterTBox.listObjectsOfProperty(Omn_lifecycle.implements_);
if (resourceIterator.hasNext()) {
    Resource resource = resourceIterator.next().asResource();

    this.adapterABox.addProperty(Omn_lifecycle.canImplement, resource);
    this.adapterABox.getModel().add(resource.getModel());
    ResIterator propertiesIterator = adapterTBox.listSubjectsWithProperty(RDFS.domain, resource);
    while (propertiesIterator.hasNext()) {
        Property p = adapterTBox.getProperty(propertiesIterator.next().getURI());
        networkingControlProperties.add(p);
    }
}
}
 
开发者ID:FITeagle,项目名称:adapters,代码行数:23,代码来源:NetworkingAdapter.java

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

示例10: setValue

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
    public <T> void setValue(T value, Type valueType)
    {
        if (_statement != null)
        {
            if (valueType instanceof Class<?>)
                setValue(_statement, value, (Class<T>) valueType);
            else if (valueType instanceof ParameterizedType)
            {
                ParameterizedType parameterizedType = (ParameterizedType) valueType;

                if (parameterizedType.getRawType().equals(List.class) && (parameterizedType.getActualTypeArguments().length == 1))
                {
                    Type actualTypeArgument = parameterizedType.getActualTypeArguments()[0];

                    List<Object> list        = new LinkedList<Object>();
                    NodeIterator bagIterator = _statement.getBag().iterator();
                    // TODO
//                    while (bagIterator.hasNext())
//                        setValue(bagIterator.next(), (Class<?>) actualTypeArgument));
                }
            }
        }
    }
 
开发者ID:RISBIC,项目名称:DataBroker,代码行数:25,代码来源:RDFMutableMetadataStatement.java

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

示例12: checkPrecedence

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入依赖的package包/类
public static boolean checkPrecedence(CompanyModel c) {

		StmtIterator stmtit = c.getModel().listStatements(
				new SimpleSelector(null, c.DEPTS, (RDFNode) null));

		List<Resource> depts = new LinkedList<Resource>();

		while (stmtit.hasNext()) {
			NodeIterator subDeptsIt = stmtit.next().getBag().iterator();
			while (subDeptsIt.hasNext())
				depts.add(subDeptsIt.next().asResource());
		}
		for (Resource dept : depts) {
			// get manager's salary
			double managerSalary = dept.getProperty(c.MANAGER).getProperty(
					c.SALARY).getDouble();
			NodeIterator employeeIt = dept.getProperty(c.EMPLOYEES).getBag()
					.iterator();
			while (employeeIt.hasNext())
				if (!(employeeIt.next().asResource().getProperty(c.SALARY)
						.getDouble() < managerSalary))
					return false;
		}

		return true;

	}
 
开发者ID:amritbhat786,项目名称:DocIT,代码行数:28,代码来源:Precedence.java

示例13: getAllExcludes

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入依赖的package包/类
/**
 * exclude these words when enhancing.
 *
 * @param ocls
 * @param additionalExcludes
 * @return
 */
public List<String> getAllExcludes(OntClass ocls, String... additionalExcludes) {
    List<String> excludeList = new ArrayList<String>(5);

    AnnotationProperty apExclude = model.getAnnotationProperty(NS + "synExcludes");    //to add synExcludes  to list
    AnnotationProperty apSyn = model.getAnnotationProperty(NS + SynSuggestion.TYPE_SynInclude);// to add slreeady added synIncludes
    AnnotationProperty apAsso = PO.AP_ASSOCIATON;

    //add all additionalExcludes
    if (additionalExcludes != null) {
        for (int i = 0; i < additionalExcludes.length; i++) {
            additionalExcludes[i] = additionalExcludes[i].toLowerCase();
        }
        Collections.addAll(excludeList, additionalExcludes);
    }
    // add syn excludes
    NodeIterator itrExcludes = ocls.listPropertyValues(apExclude);
    while (itrExcludes.hasNext()) {
        String synExs = itrExcludes.next().asLiteral().getLexicalForm();
        String synEx[] = synExs.split(",");
        for (int i = 0; i < synEx.length; i++) {
            synEx[i] = synEx[i].trim();
        }
        Collections.addAll(excludeList, synEx);
    }
    // add synIncludes
    NodeIterator itrSyn = ocls.listPropertyValues(apSyn);    // add to exclude list, already added synonyms also
    while (itrSyn.hasNext()) {
        excludeList.add(itrSyn.next().asLiteral().getLexicalForm());
    }
    //add association
    NodeIterator itrAsso = ocls.listPropertyValues(apAsso);
    while (itrAsso.hasNext()) {
        excludeList.add(itrAsso.next().asLiteral().getLexicalForm());
    }

    logger.debug("exclude list:" + excludeList);
    return excludeList;
}
 
开发者ID:sasinda,项目名称:OntologyBasedInormationExtractor,代码行数:46,代码来源:LinguisticEnhancer.java

示例14: getAssociations

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入依赖的package包/类
public List<String> getAssociations() {
    List<String> associations = associations = new ArrayList<String>(4);
    AnnotationProperty associationAnn =PO.AP_ASSOCIATON;

    NodeIterator itrAssociation = f.listPropertyValues(associationAnn);
    while (itrAssociation.hasNext()) {
        String asso = itrAssociation.next().asLiteral().getLexicalForm();
        associations.add(asso);
    }
    return associations;
}
 
开发者ID:sasinda,项目名称:OntologyBasedInormationExtractor,代码行数:12,代码来源:FeatureClass.java

示例15: buildNotesTree

import com.hp.hpl.jena.rdf.model.NodeIterator; //导入依赖的package包/类
private void buildNotesTree(
        Model model,
        String parentResourceUri,
        String notebookUri,
        ConceptTreeNode parentNode,
        AnnotationTransformer annotationTransformer) throws Exception {
    String conceptUri;
    ConceptResource concept;
    RDFNode statement;

    Seq seq = model.getSeq(parentResourceUri);
    NodeIterator i = seq.iterator();

    cat.debug("<-> concept tree builder - got root: " + parentResourceUri);

    ConceptTreeNode child;
    while (i.hasNext()) {
        statement = i.nextNode();
        // add children to parent node
        conceptUri = statement.toString();
        cat.debug("  <-> concept tree builder - child '" + conceptUri + "'");
        concept = MindRaider.noteCustodian.get(notebookUri, conceptUri);

        child = new ConceptTreeNode();
        // TODO create resource clone to avoid changing of annotations
        if (annotationTransformer != null) {
            concept.setAnnotation(annotationTransformer.transform(concept.getAnnotation()));
        }
        child.setConcept(concept.resource);
        parentNode.getChildren().add(child);

        // now dive recursively for each existing node...
        buildNotesTree(model, conceptUri, notebookUri, child, annotationTransformer);
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:36,代码来源:OutlineResourceExpanded.java


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