本文整理汇总了Java中org.semanticweb.owlapi.io.OWLObjectRenderer类的典型用法代码示例。如果您正苦于以下问题:Java OWLObjectRenderer类的具体用法?Java OWLObjectRenderer怎么用?Java OWLObjectRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OWLObjectRenderer类属于org.semanticweb.owlapi.io包,在下文中一共展示了OWLObjectRenderer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OWLPrettyPrinter
import org.semanticweb.owlapi.io.OWLObjectRenderer; //导入依赖的package包/类
public OWLPrettyPrinter(OWLGraphWrapperExtended graph, OWLObjectRenderer r) {
super();
this.graph = graph;
shortFormProvider = new LabelProvider(graph);
renderer = r;
renderer.setShortFormProvider(shortFormProvider);
}
示例2: listAllDataPropertyValues
import org.semanticweb.owlapi.io.OWLObjectRenderer; //导入依赖的package包/类
static void listAllDataPropertyValues(OWLNamedIndividual individual, OWLOntology ontology, OWLReasoner reasoner) {
OWLObjectRenderer renderer = new DLSyntaxObjectRenderer();
Multimap<OWLDataPropertyExpression, OWLLiteral> assertedValues = EntitySearcher.getDataPropertyValues(individual, ontology);
for (OWLDataProperty dataProp : ontology.getDataPropertiesInSignature(Imports.INCLUDED)) {
for (OWLLiteral literal : reasoner.getDataPropertyValues(individual, dataProp)) {
Collection<OWLLiteral> literalSet = assertedValues.get(dataProp);
boolean asserted = (literalSet != null && literalSet.contains(literal));
System.out.println((asserted ? "asserted" : "inferred") + " data property for " + renderer.render(individual) + " : "
+ renderer.render(dataProp) + " -> " + renderer.render(literal));
}
}
}
示例3: lcsxAll
import org.semanticweb.owlapi.io.OWLObjectRenderer; //导入依赖的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);
}
}
}
}
示例4: listSWRLRules
import org.semanticweb.owlapi.io.OWLObjectRenderer; //导入依赖的package包/类
private static void listSWRLRules(OWLOntology ontology) {
OWLObjectRenderer renderer = new DLSyntaxObjectRenderer();
for (SWRLRule rule : ontology.getAxioms(AxiomType.SWRL_RULE)) {
System.out.println(renderer.render(rule));
}
}
示例5: createManchesterSyntaxPrettyPrinter
import org.semanticweb.owlapi.io.OWLObjectRenderer; //导入依赖的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);
}