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


Java OWLObjectProperty类代码示例

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


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

示例1: addToOntology

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":propertyWithInfos");
  OWLClass range = featurePool.getExclusiveClass(":ClassWithInfos");

  OWLLiteral label = factory.getOWLLiteral("Comment of a property (undefined language)");
  OWLAnnotationProperty comment = factory.getRDFSComment();

  OWLAnnotation pA = factory.getOWLAnnotation(comment, label);
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), pA));

  OWLAnnotation cA = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Comment of a class (undefined language)"));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), cA));

  addToGenericDomainAndNewRange(property, range);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:17,代码来源:RdfsCommentFeature.java

示例2: addToOntology

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":propertyWithInfos");
  OWLClass range = featurePool.getExclusiveClass(":ClassWithInfos");
  OWLAnnotationProperty label = factory.getRDFSLabel();

  OWLAnnotation enAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Label of a property", Locale.ENGLISH.getLanguage()));
  OWLAnnotation deAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Bezeichnung einer Property", Locale.GERMAN.getLanguage()));
  OWLAnnotation jpAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("プロパティの指定", Locale.JAPANESE.getLanguage()));

  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), deAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), enAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), jpAnnotation));

  OWLAnnotation enClassAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Label of a class", Locale.ENGLISH.getLanguage()));
  OWLAnnotation deClassAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Bezeichnung einer Klasse", Locale.GERMAN.getLanguage()));
  OWLAnnotation jpClassAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("どうもありがとうミスターロボット", Locale.JAPANESE.getLanguage()));

  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), enClassAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), deClassAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), jpClassAnnotation));


  addToGenericDomainAndNewRange(property, range);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:26,代码来源:RdfsLabelMultiLanguageFeature.java

示例3: addToOntology

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":propertyWithInfos");
  OWLClass range = featurePool.getExclusiveClass(":ClassWithInfos");
  OWLAnnotationProperty comment = factory.getRDFSComment();

  OWLAnnotation enAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Comment of a property", Locale.ENGLISH.getLanguage()));
  OWLAnnotation deAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Kommentar einer Property", Locale.GERMAN.getLanguage()));
  OWLAnnotation jpAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("プロパティのコメント", Locale.JAPANESE.getLanguage()));

  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), deAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), enAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), jpAnnotation));


  OWLAnnotation enClassAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Comment of a class", Locale.ENGLISH.getLanguage()));
  OWLAnnotation deClassAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Kommentar einer Klasse", Locale.GERMAN.getLanguage()));
  OWLAnnotation jpClassAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("どうもありがとうミスターロボット", Locale.JAPANESE.getLanguage()));

  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), enClassAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), deClassAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), jpClassAnnotation));

  addToGenericDomainAndNewRange(property, range);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:26,代码来源:RdfsCommentMultiLanguageFeature.java

示例4: addToOntology

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLClass start = featurePool.getReusableClass();
  OWLClass middle = featurePool.getExclusiveClass(":PropertyChainMiddle");
  OWLClass end = featurePool.getExclusiveClass(":PropertyChainEnd");

  OWLObjectProperty singleStep = featurePool.getExclusiveProperty(":propertyChainProperty_SingleStep");
  OWLObjectProperty doubleStep = featurePool.getExclusiveProperty(":propertyChainProperty_DoubleStep");

  List<OWLObjectProperty> propertyChain = Arrays.asList(singleStep, singleStep);
  addAxiomToOntology(factory.getOWLSubPropertyChainOfAxiom(propertyChain, doubleStep));

  addProperty(end, singleStep, middle);
  addProperty(middle, singleStep, start);
  addProperty(end, doubleStep, start);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:17,代码来源:OwlPropertyChainAxiomFeature.java

