Exemplo n.º 1
0
  protected void loadOntology() {
    try {

      manager = OWLManager.createOWLOntologyManager();

      URI physicalURI = URI.create(PREFERENCES.getOntologyURL());

      // Now do the loading
      ontology = manager.loadOntologyFromPhysicalURI(physicalURI);

      manager.setPhysicalURIForOntology(ontology, physicalURI);

    } catch (final Exception e) {
      Runnable runnable =
          new Runnable() {
            public void run() {
              JOptionPane.showMessageDialog(
                  null,
                  "Could not create the ontology.  (This probably happened\n"
                      + "because the ontology could not be accessed due to network\n"
                      + "problems.)\n"
                      + "["
                      + e.getMessage()
                      + "]",
                  "Error",
                  JOptionPane.ERROR_MESSAGE);
              System.exit(1);
            }
          };
      SwingUtilities.invokeLater(runnable);
    }
  }
Exemplo n.º 2
0
  public void check(ExistsCondition condition) throws VerificationException {

    Resource resource = condition.getResource();
    assert resource.isInstantiated();
    assert resource.isLoaded();
    if (ONTOLOGY.equals(resource.getType().toString())) {
      URL url = (URL) resource.getValue();
      OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
      try {
        manager.loadOntologyFromPhysicalURI(url.toURI());
      } catch (Exception x) {
        throw new VerificationException("The resource " + url + " cannot be parsed as ontology", x);
      }
    }
  }