Beispiel #1
0
  @Before
  public void loadOwl() throws Exception {
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    String uri =
        Resources.getResource("ontologies/cases/" + getTestName() + ".owl").toURI().toString();
    IRI iri = IRI.create(uri);
    OWLOntology ont = manager.loadOntologyFromOntologyDocument(iri);
    if (performInference) {
      ReasonerConfiguration config = new ReasonerConfiguration();
      config.setFactory(ElkReasonerFactory.class.getCanonicalName());
      config.setAddDirectInferredEdges(true);
      ReasonerUtil util = new ReasonerUtil(config, manager, ont);
      util.reason();
    }
    OWLOntologyWalker walker = new OWLOntologyWalker(manager.getOntologies());

    GraphOwlVisitor visitor = new GraphOwlVisitor(walker, graph, new ArrayList<MappedProperty>());
    walker.walkStructure(visitor);

    OwlPostprocessor postprocessor =
        new OwlPostprocessor(graphDb, Collections.<String, String>emptyMap());
    postprocessor.processSomeValuesFrom();

    drawGraph();
  }
 public OWLProfileReport checkOntology(OWLOntology ontology) {
   this.ont = ontology;
   OWL2DLProfile profile = new OWL2DLProfile();
   OWLProfileReport report = profile.checkOntology(ontology);
   Set<OWLProfileViolation> violations = new HashSet<OWLProfileViolation>();
   violations.addAll(report.getViolations());
   OWLOntologyWalker ontologyWalker = new OWLOntologyWalker(ontology.getImportsClosure());
   OWL2ELProfileObjectVisitor visitor =
       new OWL2ELProfileObjectVisitor(ontologyWalker, ontology.getOWLOntologyManager());
   ontologyWalker.walkStructure(visitor);
   violations.addAll(visitor.getProfileViolations());
   return new OWLProfileReport(this, violations);
 }