Ejemplo n.º 1
0
  private void ConnectKnowledgeBaseBtnMouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_ConnectKnowledgeBaseBtnMouseClicked

    String sPrjFile = ProjectNameTF.getText().trim();
    String sLocationURI = sURI + "Location";

    Collection errors = new ArrayList();
    Date d1 = new Date();
    long l1 = d1.getTime();
    prj = Project.loadProjectFromFile(sPrjFile, errors);
    owlModel = (OWLModel) prj.getKnowledgeBase();

    kb = prj.getKnowledgeBase();
    URI uri = prj.getActiveRootURI();

    Collection colNumberOfInstance = kb.getInstances();
    lNumberOfInstance = colNumberOfInstance.size();

    Date d2 = new Date();
    long l2 = d2.getTime();
    lLoadedTime = (l2 - l1);

    theLogger.info("Connected to MySQL in " + lLoadedTime + " ms");
    theLogger.info("KB has " + lNumberOfInstance + " instances");

    LoggingAreaTA.append("Project has " + lNumberOfInstance + " in total\n");
    LoggingAreaTA.append("Project is loaded in " + lLoadedTime + " ms\n");
  } // GEN-LAST:event_ConnectKnowledgeBaseBtnMouseClicked
Ejemplo n.º 2
0
 protected void ensureIconFlagsLoaded() {
   if (!_hasLoadedIconFlags) {
     Project p = ProjectManager.getProjectManager().getCurrentProject();
     if (p != null) {
       _displayAbstractIcon = p.getDisplayAbstractClassIcon();
       _displayMultipleParentsIcon = p.getDisplayMultiParentClassIcon();
       _hasLoadedIconFlags = true;
     }
   }
 }
Ejemplo n.º 3
0
 public void testGetProject() {
   if (!Server_Test.isServerRunning()) {
     return;
   }
   Project p =
       RemoteProjectManager.getInstance()
           .getProject(Server_Test.HOST, USER, PASSWORD, PROJECT_NAME, true);
   assertNotNull(p);
   OWLModel kb = (OWLModel) p.getKnowledgeBase();
   Cls cls = kb.getOWLNamedClass(kb.getNamespaceManager().getDefaultNamespace() + "Pizza");
   Log.getLogger().info("found " + cls + " with frame id = " + cls.getFrameID());
   assertNotNull(cls);
   p.dispose();
 }
Ejemplo n.º 4
0
  @Override
  public void create(Collection errors) throws OntologyLoadException {
    project = Project.createNewProject(factory, errors);
    owlModel = (JenaOWLModel) project.getKnowledgeBase();

    if (ontologyName == null) {
      ontologyName = FactoryUtils.generateOntologyURIBase();
    }
    try {
      FactoryUtils.addOntologyToTripleStore(
          owlModel, owlModel.getTripleStoreModel().getActiveTripleStore(), ontologyName);
    } catch (AlreadyImportedException e) {
      throw new RuntimeException("This shouldn't happen", e);
    }
    addViewSettings(project.getSources());
  }