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


Java OWLAnnotationProperty类代码示例

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


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

示例1: addToOntology

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的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.OWLAnnotationProperty; //导入依赖的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.OWLAnnotationProperty; //导入依赖的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: getPrefLabels

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
@Override
public Set<String> getPrefLabels(OWLEntity cpt) {
	Set<String> finalLabels = new HashSet<String>();
	Set<OWLAnnotation> annotations = cpt.getAnnotations(ontology);
	for(OWLAnnotation annot : annotations) {
		if(annot.getValue() instanceof OWLLiteral) {
			OWLAnnotationProperty prop = annot.getProperty();
			// The DOE prefLabel, if they exist
			if(prop.getIRI().equals(prefLabelIRI) ||
				prop.getIRI().equals(SKOSVocabulary.PREFLABEL.getIRI()) ||
				prop.getIRI().equals(OWLRDFVocabulary.RDFS_LABEL.getIRI())) {

				OWLLiteral literal = (OWLLiteral)annot.getValue();
				finalLabels.add(literal.getLiteral());
			}
		}
	}
	return finalLabels;
}
 
开发者ID:lmazuel,项目名称:onagui,代码行数:20,代码来源:DOEOWLContainer.java

示例5: getAltLabels

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
@Override
public Set<String> getAltLabels(OWLEntity cpt) {
	Set<String> finalLabels = new HashSet<String>();
	Set<OWLAnnotation> annotations = cpt.getAnnotations(ontology);
	for(OWLAnnotation annot : annotations) {
		if(annot.getValue() instanceof OWLLiteral) {
			OWLAnnotationProperty prop = annot.getProperty();
			// The DOE prefLabel, if they exist
			if(prop.getIRI().equals(altLabelIRI) ||
				prop.getIRI().equals(hiddenLabelIRI) ||
				prop.getIRI().equals(SKOSVocabulary.ALTLABEL.getIRI()) ||
				prop.getIRI().equals(SKOSVocabulary.HIDDENLABEL.getIRI())) {

				OWLLiteral literal = (OWLLiteral)annot.getValue();
				finalLabels.add(literal.getLiteral());
			}
		}
	}
	return finalLabels;
}
 
开发者ID:lmazuel,项目名称:onagui,代码行数:21,代码来源:DOEOWLContainer.java