示例5: highlightPropertyIfUnsatisfiable

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
private void highlightPropertyIfUnsatisfiable(final OWLEntity entity, final StyledDocument doc,
		final int tokenStartIndex, final int tokenLength) {
	try {
		getOWLModelManager().getReasonerPreferences()
				.executeTask(OptionalInferenceTask.SHOW_OBJECT_PROPERTY_UNSATISFIABILITY, () -> {
					OWLObjectProperty prop = (OWLObjectProperty) entity;
					OWLReasoner reasoner = getOWLModelManager().getReasoner();
					boolean consistent = reasoner.isConsistent();
					if (!consistent || reasoner.getBottomObjectPropertyNode().contains(prop)) {
						doc.setCharacterAttributes(tokenStartIndex, tokenLength, inconsistentClassStyle, true);
					}
				});
	} catch (Exception e) {
		logger.warn("An error occurred whilst highlighting an unsatisfiable property: {}", e);
	}
}
 
开发者ID:md-k-sarker,项目名称:OWLAx,代码行数:17,代码来源:OWLCellRenderer.java

示例6: findAncestors

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
protected Set<OWLClass> findAncestors(String expr, 
		OWLObjectProperty p, boolean direct, Integer numExpected) throws TimeOutException, FreshEntitiesException, InconsistentOntologyException, ClassExpressionNotInProfileException, ReasonerInterruptedException, OWLParserException {
	System.out.println("Query: "+expr+" "+p+" Direct="+direct);
	OWLClassExpression qc = parseOMN(expr);
	System.out.println("QueryC: "+qc);
	//Set<OWLClassExpression> ces = reasoner.getSuperClassExpressions(qc, false);
	//System.out.println("NumX:"+ces.size());
	Set<OWLClass> clzs = reasoner.getSuperClassesOver(qc, p, direct);
	System.out.println("NumD:"+clzs.size());
	for (OWLClass c : clzs) {
		System.out.println("  D:"+c);
	}
	if (numExpected != null) {
		assertEquals(numExpected.intValue(), clzs.size());
	}
	return clzs;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:18,代码来源:ExtendedReasonerTest.java

示例7: shouldGetSubPropertyReflexiveClosureOf

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
/**
 * Test {@link OWLGraphWrapperEdgesExtended#getSubPropertyReflexiveClosureOf(OWLObjectPropertyExpression)}.
 */
@Test
public void shouldGetSubPropertyReflexiveClosureOf()
{
	OWLObjectProperty fakeRel1 = 
			wrapper.getOWLObjectPropertyByIdentifier("fake_rel1");
	List<OWLObjectProperty> expectedSubProps = new ArrayList<OWLObjectProperty>();
	expectedSubProps.add(fakeRel1);
	expectedSubProps.add(wrapper.getOWLObjectPropertyByIdentifier("fake_rel2"));
	expectedSubProps.add(wrapper.getOWLObjectPropertyByIdentifier("fake_rel3"));
	expectedSubProps.add(wrapper.getOWLObjectPropertyByIdentifier("fake_rel4"));
	//fake_rel3 and fake_rel4 are sub-properties of fake_rel2, 
	//which is the sub-property of fake_rel1
	//we also test the order of the returned properties
	LinkedHashSet<OWLObjectPropertyExpression> subprops = 
			wrapper.getSubPropertyReflexiveClosureOf(fakeRel1);
	assertEquals("Incorrect sub-properties returned: ", 
			expectedSubProps, new ArrayList<OWLObjectPropertyExpression>(subprops));
	
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:OWLGraphWrapperEdgesExtendedTest.java

示例8: trTypeLevel

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
/**
 * @param p
 * @return type-level form of relation
 */
private OWLObjectPropertyExpression trTypeLevel(
		OWLObjectPropertyExpression p) {
	if (!this.isTranslateObjectProperty) {
		return p;
	}
	if (p instanceof OWLObjectInverseOf) {
		OWLObjectPropertyExpression p2 = trTypeLevel(((OWLObjectInverseOf)p).getInverse());
		return getOWLDataFactory().getOWLObjectInverseOf(p2);
	}
	else {
		instanceLevelRelations.add((OWLObjectProperty)p);
		IRI iri = ((OWLObjectProperty) p).getIRI();
		return trTypeLevel(iri);
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:20,代码来源:OWLInAboxTranslator.java

示例9: renderObject

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
/**
 * @param opa
 * @return Map to be passed to Gson
 */
public JsonOwlFact renderObject(OWLObjectPropertyAssertionAxiom opa) {
	OWLNamedIndividual subject;
	OWLObjectProperty property;
	OWLNamedIndividual object;

	JsonOwlFact fact = null;
	if (opa.getSubject().isNamed() && opa.getObject().isNamed() && opa.getProperty().isAnonymous() == false) {
		subject = opa.getSubject().asOWLNamedIndividual();
		property = opa.getProperty().asOWLObjectProperty();
		object = opa.getObject().asOWLNamedIndividual();

		fact = new JsonOwlFact();
		fact.subject = curieHandler.getCuri(subject);
		fact.property = curieHandler.getCuri(property);
		fact.propertyLabel = graph.getLabel(property);
		fact.object = curieHandler.getCuri(object);
		
		JsonAnnotation[] anObjs = renderAnnotations(opa.getAnnotations(), curieHandler);
		if (anObjs != null && anObjs.length > 0) {
			fact.annotations = anObjs;
		}
	}
	return fact;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:29,代码来源:MolecularModelJsonRenderer.java

示例10: addType

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
/**
 * Convenience wrapper for {@link CoreMolecularModelManager#addType}.
 * 
 * @param modelId
 * @param iid
 * @param pid
 * @param cid
 * @param metadata
 * @throws UnknownIdentifierException 
 */
public void addType(IRI modelId,
		String iid, String pid, String cid, METADATA metadata) throws UnknownIdentifierException {
	ModelContainer model = checkModelId(modelId);
	OWLNamedIndividual individual = getIndividual(iid, model);
	if (individual == null) {
		throw new UnknownIdentifierException("Could not find a individual for id: "+iid);
	}
	OWLObjectProperty property = getObjectProperty(pid, model);
	if (property == null) {
		throw new UnknownIdentifierException("Could not find a property for id: "+pid);
	}
	OWLClass cls = getClass(cid, model);
	if (cls == null) {
		throw new UnknownIdentifierException("Could not find a class for id: "+cid);
	}
	addType(model, individual, property, cls, metadata);
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:28,代码来源:MolecularModelManager.java

示例11: addFact

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
/**
 * Convenience wrapper for {@link CoreMolecularModelManager#addFact}
 * 
 * @param modelId
 * @param pid
 * @param iid
 * @param jid
 * @param annotations 
 * @param metadata
 * @return relevant individuals
 * @throws UnknownIdentifierException 
 */
public List<OWLNamedIndividual> addFact(IRI modelId, String pid, String iid, String jid,
		Set<OWLAnnotation> annotations, METADATA metadata) throws UnknownIdentifierException {
	ModelContainer model = checkModelId(modelId);
	OWLObjectProperty property = getObjectProperty(pid, model);
	if (property == null) {
		throw new UnknownIdentifierException("Could not find a property for id: "+pid);
	}
	OWLNamedIndividual individual1 = getIndividual(iid, model);
	if (individual1 == null) {
		throw new UnknownIdentifierException("Could not find a individual (1) for id: "+iid);
	}
	OWLNamedIndividual individual2 = getIndividual(jid, model);
	if (individual2 == null) {
		throw new UnknownIdentifierException("Could not find a individual (2) for id: "+jid);
	}
	addFact(model, property, individual1, individual2, annotations, metadata);
	return Arrays.asList(individual1, individual2);
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:31,代码来源:MolecularModelManager.java

示例12: addAnnotations

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
public List<OWLNamedIndividual> addAnnotations(ModelContainer model, String pid, 
		String iid, String jid, Set<OWLAnnotation> annotations, METADATA metadata) throws UnknownIdentifierException {
	OWLObjectProperty property = getObjectProperty(pid, model);
	if (property == null) {
		throw new UnknownIdentifierException("Could not find a property for id: "+pid);
	}
	OWLNamedIndividual individual1 = getIndividual(iid, model);
	if (individual1 == null) {
		throw new UnknownIdentifierException("Could not find a individual (1) for id: "+iid);
	}
	OWLNamedIndividual individual2 = getIndividual(jid, model);
	if (individual2 == null) {
		throw new UnknownIdentifierException("Could not find a individual (2) for id: "+jid);
	}
	addAnnotations(model, property, individual1, individual2, annotations, metadata);

	return Arrays.asList(individual1, individual2);
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:19,代码来源:MolecularModelManager.java

示例13: getPropertiesByLabels

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
private static Set<OWLObjectProperty> getPropertiesByLabels(OWLGraphWrapper graph, String...labels) {
	Set<OWLObjectProperty> set = new HashSet<OWLObjectProperty>();
	for (String label : labels) {
		OWLObject obj = graph.getOWLObjectByLabel(label);
		if (obj == null) {
			throw new RuntimeException("No property found for label: "+label);
		}
		if (obj instanceof OWLObjectProperty) {
			set.add((OWLObjectProperty) obj);
		}
		else {
			throw new RuntimeException("No obj is wrong type: '"+obj.getClass().getName()+"' + for label: "+label);
		}
	}
	return set;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:BioChebiGenerator.java

示例14: removeDefaultAxioms

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
/**
 * Removes from the {@code OWLOntology} wrapped into {@link #graph} the relations 
 * defined in {@link #defaultRelationsToRemove}.
 * 
 * @return an {@code int} that is the number of {@code OWLAxiom}s actually removed.
 */
private int removeDefaultAxioms() {
    //Set<OWLObjectProperty> props = new HashSet<OWLObjectProperty>();
       Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
       for (String p : defaultRelationsToRemove) {
           IRI iri = graph.getIRIByIdentifier(p);
           OWLObjectProperty prop = fac.getOWLObjectProperty(iri);
           if (prop != null) {
               LOG.info(" FILTERING: "+prop);
               //props.add(prop);
               for (OWLAxiom ax : ont.getAxioms()) {
                   if (ax.getObjectPropertiesInSignature().contains(prop)) {
                       LOG.info("REMOVING:"+ax);
                       rmAxioms.add(ax);
                   }
               }
           }
       }

       LOG.info("Removing: "+rmAxioms.size());
       mgr.removeAxioms(ont, rmAxioms);
       return rmAxioms.size();
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:29,代码来源:SpeciesSubsetterUtil.java

示例15: visit

import org.semanticweb.owlapi.model.OWLObjectProperty; //导入依赖的package包/类
@Override
public Set<ComplexIntegerAxiom> visit(OWLEquivalentObjectPropertiesAxiom axiom) throws TranslationException {
	Objects.requireNonNull(axiom);
	Set<OWLObjectPropertyExpression> propertySet = axiom.getProperties();
	Set<IntegerObjectPropertyExpression> propertyExprSet = new HashSet<>();
	propertySet.forEach(propertyExpr -> {
		if (propertyExpr instanceof OWLObjectProperty) {
			OWLObjectProperty property = asOWLObjectProperty(propertyExpr);
			propertyExprSet.add(getDataTypeFactory().createObjectProperty(translateObjectProperty(property)));
		} else {
			throw new IllegalStateException();
		}
	});
	ComplexIntegerAxiom ret = getAxiomFactory().createEquivalentObjectPropertiesAxiom(propertyExprSet,
			translateAnnotations(axiom.getAnnotations()));
	return Collections.singleton(ret);
}
 
开发者ID:julianmendez,项目名称:jcel,代码行数:18,代码来源:AxiomTranslator.java


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