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


Java OWLRDFVocabulary类代码示例

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


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

示例1: getPrefLabels

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的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

示例2: getAltLabels

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
@Override
public Set<String> getAltLabels(OWLEntity cpt) {
	if(cpt == null)
		throw new IllegalArgumentException("cpt cannot be null");

	// The rdfs:label, if it exists
	Set<String> finalLabels = new HashSet<String>();
	Set<OWLAnnotation> annotations = cpt.getAnnotations(
			ontology,
			df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()));
	for(OWLAnnotation annot : annotations) {
		if(annot.getValue() instanceof OWLLiteral) {
			finalLabels.add(((OWLLiteral)annot.getValue()).getLiteral());
		}
	}
	return finalLabels;
}
 
开发者ID:lmazuel,项目名称:onagui,代码行数:18,代码来源:OWLAPIContainer.java

示例3: getSubClassAsObjectProperty

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
/**
 * @return
 */
private OWLProperty getSubClassAsObjectProperty() {
	if (is_a != null)
		return is_a;
	OWLDataFactory df = graph.getDataFactory();
	is_a = df.getOWLObjectProperty(IRI.create("http://foo.org#is_a"));
	OWLAnnotationAssertionAxiom ax = df.getOWLAnnotationAssertionAxiom(
			df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()), 
			is_a.getIRI(),
			df.getOWLLiteral("is_a"));
	graph.getManager().addAxiom(graph.getSourceOntology(), ax);
	return is_a;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:16,代码来源:GoMySQLDatabaseDumper.java

示例4: translateResultsToOWLAxioms

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的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

示例5: PelletOWL2ELProfile

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
public PelletOWL2ELProfile() {
  allowedDatatypes = new HashSet<IRI>();
  allowedDatatypes.add(OWLRDFVocabulary.RDF_XML_LITERAL.getIRI());
  allowedDatatypes.add(OWLRDFVocabulary.RDFS_LITERAL.getIRI());
  allowedDatatypes.add(OWL2Datatype.OWL_RATIONAL.getIRI());
  allowedDatatypes.add(OWL2Datatype.OWL_REAL.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_DECIMAL.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_DECIMAL.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_INTEGER.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_NON_NEGATIVE_INTEGER.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_STRING.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_NORMALIZED_STRING.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_TOKEN.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_NAME.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_NCNAME.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_NMTOKEN.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_HEX_BINARY.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_BASE_64_BINARY.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_ANY_URI.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_DATE_TIME.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_DATE_TIME_STAMP.getIRI());
}
 
开发者ID:ag-csw,项目名称:SVoNt,代码行数:23,代码来源:PelletOWL2ELProfile.java

示例6: labelAxiom

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
private OWLAxiom labelAxiom(OWLDataFactory f, OWLNamedIndividual individual, String annLabel) {
	return 
			f.getOWLAnnotationAssertionAxiom(
					f.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
					individual.getIRI(),
					f.getOWLLiteral(annLabel));
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:8,代码来源:GafToLegoTranslator.java

示例7: translateResultsToOWLAxioms

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
@Override
protected void translateResultsToOWLAxioms(String id, OWLNamedIndividual result, Set<OWLAxiom> axioms) {
	OWLDataFactory df = simEngine.getGraph().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, getLCS()));

	// 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,代码行数:16,代码来源:ConjunctiveSetInformationContentRatioSimilarity.java

