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


Java Individual.listPropertyValues方法代码示例

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


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

示例1: obtainMappings

import com.hp.hpl.jena.ontology.Individual; //导入方法依赖的package包/类
private List<URI> obtainMappings(Individual individual, Property mappingProperty) throws URISyntaxException {

        List<URI> result = new ArrayList<URI>();
        if (individual == null || mappingProperty == null)
            return result;

        NodeIterator nodeIterator = null;
        Resource schemaMap;
        RDFNode node;
        try {
            nodeIterator = individual.listPropertyValues(mappingProperty);
            while (nodeIterator.hasNext()) {
                node = nodeIterator.next();
                if (node.isResource()) {
                    schemaMap = node.asResource();
                    result.add(new URI(schemaMap.getURI()));
                }
            }
        } finally {
            if (nodeIterator != null)
                nodeIterator.close();
        }
        return result;
    }
 
开发者ID:kmi,项目名称:msm4j,代码行数:25,代码来源:ServiceReaderImpl.java

示例2: obtainParts

import com.hp.hpl.jena.ontology.Individual; //导入方法依赖的package包/类
private List<MessagePart> obtainParts(Individual individual, Property partsProperty) throws URISyntaxException {

        List<MessagePart> result = new ArrayList<MessagePart>();
        if (individual == null)
            return result;

        RDFNode node;
        MessagePart messagePart;
        NodeIterator nodeIterator = null;
        try {
            nodeIterator = individual.listPropertyValues(partsProperty);
            while (nodeIterator.hasNext()) {
                node = nodeIterator.next();
                messagePart = obtainMessagePart(node);
                if (messagePart != null)
                    result.add(messagePart);
            }
        } finally {
            if (nodeIterator != null)
                nodeIterator.close();
        }
        return result;
    }
 
开发者ID:kmi,项目名称:msm4j,代码行数:24,代码来源:ServiceReaderImpl.java

示例3: addInstancePropertyValue

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

示例4: obtainAxioms

import com.hp.hpl.jena.ontology.Individual; //导入方法依赖的package包/类
private List<? extends LogicalAxiom> obtainAxioms(Individual individual, Class<? extends LogicalAxiom> axiomClass) throws URISyntaxException {

        List<? extends LogicalAxiom> result;
        Resource resourceType;

        if (axiomClass.equals(Condition.class)) {
            result = new ArrayList<Condition>();
            resourceType = WSMO_LITE.Condition;

        } else if (axiomClass.equals(Effect.class)) {
            result = new ArrayList<Effect>();
            resourceType = WSMO_LITE.Effect;
        } else {
            // We just sent it empty. The type does not matter
            return new ArrayList<Effect>();
        }

        RDFNode node;
        NodeIterator nodeIterator = null;

        // Process the appropriate model references
        try {
            nodeIterator = individual.listPropertyValues(SAWSDL.modelReference);
            FilterByRdfType typeFilter = new FilterByRdfType(resourceType);
            ExtendedIterator<RDFNode> filteredIter = nodeIterator.filterKeep(typeFilter);
            while (filteredIter.hasNext()) {
                node = filteredIter.next();
                Individual axiomIndiv = node.as(Individual.class); // Should be possible given the filter
                if (axiomClass.equals(Condition.class)) {
                    Condition cond;
                    if (axiomIndiv.isAnon()) {
                        cond = new Condition(null);
                    } else {
                        cond = new Condition(new URI(axiomIndiv.getURI()));
                    }
                    setResourceProperties(axiomIndiv, cond);
                    cond.setTypedValue(getAxiom(axiomIndiv));
                    ((List<Condition>) result).add(cond);

                } else if (axiomClass.equals(Effect.class)) {
                    Effect effect;
                    if (axiomIndiv.isAnon()) {
                        effect = new Effect(null);
                    } else {
                        effect = new Effect(new URI(axiomIndiv.getURI()));
                    }

                    setResourceProperties(axiomIndiv, effect);
                    effect.setTypedValue(getAxiom(axiomIndiv));
                    ((List<Effect>) result).add(effect);
                }
            }
        } finally {
            if (nodeIterator != null)
                nodeIterator.close();
        }

        return result;
    }
 
开发者ID:kmi,项目名称:msm4j,代码行数:60,代码来源:ServiceReaderImpl.java

示例5: setResourceProperties

import com.hp.hpl.jena.ontology.Individual; //导入方法依赖的package包/类
private void setResourceProperties(Individual individual, uk.ac.open.kmi.msm4j.Resource result) throws URISyntaxException {
    Resource res;
    result.setComment(individual.getComment(null));
    result.setLabel(individual.getLabel(null));

    // seeAlso
    NodeIterator seeAlsoIterator = individual.listPropertyValues(RDFS.seeAlso);
    for (RDFNode seeAlsoValue : seeAlsoIterator.toList()) {
        result.addSeeAlso(new URI(seeAlsoValue.asResource().getURI()));
    }

    // source
    res = individual.getPropertyResourceValue(DCTerms.source);
    if (res != null) {
        result.setSource(new URI(res.getURI()));
    }

    // creator
    res = individual.getPropertyResourceValue(DCTerms.creator);
    if (res != null) {
        result.setCreator(new URI(res.getURI()));
    }

    // created
    Date created = getDate(individual, DCTerms.created);
    if (created != null) {
        result.setCreated(created);
    }

    // issued
    Date issued = getDate(individual, DCTerms.issued);
    if (issued != null) {
        result.setIssued(issued);
    }

    //licenses
    NodeIterator licenseIterator = individual.listPropertyValues(DCTerms.license);
    for (RDFNode licenseValue : licenseIterator.toList()) {
        result.addLicense(new URI(licenseValue.asResource().getURI()));
    }

    //owl:sameAs
    NodeIterator sameAsIterator = individual.listPropertyValues(OWL2.sameAs);
    for (RDFNode sameAsValue : sameAsIterator.toList()) {
        result.addSameAs(new URI(sameAsValue.asResource().getURI()));
    }

}
 
开发者ID:kmi,项目名称:msm4j,代码行数:49,代码来源:ServiceReaderImpl.java


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