本文整理汇总了Java中org.semanticweb.owlapi.model.OWLOntologyFormat类的典型用法代码示例。如果您正苦于以下问题:Java OWLOntologyFormat类的具体用法?Java OWLOntologyFormat怎么用?Java OWLOntologyFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OWLOntologyFormat类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLOntologyFormat类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPrefixes
import org.semanticweb.owlapi.model.OWLOntologyFormat; //导入依赖的package包/类
protected void createPrefixes() {
m_prefixes = new Prefixes();
m_prefixes.declareSemanticWebPrefixes();
Set<String> individualIRIs = new HashSet<String>();
Set<String> anonIndividualIRIs = new HashSet<String>();
for (Individual individual : m_dlOntology.getAllIndividuals())
if (individual.isAnonymous())
addIRI(individual.getIRI(), anonIndividualIRIs);
else
addIRI(individual.getIRI(), individualIRIs);
m_prefixes.declareInternalPrefixes(individualIRIs, anonIndividualIRIs);
m_prefixes.declareDefaultPrefix(m_dlOntology.getOntologyIRI() + "#");
// declare prefixes as used in the ontology if possible
OWLOntologyFormat format = m_rootOntology.getOWLOntologyManager()
.getOntologyFormat(m_rootOntology);
if (format instanceof PrefixOWLOntologyFormat) {
PrefixOWLOntologyFormat prefixFormat = (PrefixOWLOntologyFormat) format;
for (String prefixName : prefixFormat.getPrefixName2PrefixMap()
.keySet()) {
String prefix = prefixFormat.getPrefixName2PrefixMap().get(
prefixName);
if (m_prefixes.getPrefixName(prefix) == null)
try {
m_prefixes.declarePrefix(prefixName, prefix);
} catch (IllegalArgumentException e) {
// ignore
}
}
}
}
示例2: printRelations
import org.semanticweb.owlapi.model.OWLOntologyFormat; //导入依赖的package包/类
/**
* Print out RelEx relations. All relations shown
* in a binary form.
*
* Example:
* _subj(throw, John)
* _obj(throw, ball)
* tense(throw, past)
* definite-FLAG(ball, T)
* noun_number(ball, singular)
*/
public void printRelations(ParsedSentence parse, String sentence, int sentence_id, String ontologyname)
{
try
{
sent = sentence;
//Add the sentence to Sentence Class
this.sentence_id = sentence_id;
sentenceInd = factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#" + "sentence_" + sentence_id));
//OWLAnnotationProperty p = new OWLAnnotationPropertyImpl(IRI.create(sentence));
//OWLAnnotation label = factory.getOWLAnnotation(sentence);
OWLOntologyFormat ontologyFormat = manager.getOntologyFormat(ontology);
OWLAnnotation label = (OWLAnnotation) factory.getOWLAnnotationProperty(sentence, (PrefixManager) ontologyFormat);
OWLClassAssertionAxiom sentClass = factory.getOWLClassAssertionAxiom(this.sentence,sentenceInd);
OWLAnnotationAssertionAxiom labelClass = factory.getOWLAnnotationAssertionAxiom((OWLAnnotationSubject) sentClass, label);
manager.applyChange(new AddAxiom(ontology, sentClass));
manager.applyChange(new AddAxiom(ontology, labelClass));
printRelations(parse, null);
}
catch (OWLOntologyChangeException ex)
{
Logger.getLogger(OWLView.class.getName()).log(Level.SEVERE, null, ex);
}
}