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


Java ObjectProperty类代码示例

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


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

示例1: getInverseProperty

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
/**
 * Returns the inverse property of the property with given URI
 * @param uri
 * @return
 */
public Label getInverseProperty(String uri) {
	ObjectProperty op = ontModel.getObjectProperty(uri);
	if (op == null)
		return null;
	OntProperty inverseProp = null; 
	try {
		inverseProp = op.getInverse();
	} catch (ConversionException e) {
		logger.error(e.getMessage());
	}
	if (inverseProp != null) {
		return getUriLabel(inverseProp.getURI());
	}
	else
		return null;
}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:22,代码来源:OntologyHandler.java

示例2: getInverseOfProperty

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
/**
 * Returns the inverseOf property of the property with given URI
 * @param uri
 * @return
 */
public Label getInverseOfProperty(String uri) {
	ObjectProperty op = ontModel.getObjectProperty(uri);
	if (op == null)
		return null;
	OntProperty inverseOfProp = null;
	try {
		inverseOfProp = op.getInverse();
	} catch (ConversionException e) {
		logger.error(e.getMessage());
	}
	if (inverseOfProp != null) {
		return getUriLabel(inverseOfProp.getURI());
	}
	else
		return null;
}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:22,代码来源:OntologyHandler.java

示例3: getOntProperty

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
private OntProperty getOntProperty(ConceptName propName) {
	Resource ir;
	try {
		ir = getOntResourceInExistingModel(propName);
		if (ir != null) {
			if (logger.isDebugEnabled()) {
				exploreProperty(ir.as(OntProperty.class));
			}

			ConceptType it = getOntResourceConceptType(ir);
			if (it.equals(ConceptType.ANNOTATIONPROPERTY)) {
				return ir.as(AnnotationProperty.class);
			}
			else if (it.equals(ConceptType.OBJECTPROPERTY)) {
				return ir.as(ObjectProperty.class);
			}
			else if (it.equals(ConceptType.DATATYPEPROPERTY)) {
				return ir.as(DatatypeProperty.class);
			}
		}
	} catch (ConfigurationException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:27,代码来源:ModelManager.java

示例4: getDomain

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
private OntResource getDomain(OntProperty prop) {
	OntResource domain = prop.getDomain();
	if (domain == null) {
		if (prop.canAs(ObjectProperty.class)) {
			ExtendedIterator<? extends OntProperty> titr = ((ObjectProperty) prop
					.as(ObjectProperty.class)).listSuperProperties(true);
			while (titr.hasNext()) {
				OntProperty tr = titr.next();
				domain = getDomain((OntProperty) tr);
				if (domain != null) {
					titr.close();
					return domain;
				}
			}
			titr.close();
		}
	}
	return domain;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:20,代码来源:ModelManager.java

示例5: getRange

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
private OntResource getRange(OntProperty prop) {
	OntResource range = prop.getRange();
	if (range == null) {
		ExtendedIterator<? extends OntProperty> titr = null;
		if (prop.canAs(ObjectProperty.class)) {
			titr = ((ObjectProperty) prop.as(ObjectProperty.class))
					.listSuperProperties(true);
		} else if (prop.canAs(DatatypeProperty.class)) {
			titr = ((DatatypeProperty) prop.as(DatatypeProperty.class))
					.listSuperProperties(true);
		}
		if (titr != null) {
			while (titr.hasNext()) {
				OntProperty tr = titr.next();
				range = getRange((OntProperty) tr);
				if (range != null) {
					titr.close();
					return range;
				}
			}
			titr.close();
		}
	}
	return range;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:26,代码来源:ModelManager.java

示例6: getSuperPropertyType

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
private Resource getSuperPropertyType(Resource ontRsrc) {
	StmtIterator sitr = theModel.listStatements(null, RDFS.subPropertyOf, ontRsrc);
	if (sitr.hasNext()) {
		Statement s = sitr.nextStatement();
		Resource superprop = s.getSubject();
		if (superprop.canAs(ObjectProperty.class)) {
			return OWL.ObjectProperty;
		}
		else if (superprop.canAs(DatatypeProperty.class)) {
			return OWL.DatatypeProperty;
		}
		else {
			return getSuperPropertyType(superprop);
		}
	}
	return null;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:18,代码来源:OwlToSadl.java

示例7: replaceDeclarationWithVariableAndAddUseDeclarationAsDefinition

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
private Object replaceDeclarationWithVariableAndAddUseDeclarationAsDefinition(Expression lexpr, Object lobj,
		Expression rexpr, Object robj) throws TranslationException, InvalidTypeException {
	if (lobj instanceof VariableNode) {
		Object[] declAndTrans = getDeclarationAndTranslation(rexpr);
		if (declAndTrans != null) {
			Object rtrans = declAndTrans[1];
			if (rtrans instanceof NamedNode) {
				if (((NamedNode) rtrans).getNodeType().equals(NodeType.ClassNode)) {
					if (replaceDeclarationInRightWithVariableInLeft((Node) lobj, robj, rtrans)) {
						TripleElement newTriple = new TripleElement((Node) lobj,
								validateNamedNode(new NamedNode(RDF.type.getURI(), NodeType.ObjectProperty)),
								(Node) rtrans);
						Junction jct = createJunction(rexpr, "and", newTriple, robj);
						return jct;
					}
				}
			}
		}
	}
	return null;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:22,代码来源:JenaBasedSadlModelProcessor.java

示例8: createNamedNode

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
public NamedNode createNamedNode(String conceptUri, OntConceptType conceptType) {
	NamedNode cn = new NamedNode(conceptUri);
	if (conceptType.equals(OntConceptType.CLASS)) {
		cn.setNodeType(NodeType.ClassNode);
	} else if (conceptType.equals(OntConceptType.ANNOTATION_PROPERTY)) {
		cn.setNodeType(NodeType.AnnotationProperty);
	} else if (conceptType.equals(OntConceptType.DATATYPE_PROPERTY)) {
		cn.setNodeType(NodeType.DataTypeProperty);
	} else if (conceptType.equals(OntConceptType.INSTANCE)) {
		cn.setNodeType(NodeType.InstanceNode);
	} else if (conceptType.equals(OntConceptType.CLASS_PROPERTY)) {
		cn.setNodeType(NodeType.ObjectProperty);
	} else if (conceptType.equals(OntConceptType.DATATYPE)) {
		cn.setNodeType(NodeType.DataTypeNode);
	} else if (conceptType.equals(OntConceptType.RDF_PROPERTY)) {
		cn.setNodeType(NodeType.PropertyNode);
	} else if (conceptType.equals(OntConceptType.VARIABLE)) {
		cn.setNodeType(NodeType.VariableNode);
	} else if (conceptType.equals(OntConceptType.FUNCTION_DEFN)) {
		cn.setNodeType(NodeType.FunctionNode);
	}
	return cn;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:24,代码来源:JenaBasedSadlModelProcessor.java

示例9: isNumericWithImpliedProperty

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
private boolean isNumericWithImpliedProperty(TypeCheckInfo tci, Expression expr) throws DontTypeCheckException, InvalidNameException, InvalidTypeException, TranslationException {
	if (tci.getImplicitProperties() != null) {
		Iterator<ConceptName> litr = tci.getImplicitProperties().iterator();
		while (litr.hasNext()) {
			ConceptName cn = litr.next();
			Property prop = theJenaModel.getProperty(cn.getUri());
			if (prop.canAs(ObjectProperty.class)) {
				cn.setType(ConceptType.OBJECTPROPERTY);
			}
			else if (prop.canAs(DatatypeProperty.class)) {
				cn.setType(ConceptType.DATATYPEPROPERTY);
			}
			else {
				cn.setType(ConceptType.RDFPROPERTY);
			}
			TypeCheckInfo newtci = getTypeInfoFromRange(cn, prop, expr);
			if (isNumeric(newtci)) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:24,代码来源:JenaBasedSadlModelValidator.java

示例10: useImpliedPropertyToMatchNumericOperator

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
private boolean useImpliedPropertyToMatchNumericOperator(EObject expr, TypeCheckInfo tci, String sideId) throws DontTypeCheckException, InvalidTypeException, TranslationException, InvalidNameException {
	if (tci != null && tci.getImplicitProperties() != null) {
		Iterator<ConceptName> ipitr = tci.getImplicitProperties().iterator();
		while (ipitr.hasNext()) {
			ConceptName cn = ipitr.next();
			Property prop = theJenaModel.getProperty(cn.getUri());
			if (prop.canAs(ObjectProperty.class)) {
				cn.setType(ConceptType.OBJECTPROPERTY);
			}
			else if (prop.canAs(DatatypeProperty.class)) {
				cn.setType(ConceptType.DATATYPEPROPERTY);
			}
			else {
				cn.setType(ConceptType.RDFPROPERTY);
			}
			TypeCheckInfo newltci = getTypeInfoFromRange(cn, prop, expr);
			if (isNumeric(newltci)) {
				issueAcceptor.addInfo("Implied property '" + getModelProcessor().conceptIdentifierToString(cn) + "' used (" + sideId + ") to pass type check", expr);
				addImpliedPropertiesUsed(expr, prop);
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:26,代码来源:JenaBasedSadlModelValidator.java

示例11: execute

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
/**
 * Method to execute the nanopub creation process.
 * 
 * @throws Exception
 *             Can throw exceptions.
 */
public void execute() throws Exception {
	this.cleanFolder();
	this.loadConfig();
	this.createPhysicians();
	this.createSources();
	this.createDataGeneratedBy();
	this.model = ModelFactory.createOntologyModel();
	this.model.read(DDX_ONT_URI);
	this.has_sign = model.getOntResource(NAMESPACE + "has_sign")
			.asObjectProperty();
	this.has_disorder = model.getOntResource(NAMESPACE + "has_disorder")
			.asObjectProperty();
	this.has_diagnostic_test = model.getOntResource(
			NAMESPACE + "has_diagnostic_test").asObjectProperty();
	this.relations = new ObjectProperty[] { has_sign, has_disorder,
			has_diagnostic_test };
	this.diseases = loadDiseases();
	this.processDiseases();
	System.out.println("Knowledge base nanopubs have been created. Check nanopubs/kb folder");
}
 
开发者ID:wilkinsonlab,项目名称:DDx2NP,代码行数:27,代码来源:ODDxKBDataExtractor.java

示例12: eliminar

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
public void eliminar() {
    try {
        this.departamentoFacade.remove(departamentoSelecionado);
        ModeloBean ont = (ModeloBean) FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get("modeloBean");
        String nS = ont.getPrefijo();
        OntModel modelo = ont.getModelOnt();
        ObjectProperty pertenece = modelo.getObjectProperty(nS + "es_inscrito");
        Individual facultad = modelo.getIndividual(nS + "Facultad" + departamentoSelecionado.getCodFac().getCodFac());
        facultad.removeProperty(pertenece.getInverse(), modelo.getIndividual(nS + clase + departamentoSelecionado.getCodDep()));
        modelo.getIndividual(nS + clase + departamentoSelecionado.getCodDep()).remove();
        ont.guardarModelo(modelo);
        departamentoSelecionado = null;
        listaSelecionada = null;
        listaDepartamento = this.departamentoFacade.findAll();
        codFac = "";
    } catch (Exception e) {
        System.out.println(e.toString());
        FacesContext.getCurrentInstance().
                addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Problema al eliminar el departamento", ""));
    }
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:22,代码来源:DepartamentoBean.java

示例13: eliminar

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
public void eliminar() {
    try {
        this.lineaInvestigacionFacade.remove(lineaInvestigacionSelecionada);
        ModeloBean ont = (ModeloBean) FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get("modeloBean");
        String nS = ont.getPrefijo();
        OntModel modelo = ont.getModelOnt();
        OntClass claseLin = modelo.getOntClass(nS + clase);
        ObjectProperty pertenece = modelo.getObjectProperty(nS + "Pertenece_a");
        Individual departamento = modelo.getIndividual(nS + "Departamento" + lineaInvestigacionSelecionada.getCodDep().getCodDep());
        departamento.removeProperty(pertenece.getInverse(), modelo.getIndividual(nS + clase + lineaInvestigacionSelecionada.getCodigoLinea()));
        modelo.getIndividual(nS + clase + lineaInvestigacionSelecionada.getCodigoLinea()).remove();
        ont.guardarModelo(modelo);
        reset();
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Linea de investigación Eliminada", ""));
    } catch (Exception e) {
        System.out.println(e.toString());
        FacesContext.getCurrentInstance().
                addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error al Eliminar la linea", ""));
    }
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:21,代码来源:LineaInvestigacionBean.java

示例14: eliminar

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
public void eliminar(){
    try{
        this.estudianteFacade.remove(estudianteSelecionado);
        ModeloBean ont = (ModeloBean) FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get("modeloBean");
        String nS = ont.getPrefijo();
        OntModel modelo = ont.getModelOnt();
        OntClass claseEst = modelo.getOntClass(nS + clase);
        Individual est = modelo.createIndividual(nS + clase + estudianteSelecionado.getCodestudiante(), claseEst);
        Individual programa = modelo.getIndividual(nS + "Programa" + estudianteSelecionado.getPrograma().getCodProg());
        ObjectProperty estudia = modelo.getObjectProperty(nS + "Pertenece");
        programa.removeProperty(estudia.getInverse(), est);
        modelo.createIndividual(nS + clase + estudianteSelecionado.getCodestudiante(), claseEst).remove();
        ont.guardarModelo(modelo);
        reset();
        FacesContext.getCurrentInstance().
                addMessage(null, new FacesMessage("estudiante eliminado con exito ", ""));
    }catch(Exception e){
        System.out.println(e.toString());
        FacesContext.getCurrentInstance().
                addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error al eliminar estudiante ", ""));
    }
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:23,代码来源:EstudianteBean.java

示例15: eliminar

import com.hp.hpl.jena.ontology.ObjectProperty; //导入依赖的package包/类
public void eliminar(){
    try{
        this.modalidadFacade.remove(modalidadSeleccionada);
        ModeloBean ont = (ModeloBean) FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get("modeloBean");
        String nS = ont.getPrefijo();
        OntModel modelo = ont.getModelOnt();
        Individual modalidadI = modelo.getIndividual(nS + clase + modalidadSeleccionada.getCodModalidad());
        Individual departamento = modelo.getIndividual(nS + "Departamento" + modalidadSeleccionada.getCodDep().getCodDep());
        ObjectProperty pertenece = modelo.getObjectProperty(nS + "Es_del_departamento");
        departamento.removeProperty(pertenece.getInverse(), modalidadI);
        modelo.getIndividual(nS + clase + modalidadSeleccionada.getCodModalidad()).remove();
        ont.guardarModelo(modelo);
        reset();
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("modalidad Eliminada", ""));
    }catch(Exception e){
         System.out.println(e.toString());
        FacesContext.getCurrentInstance().
                addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error al Eliminar modalidad ", ""));
    }
    
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:22,代码来源:ModalidadBean.java


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