Package edu.isi.karma.modeling.ontology

Examples of edu.isi.karma.modeling.ontology.OntologyManager


    String encoding = wk.getEncoding();
    // Clone the worksheet just before the invocation
    Cloner cloner = new Cloner();
    this.worksheetBeforeInvocation = cloner.deepClone(wk);
   
    OntologyManager ontMgr = workspace.getOntologyManager();
    String alignmentId = AlignmentManager.Instance().constructAlignmentId(workspace.getId(), worksheetId);
    Alignment alignment = AlignmentManager.Instance().getAlignment(alignmentId);
    if (alignment == null) {
      alignment = new Alignment(ontMgr);
      AlignmentManager.Instance().addAlignmentToMap(alignmentId, alignment);
View Full Code Here


  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    UpdateContainer c = new UpdateContainer();
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    OntologyManager ontologyManager = workspace.getOntologyManager();
    if(ontologyManager.isEmpty())
      return new UpdateContainer(new ErrorUpdate("No ontology loaded."));
   
    worksheetName = worksheet.getTitle();
   
    String alignmentId = AlignmentManager.Instance().constructAlignmentId(workspace.getId(), worksheetId);
View Full Code Here

  @Override
  public UpdateContainer undoIt(Workspace workspace) {
   
    UpdateContainer c = new UpdateContainer();
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    OntologyManager ontologyManager = workspace.getOntologyManager();
    if(ontologyManager.isEmpty())
      return new UpdateContainer(new ErrorUpdate("No ontology loaded."));
   
    String alignmentId = AlignmentManager.Instance().constructAlignmentId(workspace.getId(), worksheetId);
    Alignment alignment = AlignmentManager.Instance().getAlignment(alignmentId);
    if (alignment == null) {
View Full Code Here

    return getFile().getName();
  }

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    OntologyManager ontManager = workspace.getOntologyManager();

    logger.debug("Loading ontology: " + getFile().getAbsolutePath());
    try {
      final boolean success = ontManager.doImportAndUpdateCache(
          getFile(), encoding);
      logger.debug("Done loading ontology: "
          + getFile().getAbsolutePath());
      return new UpdateContainer(new AbstractUpdate() {
        @Override
View Full Code Here

    // AlignmentManager.Instance().constructAlignmentId(workspace.getId(),
    // worksheetId);
    Alignment alignment = AlignmentManager.Instance().getAlignment(
        alignmentId);
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    OntologyManager ontMgr = workspace.getOntologyManager();

    // Save the original alignment for undo
    oldAlignment = alignment.getAlignmentClone();
    oldGraph = (DirectedWeightedMultigraph<Node, DefaultLink>) alignment
        .getGraph().clone();
View Full Code Here

        obj3.put("name", "AddValues");
        obj3.put("value", array.toString());
        obj3.put("type", "other");
        input.put(obj3);
        try {
          OntologyManager ontMgr = workspace.getOntologyManager();
          Label label = ontMgr.getUriLabel(incoming ? otherClass : predicate);
          AddValuesCommand command = (AddValuesCommand) addFactory.createCommand(input, workspace, hNodeId, worksheetId, hnode.getHTableId(), label.getDisplayName(), HNodeType.AugmentData, selection.getName());
          command.doIt(workspace);
          outputColumns.addAll(command.getOutputColumns());
          isNewNode |= command.isNewNode();
          if (command.isNewNode())
View Full Code Here

    /** Check if any ontology needs to be preloaded **/
    String preloadedOntDir = "/Users/mohsen/Documents/Academic/ISI/_GIT/Web-Karma/preloaded-ontologies/";
    File ontDir = new File(preloadedOntDir);
    if (ontDir.exists()) {
      File[] ontologies = ontDir.listFiles();
      OntologyManager mgr = new OntologyManager();
      for (File ontology: ontologies) {
        if (ontology.getName().endsWith(".owl") || ontology.getName().endsWith(".rdf")) {
          logger.info("Loading ontology file: " + ontology.getAbsolutePath());
          try {
            String encoding = EncodingDetector.detect(ontology);
            mgr.doImport(ontology, encoding);
          } catch (Exception t) {
            logger.error ("Error loading ontology: " + ontology.getAbsolutePath(), t);
          }
        }
      }
      // update the cache at the end when all files are added to the model
      mgr.updateCache();
      ModelLearningGraph.getInstance(mgr, ModelLearningGraphType.Sparse);

    } else {
      logger.info("No directory for preloading ontologies exists.");
    }
View Full Code Here

          }
        }
       
        SemanticTypeColumnModel model = new SemanticTypeUtil().predictColumnSemanticType(workspace, worksheet, currentColumnPath, 4, selection);
        if(model != null) {
          OntologyManager ontMgr = workspace.getOntologyManager();
          Alignment alignment = AlignmentManager.Instance().getAlignmentOrCreateIt(workspace.getId(), worksheetId, ontMgr);
          JSONObject json = model.getAsJSONObject(ontMgr, alignment);
          pw.print(json.toString());
        }
       
View Full Code Here

   
    /** Check if any ontology needs to be preloaded **/
    File ontDir = new File(Params.ONTOLOGY_DIR);
    if (ontDir.exists()) {
      File[] ontologies = ontDir.listFiles();
      OntologyManager mgr = new OntologyManager();
      for (File ontology: ontologies) {
        System.out.println(ontology.getName());
        if (ontology.getName().endsWith(".owl") ||
            ontology.getName().endsWith(".rdf") ||
            ontology.getName().endsWith(".n3") ||
            ontology.getName().endsWith(".ttl") ||
            ontology.getName().endsWith(".xml")) {
          logger.info("Loading ontology file: " + ontology.getAbsolutePath());
          try {
            String encoding = EncodingDetector.detect(ontology);
            mgr.doImport(ontology, encoding);
          } catch (Exception t) {
//            logger.error("Error loading ontology: " + ontology.getAbsolutePath(), t);
          }
        } else {
          logger.error ("the file: " + ontology.getAbsolutePath() + " does not have proper format: xml/rdf/n3/ttl/owl");
        }
      }
      // update the cache at the end when all files are added to the model
      mgr.updateCache();
      Set<String> test = mgr.getPossibleUris("http://example.com/layout/C01_", "http://example.com/layout/C02_");
      for (String s : test) {
        System.out.println(s);
      }
      Alignment al = new Alignment(mgr);
      ColumnNode c1 = al.addColumnNode("h1", "c1", null);
View Full Code Here

    return addedInternalNodes;
  }

  public static void main(String[] args) throws Exception {

    OntologyManager ontologyManager = new OntologyManager();
    File ff = new File(Params.ONTOLOGY_DIR);
    File[] files = ff.listFiles();
    for (File f : files) {
      ontologyManager.doImport(f, "UTF-8");
    }
    ontologyManager.updateCache()
   
    List<SemanticModel> semanticModels =
        ModelReader.importSemanticModelsFromJsonFiles(Params.MODEL_DIR, Params.MODEL_MAIN_FILE_EXT);

    String graphPath = Params.GRAPHS_DIR;
View Full Code Here

TOP

Related Classes of edu.isi.karma.modeling.ontology.OntologyManager

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.