示例8: addLabel

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
public static void addLabel(OWLNamedIndividual i, OWLGraphWrapper g, OWLReasoner reasoner) {
	OWLOntology ontology = g.getSourceOntology();
	Set<OWLClass> types = new HashSet<>();
	if (reasoner == null) {
		for (OWLClassExpression x : OwlHelper.getTypes(i, ontology)) {
			if (!x.isAnonymous()) {
				types.add((OWLClass) x);
			}
		}
	}
	else {
		 types = reasoner.getTypes(i, true).getFlattened();
	}
	StringBuffer iLabel = null;
	for (OWLClass type : types) {
		String label = g.getLabel(type);
		if (iLabel == null)
			iLabel = new StringBuffer("a");
		else
			iLabel.append(" & ");
		iLabel.append(" "+label);
	}
	OWLDataFactory df = g.getDataFactory();
	OWLAxiom ax =
			df.getOWLAnnotationAssertionAxiom(df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
			i.getIRI(), 
			df.getOWLLiteral(iLabel.toString()));
	g.getManager().addAxiom(ontology,
			ax);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:31,代码来源:TransformationUtils.java

示例9: addCommentToOntology

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
private void addCommentToOntology(OWLOntology ont, String cmt) {
	OWLDataFactory df = getDataFactory();
	OWLAnnotationProperty p = 
			df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_COMMENT.getIRI());
	OWLLiteral v = df.getOWLLiteral(cmt);
	OWLAnnotation ann = df.getOWLAnnotation(p, v);
	AddOntologyAnnotation addAnn = 
			new AddOntologyAnnotation(ont, ann);
	getManager().applyChange(addAnn);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:11,代码来源:OWLGraphWrapperBasic.java

示例10: testMerge

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
@Test
public void testMerge() throws OWLOntologyCreationException, IOException, IncoherentOntologyException, OWLOntologyStorageException {
    ParserWrapper pw = new ParserWrapper();
    OWLGraphWrapper g =
            pw.parseToOWLGraph(getResourceIRIString("equivalence-set-merge-util-test.obo"));
    OWLOntology ont1 = g.getSourceOntology();
    ElkReasonerFactory rf = new ElkReasonerFactory();
    OWLReasoner reasoner = rf.createReasoner(ont1);
    EquivalenceSetMergeUtil esmu = new EquivalenceSetMergeUtil(g, reasoner);
    esmu.setPrefixScore("A", 8.0);
    esmu.setPrefixScore("B", 6.0);
    esmu.setPrefixScore("C", 4.0);
    OWLAnnotationProperty lp = g.getDataFactory().getOWLAnnotationProperty( OWLRDFVocabulary.RDFS_LABEL.getIRI() );
    esmu.setPropertyPrefixScore( lp, "C", 5.0);
    esmu.setPropertyPrefixScore( lp, "B", 4.0);
    esmu.setPropertyPrefixScore( lp, "A", 3.0);
    
    OWLAnnotationProperty dp = g.getDataFactory().getOWLAnnotationProperty( Obo2OWLVocabulary.IRI_IAO_0000115.getIRI() );
    esmu.setPropertyPrefixScore( dp, "B", 5.0);
    esmu.setPropertyPrefixScore( dp, "A", 4.0);
    esmu.setPropertyPrefixScore( dp, "C", 3.0);
    
    esmu.setRemoveAxiomatizedXRefs(true);

    esmu.merge();
    OWLDocumentFormat fmt = new OBODocumentFormat();
    pw.saveOWL(g.getSourceOntology(), "target/esmu.owl");
    //pw.setCheckOboDoc(false);
    pw.saveOWL(g.getSourceOntology(), fmt, "target/esmu.obo");
    
    OWLOntology ont2 = pw.parseOWL(getResourceIRIString("equivalence-set-merge-util-expected.obo"));
    assertEquals(0, compare(ont1, ont2));
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:34,代码来源:EquivalenceSetMergeUtilTest.java

示例11: renderControlledAnnotations

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
private void renderControlledAnnotations(OWLNamedObject c) {
	Set<OWLAnnotationAssertionAxiom> annotationAxioms = 
			ontology.getAnnotationAssertionAxioms(c.getIRI());
	renderAnnotationAxiom("Label", OWLRDFVocabulary.RDFS_LABEL.getIRI(), annotationAxioms);
	renderAnnotationAxiom("Definition", Obo2OWLVocabulary.IRI_IAO_0000115.getIRI(), annotationAxioms);
	renderAnnotationAxiom("Comment", OWLRDFVocabulary.RDFS_COMMENT.getIRI(), annotationAxioms);

	renderSection("Synonyms");

	renderAnnotationAxioms("", 
			Obo2OWLVocabulary.IRI_OIO_hasExactSynonym.getIRI(), 
			annotationAxioms);
	renderAnnotationAxioms("", 
			Obo2OWLVocabulary.IRI_OIO_hasBroadSynonym.getIRI(), 
			annotationAxioms);
	renderAnnotationAxioms("", 
			Obo2OWLVocabulary.IRI_OIO_hasNarrowSynonym.getIRI(), 
			annotationAxioms);
	renderAnnotationAxioms("", 
			Obo2OWLVocabulary.IRI_OIO_hasRelatedSynonym.getIRI(), 
			annotationAxioms);

	renderSection("Cross-references");

	renderAnnotationAxioms("", 
			Obo2OWLVocabulary.IRI_OIO_hasDbXref.getIRI(), 
			annotationAxioms);

	renderSection("Subsets");

	renderAnnotationAxioms("", 
			Obo2OWLVocabulary.IRI_OIO_inSubset.getIRI(), 
			annotationAxioms);		
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:35,代码来源:MarkdownRenderer.java

示例12: OWLExporter

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
/**
 * Instantiates a {@link OWLExporter} from the specified parameters.
 *
 * @param fileOutputStream the file output stream
 * @throws Exception if something goes wrong in constructor
 */
public OWLExporter(OutputStream fileOutputStream) throws Exception {
  dos = new DataOutputStream(new BufferedOutputStream(fileOutputStream));
  if (snomed == null) {
    // Create a new ontology
    snomed =
        manager
            .createOntology(new OWLOntologyID(snomedIRI, snomedVersionIRI));
    format.setParameter("xml:base", snomedNamespace);

    // Obtain SNOMED root concept
    // TODO: this needs to be generalized
    UUID snomedRootUUID = Taxonomies.SNOMED.getUuids()[0];
    ConceptVersionBI snomedRootConcept =
        OTFUtility.getConceptVersion(snomedRootUUID);

    // Add annotation based on root concept
    for (DescriptionVersionBI<?> desc : snomedRootConcept
        .getDescriptionsActive()) {
      if (desc.getText().contains("Release")) {
        manager.applyChange(new AddOntologyAnnotation(snomed, factory
            .getOWLAnnotation(factory
                .getOWLAnnotationProperty(OWLRDFVocabulary.OWL_VERSION_INFO
                    .getIRI()), factory.getOWLLiteral(desc.getText()))));
      }
      if (desc.getText().contains("IHTSDO")) {
        manager.applyChange(new AddOntologyAnnotation(snomed, factory
            .getOWLAnnotation(factory
                .getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_COMMENT
                    .getIRI()), factory.getOWLLiteral(desc.getText()))));
      }
    }
    manager.applyChange(new AddOntologyAnnotation(snomed, factory
        .getOWLAnnotation(factory
            .getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
            factory.getOWLLiteral(snomedOntologyName))));
  }
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:44,代码来源:OWLExporter.java

示例13: isDeprecated

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
static boolean isDeprecated(Node n) {
  if (!n.hasProperty(OWLRDFVocabulary.OWL_DEPRECATED.toString())) {
    return false;
  }
  if (n.getProperty(OWLRDFVocabulary.OWL_DEPRECATED.toString()) instanceof Boolean) {
    return (Boolean) n.getProperty(OWLRDFVocabulary.OWL_DEPRECATED.toString());
  } else {
    return Boolean.valueOf((String)n.getProperty(OWLRDFVocabulary.OWL_DEPRECATED.toString(), "false"));
  }
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:11,代码来源:NodeTransformer.java

示例14: registerNode

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
private ONodeID registerNode(OWLClassExpression cl) {
        if (owl2oclass.containsKey(cl)) return owl2oclass.get(cl);
        String uri = "";
        if (cl.isAnonymous()) {
            uri = cl.toString();
        } else {
            uri = cl.asOWLClass().getIRI().toString();
            OWLDataFactory f = manager.getOWLDataFactory();
            if (isNumericID(cl.toString())) {
                for (OWLOntology o : ontologies) {
                    Set<OWLAnnotation> labels = cl.asOWLClass()
                            .getAnnotations(o, f
                                    .getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL
                                            .getIRI()));
                    if (RENDER_CONCEPT_NAMES && labels != null && labels.size() > 0) {
                        uri = uri.replace("#", "/");
                        uri += "#" + labels.toArray(new OWLAnnotation[]{})[0].getValue();
                        uri = uri.replace("\"", "");
                        uri = uri.replace(" ", "_");
                        uri = uri.split("@")[0];
//          logger.debug("setting label for " + cl);
                        break;
                    }
                }
            }
        }
        ONodeID nodeid = new ONodeIDImpl(uri, false);
        owl2oclass.put(cl, nodeid);
        return nodeid;
    }
 
开发者ID:naditina,项目名称:gate-semano,代码行数:31,代码来源:OntologyParser.java

示例15: EntityType

import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; //导入依赖的package包/类
private EntityType(@Nonnull String name, @Nonnull String print,
        @Nonnull String pluralPrint, @Nonnull OWLRDFVocabulary vocabulary) {
    this.name = name;
    this.vocabulary = vocabulary;
    printName = print;
    pluralPrintName = pluralPrint;
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:8,代码来源:EntityType.java


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