Package edu.stanford.smi.protegex.owl.model

Examples of edu.stanford.smi.protegex.owl.model.OWLModel





  public void addExistentialPanel(OWLObjectProperty property) {
    OWLModel model = (OWLModel) getKnowledgeBase();
    OWLVizGraphPanel panel = new OWLVizGraphPanel(this,
                                                  new ExistentialGraphModel(model, property),
                                                  new AssertedClsHierarchyDisplayPanel(model));
    tabbedPane.add(property.getBrowserText() + " hierarchy", panel);
    closableTabs.add(panel);
View Full Code Here


    if(getKnowledgeBase() instanceof OWLModel) {
      // Create the tabbed pane
      tabbedPane = new JTabbedPane();
      add(tabbedPane);

      OWLModel model = (OWLModel) getKnowledgeBase();

      ///////////////////////////////////////////////////////////////////////
      //
      // Build the asserted subclass hierarchy tabs
      //
View Full Code Here

  public OWLVizGraphPanel(OWLVizTab tab,
                          GraphModel graphModel,
                          SubsumptionTreePanel subsumptionTreePanel) {
    this.tab = tab;
    this.treePanel = subsumptionTreePanel;
    OWLModel model = (OWLModel) tab.getKnowledgeBase();
    graphComponent = new GraphComponent();
    graphComponent.setGraphModel(graphModel);
    graphComponent.setNodeLabelRenderer(new OWLClsNodeLabelRenderer());
    graphComponent.setNodeRenderer(new OWLClsNodeRenderer(graphComponent.getController(),
                                                          graphComponent.getVisualisedObjectManager(),
                                                          new OWLClsNodeLabelRenderer(), model));
    graphComponent.setEdgeRenderer(new OWLClsEdgeRenderer(graphComponent.getController()));
    JPanel panel = new JPanel(new BorderLayout());

    // Create the thumbnail splitter that contains the treePanel
    // and thumbnail
    JSplitPane thumbnailSplitter = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false);
    thumbnailSplitter.add(treePanel, JSplitPane.TOP);
    thumbnailSplitter.add(new DefaultThumbnailView(graphComponent), JSplitPane.BOTTOM);
    JSplitPane splitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false);
    splitter.add(graphComponent, JSplitPane.RIGHT);
    splitter.add(thumbnailSplitter, JSplitPane.LEFT);
    panel.add(splitter);
    OWLInstancePopupProvider popupProvider = new OWLInstancePopupProvider("Asserted", model,
                                                                          model.getSlot(Model.Slot.DIRECT_SUPERCLASSES));
    graphComponent.setPopupProvider(popupProvider);
    createPopupMenu();
    setupListeners();

    setLayout(new BorderLayout());
View Full Code Here

        NewOwlProjectCreator creator = new NewOwlProjectCreator();
        creator.setOntologyName(""+path);
        creator.create(errors);
        if(!errors.isEmpty())
          throw new IOntologyError(""+errors);
        OWLModel model = creator.getOwlModel();
      //OWLModel model = ProtegeOWL.createJenaOWLModel();
     
      // setup default namespace
      model.getNamespaceManager().setDefaultNamespace(path+"#");
      OWLUtil.renameOntology(model,model.getDefaultOWLOntology(),""+path);
     
      // derive file names
      String name = PUtils.getName(path);
      String filePath = ""+(new File(dir,name)).toURI();
      name = PUtils.getOntologyName(path);
     
      // set project save path
      model.getProject().setProjectFilePath((new File(dir,name+".pprj")).getAbsolutePath());
      model.getOWLProject().getSettingsMap().setString("owl_file_name",filePath);
      return new POntology(model);
    }catch(Exception ex){
      throw new IOntologyException("problem creating new ontology "+path,ex);
    }
  }
