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); }
/** * Checks an ontology and its import closure to see if it is within * this profile. * @param ontology The ontology to be checked. * @return An <code>OWLProfileReport</code> that describes whether or not the * ontology is within this profile. */ public OWLProfileReport checkOntology(OWLOntology ontology) { OWL2DLProfile profile = new OWL2DLProfile(); OWLProfileReport report = profile.checkOntology(ontology); Set<OWLProfileViolation> violations = new HashSet<OWLProfileViolation>(); violations.addAll(report.getViolations()); OWLOntologyWalker walker = new OWLOntologyWalker(ontology.getImportsClosure()); OWL2QLObjectVisitor visitor = new OWL2QLObjectVisitor(walker); walker.walkStructure(visitor); violations.addAll(visitor.getProfileViolations()); return new OWLProfileReport(this, violations); }
/** * Checks an ontology and its import closure to see if it is within * this profile. * @param ontology The ontology to be checked. * @return An <code>OWLProfileReport</code> that describes whether or not the * ontology is within this profile. */ public OWLProfileReport checkOntology(OWLOntology ontology) { OWL2DLProfile profile = new OWL2DLProfile(); OWLProfileReport report = profile.checkOntology(ontology); Set<OWLProfileViolation> violations = new HashSet<OWLProfileViolation>(); violations.addAll(report.getViolations()); OWLOntologyWalker walker = new OWLOntologyWalker(ontology.getImportsClosure()); OWL2RLObjectVisitor visitor = new OWL2RLObjectVisitor(walker); walker.walkStructure(visitor); violations.addAll(visitor.getProfileViolations()); return new OWLProfileReport(this, violations); }
/** * Checks an ontology and its import closure to see if it is within * this profile. * @param ontology The ontology to be checked. * @return An <code>OWLProfileReport</code> that describes whether or not the * ontology is within this profile. */ public OWLProfileReport checkOntology(OWLOntology ontology) { OWL2Profile owl2Profile = new OWL2Profile(); OWLProfileReport report = owl2Profile.checkOntology(ontology); Set<OWLProfileViolation> violations = new LinkedHashSet<OWLProfileViolation>(); if(!report.isInProfile()) { //We won't be in the OWL 2 DL Profile then! violations.addAll(report.getViolations()); } OWLOntologyWalker walker = new OWLOntologyWalker(ontology.getImportsClosure()); OWL2DLProfileObjectVisitor visitor = new OWL2DLProfileObjectVisitor(walker, ontology.getOWLOntologyManager()); walker.walkStructure(visitor); violations.addAll(visitor.getProfileViolations()); return new OWLProfileReport(this, violations); }
/** * Checks an ontology and its import closure to see if it is within * this profile. * @param ontology The ontology to be checked. * @param manager A manager which can be used to obtain the imports closure * of the ontology * @return An <code>OWLProfileReport</code> that describes whether or not the * ontology is within this profile. */ public OWLProfileReport checkOntology(OWLOntology ontology) { OWLOntologyWalker walker = new OWLOntologyWalker(ontology.getImportsClosure()); OWL2ProfileObjectWalker visitor = new OWL2ProfileObjectWalker(walker, ontology.getOWLOntologyManager()); walker.walkStructure(visitor); Set<OWLProfileViolation> pv = visitor.getProfileViolations(); return new OWLProfileReport(this, pv); }
private void preParsing(OWLOntology ontology, VowlData vowlData, OWLOntologyManager manager) { OWLOntologyWalker walker = new OWLOntologyWalker(ontology.importsClosure().collect(Collectors.toSet())); EntityCreationVisitor ecv = new EntityCreationVisitor(vowlData);
@Before public void setup() throws Exception { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); String uri = Resources.getResource("ontologies/cases/TestInverseOfTautology.owl").toURI().toString(); IRI iri = IRI.create(uri); manager.loadOntologyFromOntologyDocument(iri); OWLOntologyWalker walker = new OWLOntologyWalker(manager.getOntologies()); MappedProperty mappedProperty = new MappedProperty(NodeProperties.LABEL); List<String> properties = new ArrayList<String>(); properties.add("http://www.w3.org/2000/01/rdf-schema#label"); properties.add("http://www.w3.org/2004/02/skos/core#prefLabel"); mappedProperty.setProperties(properties); ArrayList<MappedProperty> mappedPropertyList = new ArrayList<MappedProperty>(); mappedPropertyList.add(mappedProperty); GraphOwlVisitor visitor = new GraphOwlVisitor(walker, graph, mappedPropertyList); walker.walkStructure(visitor); Map<String, String> categories = new HashMap<>(); try (Transaction tx = graphDb.beginTx()) { OwlPostprocessor postprocessor = new OwlPostprocessor(graphDb, categories); postprocessor.processCategories(categories); postprocessor.processSomeValuesFrom(); tx.success(); } }
@Before public void setup() throws Exception { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); String uri = Resources.getResource("ontologies/cases/TestEquivalentToInverse.owl").toURI().toString(); IRI iri = IRI.create(uri); manager.loadOntologyFromOntologyDocument(iri); OWLOntologyWalker walker = new OWLOntologyWalker(manager.getOntologies()); MappedProperty mappedProperty = new MappedProperty(NodeProperties.LABEL); List<String> properties = new ArrayList<String>(); properties.add("http://www.w3.org/2000/01/rdf-schema#label"); properties.add("http://www.w3.org/2004/02/skos/core#prefLabel"); mappedProperty.setProperties(properties); ArrayList<MappedProperty> mappedPropertyList = new ArrayList<MappedProperty>(); mappedPropertyList.add(mappedProperty); GraphOwlVisitor visitor = new GraphOwlVisitor(walker, graph, mappedPropertyList); walker.walkStructure(visitor); Map<String, String> categories = new HashMap<>(); try (Transaction tx = graphDb.beginTx()) { OwlPostprocessor postprocessor = new OwlPostprocessor(graphDb, categories); postprocessor.processCategories(categories); postprocessor.processSomeValuesFrom(); tx.success(); } }
when(versionInfo.getProperties()).thenReturn(newArrayList(OWL + "versionInfo")); propertyMap.add(versionInfo); OWLOntologyWalker walker = new OWLOntologyWalker(manager.getOntologies()); GraphOwlVisitor visitor = new GraphOwlVisitor(walker, graph, propertyMap); walker.walkStructure(visitor);
@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(); }
@Before public void setup() throws Exception { CliqueConfiguration cliqueConfiguration = new CliqueConfiguration(); Set<String> rel = new HashSet<String>(); rel.add(OwlRelationships.OWL_EQUIVALENT_CLASS.name()); cliqueConfiguration.setRelationships(rel); cliqueConfiguration.setLeaderAnnotation("http://www.monarchinitiative.org/MONARCH_cliqueLeader"); clique = new Clique(graphDb, cliqueConfiguration); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); String uri = Resources.getResource("ontologies/equivalence-cliques-test.owl").toURI().toString(); IRI iri = IRI.create(uri); manager.loadOntologyFromOntologyDocument(iri); OWLOntologyWalker walker = new OWLOntologyWalker(manager.getOntologies()); MappedProperty mappedProperty = new MappedProperty(NodeProperties.LABEL); List<String> properties = new ArrayList<String>(); properties.add("http://www.w3.org/2000/01/rdf-schema#label"); properties.add("http://www.w3.org/2004/02/skos/core#prefLabel"); mappedProperty.setProperties(properties); ArrayList<MappedProperty> mappedPropertyList = new ArrayList<MappedProperty>(); mappedPropertyList.add(mappedProperty); GraphOwlVisitor visitor = new GraphOwlVisitor(walker, graph, mappedPropertyList); walker.walkStructure(visitor); Map<String, String> categories = new HashMap<>(); try (Transaction tx = graphDb.beginTx()) { OwlPostprocessor postprocessor = new OwlPostprocessor(graphDb, categories); postprocessor.processCategories(categories); postprocessor.processSomeValuesFrom(); tx.success(); } }
@Override protected void before() throws Throwable { OwlApiUtils.loadOntology(manager, ontologyLocation); OWLOntologyWalker walker = new OWLOntologyWalker(manager.getOntologies()); graphDb = new TestGraphDatabaseFactory().newImpermanentDatabase(); Graph graph = new GraphTransactionalImpl(graphDb, new IdMap(), new RelationshipMap()); GraphOwlVisitor visitor = new GraphOwlVisitor(walker, graph, Collections.<MappedProperty>emptyList()); walker.walkStructure(visitor); }