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


Java OWLObjectRenderer类代码示例

本文整理汇总了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);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:8,代码来源:OWLPrettyPrinter.java

示例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));
        }
    }
}
 
开发者ID:martin-kuba,项目名称:owl2-swrl-tutorial,代码行数:13,代码来源:SWRLBuiltInsTutorial.java

示例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);

			}
		}					
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:64,代码来源:SimCommandRunner.java

示例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));
    }
}
 
开发者ID:martin-kuba,项目名称:owl2-swrl-tutorial,代码行数:7,代码来源:IndividualSWRLBuiltinTutorial.java

示例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);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:11,代码来源:OWLPrettyPrinter.java


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