View Full Code Here

        NewOwlProjectCreator creator = new NewOwlProjectCreator();
        creator.setOntologyName(""+path);
        creator.create(errors);
        if(!errors.isEmpty())
          throw new IOntologyError(""+errors);
        OWLModel model = creator.getOwlModel();
      //OWLModel model = ProtegeOWL.createJenaOWLModel();
     
      // setup default namespace
      model.getNamespaceManager().setDefaultNamespace(path+"#");
      OWLUtil.renameOntology(model,model.getDefaultOWLOntology(),""+path);
     
      /*
      for (Iterator it = model.getOWLOntologies().iterator(); it.hasNext();) {
        OWLOntology ont = (OWLOntology) it.next();
        System.out.println(ont);
View Full Code Here

      // load ontology
      o.load();
      //model.getDefaultOWLOntology().addImports((OWLOntology)((POntology)o).getResource());
      ImportHelper importHelper = new ImportHelper((JenaOWLModel) model);
      // get repository from import ontology
      OWLModel imodel = ((POntology)o).getModel();
      //Repository rep = imodel.getRepositoryManager().getRepository(o.getURI());
      String path = getDescriptor(imodel.getOWLProject().getSettingsMap());
      // I am tired, for some reason this property may be reset and
      // instead of full path URI it stores file name, well in this case
      // lets return location instead
      if(!path.contains("/"))
        path = o.getLocation();
View Full Code Here

      return null;
   
    if(value instanceof PResource){
      return ((PResource)value).getResource();
    }else if(value instanceof ILogicExpression){ 
      OWLModel model = resource.getOWLModel();
      ILogicExpression exp = (ILogicExpression) value;
      Object obj = null;
      if(exp.isSingleton()){
        if(exp.getExpressionType() == ILogicExpression.NOT){
          try{
            obj = model.createOWLComplementClass(
                (RDFSClass)convertSetValue(exp.getOperand()));
          }catch(ClassCastException ex){
            throw new IOntologyError("Cannot complement "+exp.getOperand()+", because it is not a class",ex);
          }
        }else
          obj =  convertSetValue(exp.getOperand());
      }else if(exp.getExpressionType() == ILogicExpression.AND){
        OWLIntersectionClass ac = model.createOWLIntersectionClass();
        for(Object o: exp){
          ac.addOperand((RDFSClass)convertSetValue(o));
        }
        obj = ac;
      }else if(exp.getExpressionType() == ILogicExpression.OR){
        OWLUnionClass oc = model.createOWLUnionClass();
        for(Object o: exp){
          oc.addOperand((RDFSClass)convertSetValue(o));
        }
        obj = oc;
      }
View Full Code Here

        NewOwlProjectCreator creator = new NewOwlProjectCreator();
        creator.setOntologyName(""+path);
        creator.create(errors);
        if(!errors.isEmpty())
          throw new IOntologyError(""+errors);
        OWLModel model = creator.getOwlModel();
      //OWLModel model = ProtegeOWL.createJenaOWLModel();
     
      // setup default namespace
      model.getNamespaceManager().setDefaultNamespace(path+"#");
      OWLUtil.renameOntology(model,model.getDefaultOWLOntology(),""+path);
     
      // derive file names
      String name = PUtils.getName(path);
      String filePath = ""+(new File(dir,name)).toURI();
      name = PUtils.getOntologyName(path);
     
      // set project save path
      model.getProject().setProjectFilePath((new File(dir,name+".pprj")).getAbsolutePath());
      model.getOWLProject().getSettingsMap().setString("owl_file_name",filePath);
      return new POntology(model);
    }catch(Exception ex){
      throw new IOntologyException("problem creating new ontology "+path,ex);
    }
  }
View Full Code Here

        NewOwlProjectCreator creator = new NewOwlProjectCreator();
        creator.setOntologyName(""+path);
        creator.create(errors);
        if(!errors.isEmpty())
          throw new IOntologyError(""+errors);
        OWLModel model = creator.getOwlModel();
      //OWLModel model = ProtegeOWL.createJenaOWLModel();
     
      // setup default namespace
      model.getNamespaceManager().setDefaultNamespace(path+"#");
      OWLUtil.renameOntology(model,model.getDefaultOWLOntology(),""+path);
     
      /*
      for (Iterator it = model.getOWLOntologies().iterator(); it.hasNext();) {
        OWLOntology ont = (OWLOntology) it.next();
        System.out.println(ont);
View Full Code Here

      // load ontology
      o.load();
      //model.getDefaultOWLOntology().addImports((OWLOntology)((POntology)o).getResource());
      ImportHelper importHelper = new ImportHelper((JenaOWLModel) model);
      // get repository from import ontology
      OWLModel imodel = ((POntology)o).getModel();
      //Repository rep = imodel.getRepositoryManager().getRepository(o.getURI());
      String path = getDescriptor(imodel.getOWLProject().getSettingsMap());
      // I am tired, for some reason this property may be reset and
      // instead of full path URI it stores file name, well in this case
      // lets return location instead
      if(!path.contains("/"))
        path = o.getLocation();
View Full Code Here

TOP

Related Classes of edu.stanford.smi.protegex.owl.model.OWLModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.