本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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()));
}
示例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());
}
示例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));
}
示例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()));
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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))));
}
}
示例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"));
}
}
示例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;
}
示例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;
}