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


Java OntProperty.isObjectProperty方法代码示例

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


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

示例1: addFunctionalProperty

import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
/**
 * Call this method to make a functional property
 * 
 * @param prop
 * @return
 */
public List<ModelError> addFunctionalProperty(ConceptName prop) {
	OntProperty p = getOntProperty(prop);
	if (p == null) {
		addError(0, "Property '" + prop.toString()
				+ "' must exist before being declared functional.");
	} else {
		makePropertyFunctional(p);
		if (p.isObjectProperty()) {
			getJenaModel().createObjectProperty(p.getURI(), true);
		} else {
			getJenaModel().createDatatypeProperty(p.getURI(), true);
		}
	}
	return getErrorsFinal();
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:22,代码来源:ModelManager.java

示例2: checkObjectPropertyRange

import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
public boolean checkObjectPropertyRange(OntModel theJenaModel2, OntProperty pred, OntResource obj, boolean isList, EObject expr) throws CircularDependencyException {
	if (pred.isObjectProperty()) {
		if (checkRangeForMatch(theJenaModel2, pred, obj, isList)) {
			return true;
		}
		ExtendedIterator<? extends OntProperty> propitr = pred.listSuperProperties(false);
		while (propitr.hasNext()) {
			OntProperty sprop = propitr.next();
			if (checkRangeForMatch(theJenaModel2, sprop, obj, isList)) {
				propitr.close();
				return true;
			}
		}
		return false;
	}
	return true;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:18,代码来源:JenaBasedSadlModelValidator.java

示例3: validateClassInRange

import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
public boolean validateClassInRange(NamedNode pred, NamedNode rangeClass) {
		if (beginDeepValidation()) {
			OntProperty prop = getJenaModel().getOntProperty(
					pred.toFullyQualifiedString());
			if (prop != null && prop.isObjectProperty()) {
				OntResource rr = prop.getRange();
				OntClass rcls = getJenaModel().getOntClass(
						rangeClass.toFullyQualifiedString());
				if (rcls != null) {
					if (rr == null) {
						ExtendedIterator<? extends OntProperty> spitr = prop.listSuperProperties();
						while (spitr.hasNext()) {
							OntProperty sprop = spitr.next();
							rr = sprop.getDomain();
							if (rr != null) {
								if (classIsSubclassOf(rcls, rr, true)) {
									spitr.close();
									endDeepValidation();
									return true;
								}
							}
						}
						spitr.close();
					}
					else {
						boolean breturn = classIsSubclassOf(rcls, rr, true);
						endDeepValidation();
						return breturn;
					}
				}
			}
			else if (prop == null) {
// TODO this might need more checking awc 9/15/2013				
				return true;
			}
			endDeepValidation();
			return false;
		}
		return true;
	}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:41,代码来源:ModelManager.java

示例4: addProperties

import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private void addProperties(List<OntProperty> plst, boolean outputEvenIfDuplicate) throws IOException {
	for (int i = 0; plst != null && i < plst.size(); i++) {
		OntProperty prop = plst.get(i);
		if (shouldResourceBeOutput(prop, true, outputEvenIfDuplicate, false)) {
			resourcesOutput.add(prop);
			if (prop.isObjectProperty() && !prop.isFunctionalProperty() && !prop.isInverseFunctionalProperty()) {
				sadlModel.append("relationship of ");
				sadlModel.append(domainToString(prop));
				sadlModel.append(" to ");
				sadlModel.append(rangeToString(prop));
				sadlModel.append(" is ");
				sadlModel.append(resourceToString(prop, false));
				addEndOfStatement(sadlModel, 1);
				if (prop.isFunctionalProperty()) {
					sadlModel.append("\t");
					sadlModel.append(resourceToString(prop, false));
					sadlModel.append(" has a single value.\n");
				}
			}
			else {
				sadlModel.append(resourceToString(prop, false));
				sadlModel.append(" describes ");
				sadlModel.append(domainToString(prop));
				if (prop.isFunctionalProperty()) {
					sadlModel.append(" with a single value of type ");
				}
				else {
					sadlModel.append(" with values of type ");
				}
				sadlModel.append(rangeToString(prop));
				sadlModel.append(".\n");
			}
		}
	}
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:36,代码来源:OwlToSadl.java

示例5: getObjectProperties

import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
public Set<OntProperty> getObjectProperties(Object c, int local, int asserted, int named) {
return new EntityFilter<OntProperty>( ((OntClass) c).listDeclaredProperties(asserted==OntologyFactory.DIRECT).toSet(),this) {
    protected boolean isFiltered( OntProperty obj ) {
	return super.isFiltered(obj) && !obj.isObjectProperty();
    }  
};
   }
 
开发者ID:dozed,项目名称:align-api-project,代码行数:8,代码来源:JENAOntology.java

示例6: loadProperties

import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private void loadProperties() {

		this.properties.put(Uris.RDF_TYPE_URI, new Label(Uris.RDF_TYPE_URI, Namespaces.RDF, Prefixes.RDF));
		this.properties.put(Uris.RDF_VALUE_URI, new Label(Uris.RDF_VALUE_URI, Namespaces.RDF, Prefixes.RDF));
		this.properties.put(Uris.RDFS_SUBCLASS_URI, new Label(Uris.RDFS_SUBCLASS_URI, Namespaces.RDFS, Prefixes.RDFS));
		this.properties.put(Uris.RDFS_LABEL_URI, new Label(Uris.RDFS_LABEL_URI, Namespaces.RDFS, Prefixes.RDFS));
		this.properties.put(Uris.RDFS_COMMENT_URI, new Label(Uris.RDFS_COMMENT_URI, Namespaces.RDFS, Prefixes.RDFS));

		this.objectProperties.put(Uris.RDF_TYPE_URI, new Label(Uris.RDF_TYPE_URI, Namespaces.RDF, Prefixes.RDF));
		this.objectProperties.put(Uris.RDF_VALUE_URI, new Label(Uris.RDF_VALUE_URI, Namespaces.RDF, Prefixes.RDF));
		this.objectProperties.put(Uris.RDFS_SUBCLASS_URI, new Label(Uris.RDFS_SUBCLASS_URI, Namespaces.RDFS, Prefixes.RDFS));
		this.dataProperties.put(Uris.RDFS_LABEL_URI, new Label(Uris.RDFS_LABEL_URI, Namespaces.RDFS, Prefixes.RDFS));
		this.dataProperties.put(Uris.RDFS_COMMENT_URI, new Label(Uris.RDFS_COMMENT_URI, Namespaces.RDFS, Prefixes.RDFS));

		this.properties.put(Uris.CLASS_INSTANCE_LINK_URI, new Label(Uris.CLASS_INSTANCE_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV));
		this.properties.put(Uris.COLUMN_SUBCLASS_LINK_URI, new Label(Uris.COLUMN_SUBCLASS_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV));
		this.properties.put(Uris.DATAPROPERTY_OF_COLUMN_LINK_URI, new Label(Uris.DATAPROPERTY_OF_COLUMN_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV));
		this.properties.put(Uris.OBJECTPROPERTY_SPECIALIZATION_LINK_URI, new Label(Uris.OBJECTPROPERTY_SPECIALIZATION_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV));
		this.properties.put(Uris.DEFAULT_LINK_URI, new Label(Uris.DEFAULT_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV));
		
		ExtendedIterator<OntProperty> itrP = ontHandler.getOntModel().listAllOntProperties();
		
		while (itrP.hasNext()) {
			
			OntProperty p = itrP.next();
			
			if (!p.isURIResource())
				continue;
			
//			if (p.isAnnotationProperty())
//				continue;

			if (!properties.containsKey(p.getURI()))
				properties.put(p.getURI(), ontHandler.getResourceLabel(p));
			
			if (p.isDatatypeProperty() || !p.isObjectProperty())
			{
				if (!dataProperties.containsKey(p.getURI()))
					dataProperties.put(p.getURI(), ontHandler.getResourceLabel(p));
			}

			if (p.isObjectProperty() || !p.isDatatypeProperty())
			{
				if (p.getRange() != null && p.getRange().hasURI(Namespaces.RDFS + "Literal")) { 
					if (!dataProperties.containsKey(p.getURI())) {
						dataProperties.put(p.getURI(), ontHandler.getResourceLabel(p));
					}
				} else if (!objectProperties.containsKey(p.getURI()))
					objectProperties.put(p.getURI(), ontHandler.getResourceLabel(p));
			}
		}
	}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:53,代码来源:OntologyCache.java

示例7: validateTripleTypes

import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private void validateTripleTypes(EObject subjeo, EObject predeo, EObject objeo, TripleElement tr, Expression expr)
		throws TranslationException, InvalidTypeException, CircularDependencyException, InvalidNameException {
	if (getModelValidator() != null) {
		Node nsubj = tr.getSubject();
		boolean isCrVar = nsubj instanceof VariableNode ? ((VariableNode) nsubj).isCRulesVariable() : false;
		String varName = nsubj instanceof NamedNode ? ((NamedNode) nsubj).getName() : null;
		OntResource subj = null;
		if (nsubj == null) {
			addError("Triple has null subject in validation", expr);
			return;
		} else if (nsubj instanceof ProxyNode) {
			Object pf = ((ProxyNode) nsubj).getProxyFor();
			if (pf instanceof TripleElement) {
				Node pfPred = ((TripleElement) pf).getPredicate();
				if (pfPred instanceof NamedNode) {

					TypeCheckInfo pfpredtci;
					try {
						pfpredtci = getModelValidator().getTypeInfoFromRange(
								namedNodeToConceptName((NamedNode) pfPred),
								getTheJenaModel().getProperty(((NamedNode) pfPred).toFullyQualifiedString()),
								subjeo);
						if (pfpredtci.getTypeCheckType() != null) {
							Node pfpredrngtype = pfpredtci.getTypeCheckType();
							if (pfpredrngtype instanceof NamedNode) {
								subj = getTheJenaModel()
										.getOntResource(((NamedNode) pfpredrngtype).toFullyQualifiedString());
							}
						}
					} catch (DontTypeCheckException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			}
		} else {
			subj = getOntResource(tr.getSubject());
		}
		Node pnode = tr.getPredicate();
		OntProperty pred = getTheJenaModel().getOntProperty(tr.getPredicate().toFullyQualifiedString());
		if (pred == null) {
			if (tr.getPredicate() instanceof VariableNode) {
				if (EcoreUtil2.getContainerOfType(expr, QueryStatement.class) != null) {
					return; // variables as property in queries is OK
				}
				addError("Property '" + ((VariableNode) tr.getPredicate()).toDescriptiveString()
						+ "' is a variable, unable to validate", expr);
			} else {
				addError("Unexpected error finding property '" + tr.getPredicate().toDescriptiveString()
						+ "' in ontology, cannot validate", expr);
			}
			return;
		}
		getModelValidator().checkPropertyDomain(getTheJenaModel(), subj, pred, expr, true,
				isCrVar ? varName : null);
		NodeType pnodetype;
		if (pnode instanceof NamedNode) {
			pnodetype = ((NamedNode) pnode).getNodeType();
		} else {
			if (pred.isObjectProperty()) {
				pnodetype = NodeType.ObjectProperty;
			} else if (pred.isDatatypeProperty()) {
				pnodetype = NodeType.DataTypeProperty;
			} else if (pred.isAnnotationProperty()) {
				pnodetype = NodeType.AnnotationProperty;
			} else {
				pnodetype = NodeType.PropertyNode;
			}
		}
		if (pnodetype.equals(NodeType.AnnotationProperty)) {
			return; // can't check annotation property as there should be no range specified (OWL
					// 1). What about local restrictions on annotation properties?
		}
		Node obj = tr.getObject();
		if (obj != null) {
			handleLocalRestriction(expr, tr);
			checkTripleRange(subjeo, predeo, objeo, expr, tr.getSubject(), tr.getPredicate(), pred, pnodetype, obj,
					false);
		}
	}
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:82,代码来源:JenaBasedSadlModelProcessor.java


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