Package org.mmisw.orrclient.gwt.client.rpc.vine

Examples of org.mmisw.orrclient.gwt.client.rpc.vine.Mapping


      return;
    }
    Orr.log("VineEditorPanel._saveMappings: " +mappings.size());
    savedMappings = new ArrayList<Mapping>();
    for ( Mapping mm : mappings ) {
      Mapping savedMapping = new Mapping(mm.getLeft(), mm.getRelation(), mm.getRight());
      Map<String, String> md = mm.getMetadata();
      if ( md != null && md.size() > 0 ) {
        Map<String, String> savedMd = new LinkedHashMap<String, String>();
        for ( Entry<String, String> e : md.entrySet() ) {
          savedMd.put(e.getKey(), e.getValue());
        }
        savedMapping.setMetadata(savedMd);
      }
      savedMappings.add(savedMapping);
    }

  }
View Full Code Here


    for ( String leftKey: leftKeys ) {
      for ( String rightKey: rightKeys ) {
   
        boolean duplicate = false;
        for ( MappingAssoc mappingAssoc : mappingAssocs ) {
          Mapping mapping = mappingAssoc.mapping;
         
          if ( mapping.getLeft().equals(leftKey) && mapping.getRight().equals(rightKey)
          && mapping.getRelation().equals(relInfo.getUri()) ) {
            duplicate = true;
            break;
          }
        }
       
        if ( ! duplicate ) {
          preMappings.add(new Mapping(leftKey, relInfo.getUri(), rightKey));
        }
      }
    }
   
    return preMappings;
View Full Code Here

      flexPanel.clear();
      _setHeader(0);
    }

    Widget center;
    Mapping mapping;
   
    if ( relInfo != null ) {
      String imgUri = GWT.getModuleBaseURL()+ "images/" +relInfo.getIconUri();
      Image img = new Image(imgUri);
      // NOTE: firefox does not put the newlines in the tooltip (perhaps firefox takes this as html?),
      // so, I'm replacing each "\n" with " \n", so at least I see a space:
      img.setTitle(relInfo.getDescription().replaceAll("\n", " \n"));
      center = img;
      mapping = new Mapping(leftKey, relInfo.getUri(), rightKey);
    }
    else {
      center = new HTML("?");
      mapping = new Mapping(leftKey, null, rightKey);
    }
   
    mapping.setMetadata(metadata);
   
    MappingAssoc ma = new MappingAssoc(mapping, readOnly);
    mappingAssocs.add(ma);
   
    Widget left = new Label(leftKey);
View Full Code Here

    if ( log.isDebugEnabled() ) {
      log.debug("mappings = " +mappings);
    }
    assertEquals(1, mappings.size());
   
    Mapping mapping = mappings.get(0);
   
    assertEquals(left, mapping.getLeft());
    assertEquals(rel, mapping.getRelation());
    assertEquals(right, mapping.getRight());
   
    Map<String, String> md = mapping.getMetadata();
    assertNotNull(md);
   
    assertEquals(comment, md.get("http://www.w3.org/2000/01/rdf-schema#comment"));
    assertEquals(confidence, md.get(confidenceProp));
  }
View Full Code Here

   
    for ( Mapping mapping : vineEditorPanel.getMappings() ) {
      String expandedLeft = VineMain.getExpandedTerm(mapping.getLeft());
      String expandedRight = VineMain.getExpandedTerm(mapping.getRight());
     
      Mapping mappingToServer = new Mapping(expandedLeft, mapping.getRelation(), expandedRight);
      mappingToServer.setMetadata(mapping.getMetadata());
      expandedMappings.add(mappingToServer);
    }
    mappingDataCreationInfo.setMappings(expandedMappings);
   
    Set<String> namespaces = new HashSet<String>(VineMain.getWorkingUris());
View Full Code Here

          right = varValue;
        }
      }
     
      if ( left != null && rel != null && right != null ) {
        mappings.add(new Mapping(left, rel, right));
      }
    }
   
    return mappings;
  }
View Full Code Here

   
    // now process all the collected StmtKeys:
    for ( StmtKey stmtKey : stmtRsrsMap.keySet() ) {
     
      // create and add the mapping to the list:
      Mapping mapping = new Mapping(stmtKey.getSubject(), stmtKey.getPredicate(), stmtKey.getObject());
      mappings.add(mapping);
     
      // get the associated resources (reified statements) if any, to collect the metadata:
      Map<String,String> md = new HashMap<String,String>();
      for ( Resource stmtRsr : stmtRsrsMap.get(stmtKey) ) {
        _getMetadataForReified(stmtRsr, md);
        //
        // TODO Note that later elements in this loop will overwrite common metadata properties.
        // To be more concrete, if the (s,p,o) mapping happens to appear in two or more
        // reified statements, each with its associated metadata, we are not *aggregating*
        // such metadata (for example, rdfs:comment properties may be multiple), but
        // *overwriting*, EVEN in the same reified statement, actually.
      }
     
      // assign the metadata map only if non-empty:
      if ( md.size() > 0 ) {
        mapping.setMetadata(md);
      }
    }
   
    // sort the mappings lexicographically by <left><relation><right>:
    Collections.sort(mappings, new Comparator<Mapping>() {
View Full Code Here

    mdci.setMappings(mappings);
   
    originalTriples.clear();
    for ( int i = 0; i < mapps.length; i++ ) {
      String[] mapp = mapps[i];
      Mapping mapping = new Mapping(mapp[0], mapp[1], mapp[2]);
      Map<String,String> mappingMetadata = new HashMap<String,String>();
      mappingMetadata.put(RDFS.comment.getURI(), comments[i]);
      mappingMetadata.put(Vine.confidence.getURI(), confidences[i]);
      mapping.setMetadata(mappingMetadata);
      mappings.add(mapping);
      originalTriples.add(new StmtKey(mapp[0], mapp[1], mapp[2]));
    }   
    CreateOntologyInfo coi = new CreateOntologyInfo();
    coi.setUri(ontologyUri);
View Full Code Here

    // check that all mappings in the model exactly correspond to the original ones:
    MappingOntologyData mod = (MappingOntologyData) od;
    List<Mapping> mappings = mod.getMappings();
    Set<StmtKey> retrievedTriples = new HashSet<StmtKey>();
    for ( int i = 0; i < mapps.length; i++ ) {
      Mapping mapping = mappings.get(i);
      retrievedTriples.add(new StmtKey(mapping.getLeft(), mapping.getRelation(), mapping.getRight()));
    }
   
    assertEquals(originalTriples.size(), retrievedTriples.size());
    for ( StmtKey originalKey : originalTriples ) {
      assertTrue("retrieved mapping is a original one", retrievedTriples.contains(originalKey));
View Full Code Here

TOP

Related Classes of org.mmisw.orrclient.gwt.client.rpc.vine.Mapping

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.