本文整理汇总了Java中org.semanticweb.owlapi.manchestersyntax.renderer.ManchesterOWLSyntaxOWLObjectRendererImpl类的典型用法代码示例。如果您正苦于以下问题:Java ManchesterOWLSyntaxOWLObjectRendererImpl类的具体用法?Java ManchesterOWLSyntaxOWLObjectRendererImpl怎么用?Java ManchesterOWLSyntaxOWLObjectRendererImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ManchesterOWLSyntaxOWLObjectRendererImpl类属于org.semanticweb.owlapi.manchestersyntax.renderer包,在下文中一共展示了ManchesterOWLSyntaxOWLObjectRendererImpl类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lcsxAll
import org.semanticweb.owlapi.manchestersyntax.renderer.ManchesterOWLSyntaxOWLObjectRendererImpl; //导入依赖的package包/类
@CLIMethod("--lcsx-all")
public void lcsxAll(Opts opts) throws Exception {
opts.info("LABEL", "ont 1");
String ont1 = opts.nextOpt();
opts.info("LABEL", "ont 2");
String ont2 = opts.nextOpt();
if (simOnt == null) {
simOnt = g.getManager().createOntology();
}
SimEngine se = new SimEngine(g);
Set <OWLObject> objs1 = new HashSet<OWLObject>();
Set <OWLObject> objs2 = new HashSet<OWLObject>();
System.out.println(ont1+" -vs- "+ont2);
for (OWLObject x : g.getAllOWLObjects()) {
if (! (x instanceof OWLClass))
continue;
String id = g.getIdentifier(x);
if (id.startsWith(ont1)) {
objs1.add(x);
}
if (id.startsWith(ont2)) {
objs2.add(x);
}
}
Set<OWLClassExpression> lcsh = new HashSet<OWLClassExpression>();
OWLObjectRenderer r = new ManchesterOWLSyntaxOWLObjectRendererImpl();
OWLPrettyPrinter owlpp = new OWLPrettyPrinter(g, r);
owlpp.hideIds();
for (OWLObject a : objs1) {
for (OWLObject b : objs2) {
OWLClassExpression lcs = se.getLeastCommonSubsumerSimpleClassExpression(a, b);
if (lcs instanceof OWLAnonymousClassExpression) {
if (lcsh.contains(lcs)) {
// already seen
continue;
}
lcsh.add(lcs);
String label = owlpp.render(lcs);
IRI iri = IRI.create(Obo2OWLConstants.DEFAULT_IRI_PREFIX+"U_"+
g.getIdentifier(a).replaceAll(":", "_")+"_"
+"_"+g.getIdentifier(b).replaceAll(":", "_"));
OWLClass namedClass = g.getDataFactory().getOWLClass(iri);
// TODO - use java obol to generate meaningful names
OWLEquivalentClassesAxiom ax = g.getDataFactory().getOWLEquivalentClassesAxiom(namedClass , lcs);
g.getManager().addAxiom(simOnt, ax);
g.getManager().addAxiom(simOnt,
g.getDataFactory().getOWLAnnotationAssertionAxiom(
g.getDataFactory().getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
iri,
g.getDataFactory().getOWLLiteral(label)));
System.out.println("LCSX:"+owlpp.render(a)+" -vs- "+owlpp.render(b)+" = \n "+label);
//LOG.info(" Adding:"+owlpp.render(ax));
LOG.info(" Adding:"+ax);
}
}
}
}
示例2: createManchesterSyntaxPrettyPrinter
import org.semanticweb.owlapi.manchestersyntax.renderer.ManchesterOWLSyntaxOWLObjectRendererImpl; //导入依赖的package包/类
/**
* Create an {@link OWLPrettyPrinter}, which renders in OWL Manchester syntax.
*
* @param graph
* @return printer
*/
public static OWLPrettyPrinter createManchesterSyntaxPrettyPrinter(OWLGraphWrapperExtended graph) {
OWLObjectRenderer r = new ManchesterOWLSyntaxOWLObjectRendererImpl();
return new OWLPrettyPrinter(graph, r);
}