當前位置: 首頁>>代碼示例>>Java>>正文


Java OWLDataFactory.getOWLDataProperty方法代碼示例

本文整理匯總了Java中org.semanticweb.owlapi.model.OWLDataFactory.getOWLDataProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java OWLDataFactory.getOWLDataProperty方法的具體用法?Java OWLDataFactory.getOWLDataProperty怎麽用?Java OWLDataFactory.getOWLDataProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.semanticweb.owlapi.model.OWLDataFactory的用法示例。


在下文中一共展示了OWLDataFactory.getOWLDataProperty方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testDataPropertyMetadata

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
@Test
public void testDataPropertyMetadata() throws Exception {
	OWLOntologyManager m = OWLManager.createOWLOntologyManager();
	OWLOntology ontology = m.createOntology(IRI.generateDocumentIRI());
	{
		// create a test ontology with one data property
		OWLDataFactory f = m.getOWLDataFactory();
		IRI propIRI = IRI.generateDocumentIRI();
		OWLDataProperty prop = f.getOWLDataProperty(propIRI);
		m.addAxiom(ontology, f.getOWLDeclarationAxiom(prop));
		m.addAxiom(ontology, f.getOWLAnnotationAssertionAxiom(propIRI, f.getOWLAnnotation(f.getRDFSLabel(), f.getOWLLiteral("fake-data-property"))));
	}
	OWLGraphWrapper graph = new OWLGraphWrapper(ontology);
	MolecularModelManager<?> mmm = createM3(graph);
	Pair<List<JsonRelationInfo>,List<JsonRelationInfo>> pair = MolecularModelJsonRenderer.renderProperties(mmm, null, curieHandler);
	List<JsonRelationInfo> dataProperties = pair.getRight();
	assertEquals(1, dataProperties.size());
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:19,代碼來源:DataPropertyTest.java

示例2: visit

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public Boolean visit(OWLDatatypeDefinitionAxiom axiom) {
    reasoner.throwInconsistentOntologyExceptionIfNecessary();
    if (!reasoner.isConsistent())
        return true;
    if (reasoner.m_dlOntology.hasDatatypes()) {
        OWLDataFactory factory=reasoner.getDataFactory();
        OWLIndividual freshIndividual=factory.getOWLAnonymousIndividual("fresh-individual");
        OWLDataProperty freshDataProperty=factory.getOWLDataProperty(IRI.create("fresh-data-property"));
        OWLDataRange dataRange=axiom.getDataRange();
        OWLDatatype dt=axiom.getDatatype();
        OWLDataIntersectionOf dr1=factory.getOWLDataIntersectionOf(factory.getOWLDataComplementOf(dataRange),dt);
        OWLDataIntersectionOf dr2=factory.getOWLDataIntersectionOf(factory.getOWLDataComplementOf(dt),dataRange);
        OWLDataUnionOf union=factory.getOWLDataUnionOf(dr1,dr2);
        OWLClassExpression c=factory.getOWLDataSomeValuesFrom(freshDataProperty,union);
        OWLClassAssertionAxiom ax=factory.getOWLClassAssertionAxiom(c,freshIndividual);
        Tableau tableau=reasoner.getTableau(ax);
        return !tableau.isSatisfiable(true,true,null,null,null,null,null,ReasoningTaskDescription.isAxiomEntailed(axiom));
    }
    else
        return false;
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:22,代碼來源:EntailmentChecker.java

示例3: extractDataProperties

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
Map<OWLDataProperty, Set<OWLLiteral>> extractDataProperties(JsonAnnotation[] values, ModelContainer model) throws UnknownIdentifierException {
	Map<OWLDataProperty, Set<OWLLiteral>> result = new HashMap<OWLDataProperty, Set<OWLLiteral>>();
	
	if (values != null && values.length > 0) {
		OWLDataFactory f = model.getOWLDataFactory();
		for (JsonAnnotation jsonAnn : values) {
			if (jsonAnn.key != null && jsonAnn.value != null) {
				AnnotationShorthand shorthand = AnnotationShorthand.getShorthand(jsonAnn.key, curieHandler);
				if (shorthand == null) {
					IRI pIRI = curieHandler.getIRI(jsonAnn.key);
					if (dataPropertyIRIs.contains(pIRI)) {
						OWLLiteral literal = JsonTools.createLiteral(jsonAnn, f);
						if (literal != null) {
							OWLDataProperty property = f.getOWLDataProperty(pIRI);
							Set<OWLLiteral> literals = result.get(property);
							if (literals == null) {
								literals = new HashSet<OWLLiteral>();
								result.put(property, literals);
							}
							literals.add(literal);
						}
					}
				}
			}
		}
	}
	
	return result;
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:30,代碼來源:ModelCreator.java

示例4: testDataProperyRenderer

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
@Test
public void testDataProperyRenderer() throws Exception {
	OWLOntologyManager m = OWLManager.createOWLOntologyManager();
	OWLOntology ontology = m.createOntology(IRI.generateDocumentIRI());
	final IRI clsIRI = IRI.generateDocumentIRI();
	final IRI propIRI = IRI.generateDocumentIRI();
	
	// create a test ontology with one data property and one class
	OWLDataFactory f = m.getOWLDataFactory();
	OWLDataProperty prop = f.getOWLDataProperty(propIRI);
	m.addAxiom(ontology, f.getOWLDeclarationAxiom(prop));
	m.addAxiom(ontology, f.getOWLAnnotationAssertionAxiom(propIRI, f.getOWLAnnotation(f.getRDFSLabel(), f.getOWLLiteral("fake-data-property"))));

	OWLClass cls = f.getOWLClass(clsIRI);
	m.addAxiom(ontology, f.getOWLDeclarationAxiom(cls));
	m.addAxiom(ontology, f.getOWLAnnotationAssertionAxiom(clsIRI, f.getOWLAnnotation(f.getRDFSLabel(), f.getOWLLiteral("fake-cls"))));
	
	// graph and m3
	OWLGraphWrapper graph = new OWLGraphWrapper(ontology);
	final UndoMetadata metadata = new UndoMetadata("foo-user");
	UndoAwareMolecularModelManager m3 = createM3(graph);
	
	final ModelContainer model = m3.generateBlankModel(metadata);
	final OWLNamedIndividual individual = m3.createIndividual(model, cls, metadata);
	m3.addDataProperty(model, individual, prop, f.getOWLLiteral(10), metadata);
	
	MolecularModelJsonRenderer r = new MolecularModelJsonRenderer(model, null, curieHandler);
	final JsonModel jsonModel = r.renderModel();
	assertEquals(1, jsonModel.individuals.length);
	assertEquals(1, jsonModel.individuals[0].annotations.length);
	{
		JsonAnnotation ann = jsonModel.individuals[0].annotations[0];
		assertEquals(propIRI.toString(), ann.key);
		assertEquals("10", ann.value);
		assertEquals("xsd:integer", ann.valueType);
	}
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:38,代碼來源:DataPropertyTest.java

示例5: isSubDataPropertyOf

import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected boolean isSubDataPropertyOf(OWLDataProperty subDataProperty,
		OWLDataProperty superDataProperty) {
	checkPreConditions(subDataProperty, superDataProperty);
	if (!m_isConsistent || subDataProperty.isOWLBottomDataProperty()
			|| superDataProperty.isOWLTopDataProperty())
		return true;
	AtomicRole subrole = H(subDataProperty);
	AtomicRole superrole = H(superDataProperty);
	if (m_dataRoleHierarchy != null
			&& !containsFreshEntities(subDataProperty, superDataProperty)) {
		HierarchyNode<AtomicRole> subroleNode = m_dataRoleHierarchy
				.getNodeForElement(subrole);
		return subroleNode.isEquivalentElement(superrole)
				|| subroleNode.isAncestorElement(superrole);
	} else {
		OWLDataFactory factory = getDataFactory();
		OWLIndividual individual = factory
				.getOWLAnonymousIndividual("fresh-individual");
		OWLLiteral freshConstant = factory.getOWLLiteral(
				"internal:fresh-constant", factory.getOWLDatatype(IRI
						.create("internal:anonymous-constants")));
		OWLDataProperty negatedSuperDataProperty = factory
				.getOWLDataProperty(IRI
						.create("internal:negated-superproperty"));
		OWLAxiom subpropertyAssertion = factory
				.getOWLDataPropertyAssertionAxiom(subDataProperty,
						individual, freshConstant);
		OWLAxiom negatedSuperpropertyAssertion = factory
				.getOWLDataPropertyAssertionAxiom(negatedSuperDataProperty,
						individual, freshConstant);
		OWLAxiom superpropertyAxiomatization = factory
				.getOWLDisjointDataPropertiesAxiom(superDataProperty,
						negatedSuperDataProperty);
		Tableau tableau = getTableau(subpropertyAssertion,
				negatedSuperpropertyAssertion, superpropertyAxiomatization);
		boolean result = tableau.isSatisfiable(true, null, null, null,
				null, null, ReasoningTaskDescription.isRoleSubsumedBy(
						subrole, superrole, false));
		tableau.clearAdditionalDLOntology();
		return !result;
	}
}
 
開發者ID:robertoyus,項目名稱:HermiT-android,代碼行數:43,代碼來源:Reasoner.java


注:本文中的org.semanticweb.owlapi.model.OWLDataFactory.getOWLDataProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。