示例6: getLabel

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
private String getLabel(OWLEntity obj) throws MultiLabelException {
	String label = null;
	OWLAnnotationProperty labelProperty = ont.getOWLOntologyManager().getOWLDataFactory().getRDFSLabel();
	for (OWLAnnotation ann : OwlHelper.getAnnotations(obj, labelProperty, ont)) {
		if (ann.getProperty().isLabel()) {
			OWLAnnotationValue v = ann.getValue();
			if (v instanceof OWLLiteral) {
				if (label != null) {
					throw new MultiLabelException(obj);
				}
				label = ((OWLLiteral)v).getLiteral();
			}
		}
	}
	return label;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:GetLabelsTest.java

示例7: shouldGetSubAnnotationPropertiesOf

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
/**
 * Test {@link 
 * OWLGraphWrapperEdgesExtended#getSubAnnotationPropertiesOf(OWLAnnotationProperty)}.
 */
@Test
public void shouldGetSubAnnotationPropertiesOf() {
    Set<OWLAnnotationProperty> expectedSubprops = new HashSet<OWLAnnotationProperty>();
    expectedSubprops.add(groupProp);
    assertEquals("Incorrect sub-properties returned", expectedSubprops,  
            wrapper.getSubAnnotationPropertiesOf(subsetProp));
    
    expectedSubprops = new HashSet<OWLAnnotationProperty>();
    expectedSubprops.add(fake1Prop);
    expectedSubprops.add(fake2Prop);
    assertEquals("Incorrect sub-properties returned", expectedSubprops,  
            wrapper.getSubAnnotationPropertiesOf(groupProp));
    
    assertEquals("Incorrect sub-properties returned", new HashSet<OWLAnnotationProperty>(),  
            wrapper.getSubAnnotationPropertiesOf(lonelyProp));
    
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:22,代码来源:OGWSubAnnotationTest.java

示例8: initializeLegacyRelationIndex

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
private void initializeLegacyRelationIndex() {
	synchronized(legacyRelationIndex) {
		OWLAnnotationProperty rdfsLabel = OWLManager.getOWLDataFactory().getRDFSLabel();
		for (OWLOntology ont : this.getOntology().getImportsClosure()) {
			for (OWLObjectProperty prop : ont.getObjectPropertiesInSignature()) {
				for (OWLAnnotationAssertionAxiom axiom : ont.getAnnotationAssertionAxioms(prop.getIRI())) {
					if (axiom.getProperty().equals(rdfsLabel)) {
						Optional<OWLLiteral> literalOpt = axiom.getValue().asLiteral();
						if (literalOpt.isPresent()) {
							String label = literalOpt.get().getLiteral();
							legacyRelationIndex.put(prop.getIRI(), label.replaceAll(" ", "_"));
						}
					}
				}
			}
		}
	}
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:19,代码来源:CoreMolecularModelManager.java

示例9: updateAnnotation

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
OWLObjectPropertyAssertionAxiom updateAnnotation(ModelContainer model, 
		OWLObjectPropertyAssertionAxiom toModify, OWLAnnotation update,
		METADATA metadata) {
	OWLObjectPropertyAssertionAxiom newAxiom = null;
	if (toModify != null) {
		Set<OWLAnnotation> combindedAnnotations = new HashSet<OWLAnnotation>();
		OWLAnnotationProperty target = update.getProperty();
		for(OWLAnnotation existing : toModify.getAnnotations()) {
			if (target.equals(existing.getProperty()) == false) {
				combindedAnnotations.add(existing);
			}
		}
		combindedAnnotations.add(update);
		newAxiom = modifyAnnotations(toModify, combindedAnnotations, model, metadata);
	}
	return newAxiom;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:18,代码来源:CoreMolecularModelManager.java

示例10: addPTBoxConstraints

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
protected void addPTBoxConstraints(OWLOntology ontology, PTBox ptbox,
										OWLOntologyManager manager, OWLDataFactory  factory) {
	
	ConceptConverter converter = new ConceptConverter(ptbox.getClassicalKnowledgeBase(), factory); 
	
	for (ConditionalConstraint cc : ptbox.getDefaultConstraints()) {

		OWLAnnotationProperty annProp = factory.getOWLAnnotationProperty( IRI.create(Constants.CERTAINTY_ANNOTATION_URI ));
		OWLAnnotationValue annValue = factory.getOWLStringLiteral( cc.getLowerBound() + ";" + cc.getUpperBound() );
		OWLAnnotation annotation = factory.getOWLAnnotation( annProp, annValue );	
		OWLClassExpression clsEv = (OWLClassExpression)converter.convert( cc.getEvidence() );
		OWLClassExpression clsCn = (OWLClassExpression)converter.convert( cc.getConclusion() );
		OWLAxiom axiom = factory.getOWLSubClassOfAxiom( clsEv, clsCn, Collections.singleton( annotation ) );
		
		try {
			
			manager.applyChange( new AddAxiom(ontology, axiom) );
		
		} catch( OWLOntologyChangeException e ) {
			
			e.printStackTrace();
		}
	}
}
 
开发者ID:klinovp,项目名称:pronto,代码行数:25,代码来源:PKBXMLSerializer.java

示例11: getSubAnnotationPropertiesOf

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
/**
 * Returns the direct child properties of <code>prop</code> in all ontologies.
 * @param prop      The <code>OWLAnnotationProperty</code> for which 
 *                  we want the direct sub-properties.
 * @return          A <code>Set</code> of <code>OWLAnnotationProperty</code>s 
 *                  that are the direct sub-properties of <code>prop</code>.
 * 
 * @see #getSubPropertyClosureOf(OWLObjectPropertyExpression)
 * @see #getSubPropertyReflexiveClosureOf(OWLObjectPropertyExpression)
 */
public Set<OWLAnnotationProperty> getSubAnnotationPropertiesOf(
        OWLAnnotationProperty prop) {
    Set<OWLAnnotationProperty> subProps = new HashSet<OWLAnnotationProperty>();
    for (OWLOntology ont : this.getAllOntologies()) {
        //we need to iterate each annotation property, to get 
        //its getSubAnnotationPropertyOfAxioms and see if prop is its parent 
        //(there is no method "getSuperAnnotationPropertyOfAxioms").
        for (OWLAnnotationProperty subProp : ont.getAnnotationPropertiesInSignature()) {
            for (OWLSubAnnotationPropertyOfAxiom ax: 
                    ont.getSubAnnotationPropertyOfAxioms(subProp)) {
                if (ax.getSuperProperty().equals(prop)) {
                    subProps.add(subProp);
                }
            }
        }
    }
    return subProps;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:29,代码来源:OWLGraphWrapperEdgesExtended.java

示例12: getAllOWLObjectsByAltId

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
/**
 * Find all corresponding {@link OWLObject}s with an OBO-style alternate identifier.
 * <p>
 * WARNING: This methods scans all object annotations in all ontologies. 
 * This is an expensive method.
 * 
 * @return map of altId to OWLObject (never null)
 */
public Map<String, OWLObject> getAllOWLObjectsByAltId() {
	final Map<String, OWLObject> results = new HashMap<String, OWLObject>();
	final OWLAnnotationProperty altIdProperty = getAnnotationProperty(OboFormatTag.TAG_ALT_ID.getTag());
	if (altIdProperty == null) {
		return Collections.emptyMap();
	}
	for (OWLOntology o : getAllOntologies()) {
		Set<OWLAnnotationAssertionAxiom> aas = o.getAxioms(AxiomType.ANNOTATION_ASSERTION);
		for (OWLAnnotationAssertionAxiom aa : aas) {
			OWLAnnotationValue v = aa.getValue();
			OWLAnnotationProperty property = aa.getProperty();
			if (altIdProperty.equals(property) && v instanceof OWLLiteral) {
				String altId = ((OWLLiteral)v).getLiteral();
				OWLAnnotationSubject subject = aa.getSubject();
				if (subject instanceof IRI) {
					OWLObject obj = getOWLObject((IRI) subject);
					if (obj != null) {
						results.put(altId, obj);
					}
				}
			}
		}
	}
	return results;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:34,代码来源:OWLGraphWrapperExtended.java

示例13: renderAnnotations

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
private Map<String,String> renderAnnotations(Set<OWLAnnotation> annotations) {
	Map<String,String> result = null;
	if (annotations != null && !annotations.isEmpty()) {
		for (OWLAnnotation annotation : annotations) {
			OWLAnnotationProperty prop = annotation.getProperty();
			String literal = getLiteralValue(annotation.getValue());
			if (literal != null) {
				if (result == null) {
					result = new HashMap<String, String>();
				}
				result.put(prop.toStringID(), literal);
			}
		}
	}
	return result;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:ModelAnnotationSolrDocumentLoader.java

示例14: translateResultsToOWLAxioms

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
/**
 * adds additional axioms specific to this method.
 * Creates a named LCS class equivalent to the generated expression
 * 
 * @param id
 * @param result
 * @param axioms
 */
@Override
protected void translateResultsToOWLAxioms(String id, OWLNamedIndividual result, Set<OWLAxiom> axioms) {
	OWLDataFactory df = graph.getDataFactory();
	
	// declare a named class for the LCS and make this equivalent to the anonymous expression
	OWLClass namedLCS = df.getOWLClass(IRI.create(id+"_LCS"));
	axioms.add(df.getOWLAnnotationAssertionAxiom(df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
			namedLCS.getIRI(), 
			df.getOWLLiteral("LCS of "+simEngine.label(a)+" and "+simEngine.label(b))));
	axioms.add(df.getOWLEquivalentClassesAxiom(namedLCS, lcs));

	// link the similarity object to the named LCS
	OWLAnnotationProperty lcsp = df.getOWLAnnotationProperty(annotationIRI("has_least_common_subsumer"));
	axioms.add(df.getOWLAnnotationAssertionAxiom(lcsp, result.getIRI(), namedLCS.getIRI()));
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:24,代码来源:DescriptionTreeSimilarity.java

示例15: cacheInformationContentInOntology

import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入依赖的package包/类
@Override
public OWLOntology cacheInformationContentInOntology() throws OWLOntologyCreationException, UnknownOWLClassException {
	OWLOntologyManager mgr = getSourceOntology().getOWLOntologyManager();
	OWLDataFactory df = mgr.getOWLDataFactory();
	OWLOntology o = mgr.createOntology();
	OWLAnnotationProperty p = df.getOWLAnnotationProperty(IRI.create(icIRIString));
	for (OWLClass c : getSourceOntology().getClassesInSignature()) {
		Double ic = getInformationContentForAttribute(c);
		if (ic != null) {
			mgr.addAxiom(o,
					df.getOWLAnnotationAssertionAxiom(p, 
							c.getIRI(), 
							df.getOWLLiteral(ic)));
		}

	}
	return o;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:19,代码来源:AbstractOwlSim.java


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