Package edu.isi.karma.modeling.alignment

Examples of edu.isi.karma.modeling.alignment.SemanticModel


          new DirectedWeightedMultigraph<Node, LabeledLink>(LabeledLink.class);
     
      for (Node n : steinerNodes)
        tree.addVertex(n);
     
      SemanticModel sm = new SemanticModel(new RandomGUID().toString(), tree);
      SortableSemanticModel sortableSemanticModel = new SortableSemanticModel(sm, null);
      sortableSemanticModels.add(sortableSemanticModel);
      return sortableSemanticModels;
    }
   
    logger.info("graph nodes: " + this.graphBuilder.getGraph().vertexSet().size());
    logger.info("graph links: " + this.graphBuilder.getGraph().edgeSet().size());

    logger.info("number of steiner sets: " + candidateSteinerSets.numberOfCandidateSets());

//    logger.info("updating weights according to training data ...");
//    long start = System.currentTimeMillis();
//    this.updateWeights();
//    long updateWightsElapsedTimeMillis = System.currentTimeMillis() - start;
//    logger.info("time to update weights: " + (updateWightsElapsedTimeMillis/1000F));
   
    logger.info("computing steiner trees ...");
    int number = 1;
    for (SteinerNodes sn : candidateSteinerSets.getSteinerSets()) {
      if (sn == null) continue;
      logger.debug("computing steiner tree for steiner nodes set " + number + " ...");
      logger.debug(sn.getScoreDetailsString());
      number++;
//      logger.info("START ...");
     
      List<DirectedWeightedMultigraph<Node, LabeledLink>> topKSteinerTrees;
//      if (this.graphBuilder instanceof GraphBuilderTopK) {
//        topKSteinerTrees =  ((GraphBuilderTopK)this.graphBuilder).getTopKSteinerTrees(sn.getNodes(), ModelingConfiguration.getMaxCandidateModels());
//      }
//      else
      {
        topKSteinerTrees = new LinkedList<DirectedWeightedMultigraph<Node, LabeledLink>>();
        SteinerTree steinerTree = new SteinerTree(
            new AsUndirectedGraph<Node, DefaultLink>(this.graphBuilder.getGraph()), Lists.newLinkedList(sn.getNodes()));
        WeightedMultigraph<Node, DefaultLink> t = steinerTree.getDefaultSteinerTree();
        TreePostProcess treePostProcess = new TreePostProcess(this.graphBuilder, t);
        if (treePostProcess.getTree() != null)
          topKSteinerTrees.add(treePostProcess.getTree());
      }
     
//      System.out.println(GraphUtil.labeledGraphToString(treePostProcess.getTree()));
     
//      logger.info("END ...");

      for (DirectedWeightedMultigraph<Node, LabeledLink> tree: topKSteinerTrees) {
        if (tree != null) {
//          System.out.println();
          SemanticModel sm = new SemanticModel(new RandomGUID().toString(),
              tree,
              columnNodes,
              sn.getMappingToSourceColumns()
              );
          SortableSemanticModel sortableSemanticModel =
View Full Code Here


  }

  @SuppressWarnings("unused")
  private static void getStatistics1(List<SemanticModel> semanticModels) {
    for (int i = 0; i < semanticModels.size(); i++) {
      SemanticModel source = semanticModels.get(i);
      int attributeCount = source.getColumnNodes().size();
      int nodeCount = source.getGraph().vertexSet().size();
      int linkCount = source.getGraph().edgeSet().size();
      int datanodeCount = 0;
      int classNodeCount = 0;
      for (Node n : source.getGraph().vertexSet()) {
        if (n instanceof InternalNode) classNodeCount++;
        if (n instanceof ColumnNode) datanodeCount++;
      }
      System.out.println(attributeCount + "\t" + nodeCount + "\t" + linkCount + "\t" + classNodeCount + "\t" + datanodeCount);
     
      List<ColumnNode> columnNodes = source.getColumnNodes();
      getStatistics2(columnNodes);

    }
  }
View Full Code Here

//    for (int i = 0; i <= 10; i++) {
    int i = 0; {

      resultFile.flush();
      int newSourceIndex = i;
      SemanticModel newSource = semanticModels.get(newSourceIndex);

      logger.info("======================================================");
      logger.info(newSource.getName() + "(#attributes:" + newSource.getColumnNodes().size() + ")");
      System.out.println(newSource.getName() + "(#attributes:" + newSource.getColumnNodes().size() + ")");
      logger.info("======================================================");

      if (!iterativeEvaluation)
        numberOfKnownModels = semanticModels.size() - 1;
      else
        numberOfKnownModels = 0;

      if (resultsArray[0].length() > 0resultsArray[0].append(" \t ");     
      resultsArray[0].append(newSource.getName() + "(" + newSource.getColumnNodes().size() + ")" + "\t" + " " + "\t" + " ");
      if (resultsArray[1].length() > 0resultsArray[1].append(" \t ");     
      resultsArray[1].append("p \t r \t t");

//      numberOfKnownModels = 2;
      while (numberOfKnownModels <= semanticModels.size() - 1)
      {

        trainingData.clear();

        int j = 0, count = 0;
        while (count < numberOfKnownModels) {
          if (j != newSourceIndex) {
            trainingData.add(semanticModels.get(j));
            count++;
          }
          j++;
        }

        modelLearningGraph = (ModelLearningGraphCompact)ModelLearningGraph.getEmptyInstance(ontologyManager, ModelLearningGraphType.Compact);
       
       
        SemanticModel correctModel = newSource;
        List<ColumnNode> columnNodes = correctModel.getColumnNodes();
        //        if (useCorrectType && numberOfCRFCandidates > 1)
        //          updateCrfSemanticTypesForResearchEvaluation(columnNodes);

        List<Node> steinerNodes = new LinkedList<Node>(columnNodes);
        modelLearner = new ModelLearner(ontologyManager, steinerNodes);
View Full Code Here

    }

    List<SortableSemanticModel_Old> hypothesisList = this.hypothesize(true, NUM_SEMANTIC_TYPES);
    if (hypothesisList != null && !hypothesisList.isEmpty()) {
      SortableSemanticModel_Old m = hypothesisList.get(0);
      this.semanticModel = new SemanticModel(m);
    } else {
      this.semanticModel = null;
    }
  }
View Full Code Here

      logger.debug("computing steiner tree for steiner nodes set " + count + " ...");
      logger.debug(sn.getScoreDetailsString());
      DirectedWeightedMultigraph<Node, LabeledLink> tree = computeSteinerTree(sn.getNodes());
      count ++;
      if (tree != null) {
        SemanticModel sm = new SemanticModel(new RandomGUID().toString(),
            tree,
            columnNodes,
            sn.getMappingToSourceColumns()
            );
        SortableSemanticModel_Old sortableSemanticModel =
View Full Code Here

  }

  @SuppressWarnings("unused")
  private static void getStatistics1(List<SemanticModel> semanticModels) {
    for (int i = 0; i < semanticModels.size(); i++) {
      SemanticModel source = semanticModels.get(i);
      int attributeCount = source.getColumnNodes().size();
      int nodeCount = source.getGraph().vertexSet().size();
      int linkCount = source.getGraph().edgeSet().size();
      int datanodeCount = 0;
      int classNodeCount = 0;
      for (Node n : source.getGraph().vertexSet()) {
        if (n instanceof InternalNode) classNodeCount++;
        if (n instanceof ColumnNode) datanodeCount++;
      }
      System.out.println(attributeCount + "\t" + nodeCount + "\t" + linkCount + "\t" + classNodeCount + "\t" + datanodeCount);
     
      List<ColumnNode> columnNodes = source.getColumnNodes();
      getStatistics2(columnNodes);

    }
  }
View Full Code Here

//    for (int i = 0; i <= 10; i++) {
//    int i = 3; {

      resultFile.flush();
      int newSourceIndex = i;
      SemanticModel newSource = semanticModels.get(newSourceIndex);

      logger.info("======================================================");
      logger.info(newSource.getName() + "(#attributes:" + newSource.getColumnNodes().size() + ")");
      System.out.println(newSource.getName() + "(#attributes:" + newSource.getColumnNodes().size() + ")");
      logger.info("======================================================");

      if (!iterativeEvaluation)
        numberOfKnownModels = semanticModels.size() - 1;
      else
        numberOfKnownModels = 0;

      if (resultsArray[0].length() > 0resultsArray[0].append(" \t ");     
      resultsArray[0].append(newSource.getName() + "(" + newSource.getColumnNodes().size() + ")" + "\t" + " " + "\t" + " ");
      if (resultsArray[1].length() > 0resultsArray[1].append(" \t ");     
      resultsArray[1].append("p \t r \t t");


      while (numberOfKnownModels <= semanticModels.size() - 1) {

        trainingData.clear();

        int j = 0, count = 0;
        while (count < numberOfKnownModels) {
          if (j != newSourceIndex) {
            trainingData.add(semanticModels.get(j));
            count++;
          }
          j++;
        }

        modelLearningGraph = (ModelLearningGraphSparse)ModelLearningGraph.getEmptyInstance(ontologyManager, ModelLearningGraphType.Sparse);
       
       
        SemanticModel correctModel = newSource;
        List<ColumnNode> columnNodes = correctModel.getColumnNodes();
        //        if (useCorrectType && numberOfCRFCandidates > 1)
        //          updateCrfSemanticTypesForResearchEvaluation(columnNodes);

        modelLearner = new ModelLearner_Old(ontologyManager, columnNodes);
        long start = System.currentTimeMillis();
View Full Code Here

   
    List<SemanticModel> semanticModels = new ArrayList<SemanticModel>();
   
    for (File f : files) {
      if (f.getName().endsWith(fileExtension)) {
        SemanticModel model = SemanticModel.readJson(f.getAbsolutePath());
        semanticModels.add(model);
      }
    }
   
    return semanticModels;
View Full Code Here

     
      lr.close();

      DirectedWeightedMultigraph<Node, LabeledLink> graph = buildGraphsFromStatements2(statements);

      SemanticModel semanticModel = new SemanticModel(id, graph);
      semanticModel.setName(name);
      semanticModel.setDescription(description);

      semanticModels.add(semanticModel);
      count++;
    }
   
View Full Code Here

TOP

Related Classes of edu.isi.karma.modeling.alignment.SemanticModel

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.