Package edu.isi.karma.rep.alignment

Examples of edu.isi.karma.rep.alignment.LabeledLink


    writer.name("weight").value(link.getWeight());
    writer.name("type").value(link.getType().toString());
    if (link instanceof CompactObjectPropertyLink)
      writer.name("objectPropertyType").value( ((CompactObjectPropertyLink)link).getObjectPropertyType().toString());
    else if (link instanceof LabeledLink) {
      LabeledLink l = (LabeledLink)link;
      writer.name("label");
      if (l.getLabel() == null) writer.value(nullStr);
      else writeLabel(writer, l.getLabel());
      if (l instanceof DataPropertyOfColumnLink)
        writer.name("hNodeId").value( ((DataPropertyOfColumnLink)l).getSpecializedColumnHNodeId());
      if (l instanceof ObjectPropertyLink)
        writer.name("objectPropertyType").value( ((ObjectPropertyLink)l).getObjectPropertyType().toString());
      if (l instanceof ObjectPropertySpecializationLink) {
        writer.name("specializedLink").value(((ObjectPropertySpecializationLink)l).getSpecializedLinkId());
      }
      writer.name("status").value(l.getStatus().toString());
      writer.name("keyInfo").value(l.getKeyType().toString());
      writer.name("modelIds");
      writeModelIds(writer, l.getModelIds());
    }
    writer.endObject();
  }
View Full Code Here


          obj = new InternalNode(objStr, new Label(objStr));
       
        graph.addVertex(obj);
      }
     
      LabeledLink e;
      if (obj instanceof InternalNode)
        e = new ObjectPropertyLink(LinkIdFactory.getLinkId(predicateStr, subj.getId(), obj.getId()), new Label(predicateStr), ObjectPropertyType.None);
      else
        e = new DataPropertyLink(LinkIdFactory.getLinkId(predicateStr, subj.getId(), obj.getId()), new Label(predicateStr));
      graph.addEdge(subj, obj, e);
View Full Code Here

      if(links == null)
      {
        logger.error("No semantic type to unassign!");
        return new UpdateContainer(new ErrorUpdate("No semantic type to unassign!"));
      }
      LabeledLink currentLink = links.iterator().next();
//      String domainNodeId = currentLink.getSource().getId();
      // Remove the existing link
      alignment.removeLink(currentLink.getId());
      // Remove the column node
//      alignment.removeNode(columnNode.getId());
      // Remove the source node
//      alignment.removeNode(domainNodeId);
     
View Full Code Here

    return null
  }
 
  public void changeLinkWeight(String linkId, double weight) {
   
    LabeledLink link = this.getLinkById(linkId);
    if (link == null) {
      logger.error("Could not find the link with the id " + linkId);
      return;
    }
   
View Full Code Here

  }
 
  public void changeLinkStatus(String linkId, LinkStatus newStatus) {

    logger.debug("changing the status of link " + linkId + " to " + newStatus.name());
    LabeledLink link = this.getLinkById(linkId);
    if (link == null) {
      if (newStatus == LinkStatus.ForcedByUser) {
        Node source = this.getNodeById(LinkIdFactory.getLinkSourceId(linkId));
        Node target = this.getNodeById(LinkIdFactory.getLinkTargetId(linkId));
        String linkUri = LinkIdFactory.getLinkUri(linkId);
        LabeledLink newLink;
        if (linkUri.equalsIgnoreCase(Uris.RDFS_SUBCLASS_URI))
          newLink = new SubClassLink(linkId);
        else
          newLink = new ObjectPropertyLink(linkId,
              this.graphBuilder.getOntologyManager().getUriLabel(linkUri),
              this.graphBuilder.getOntologyManager().getObjectPropertyType(source.getLabel().getUri(), target.getLabel().getUri(), linkUri));
       
        newLink.setStatus(LinkStatus.ForcedByUser);
        this.graphBuilder.addLink(source, target, newLink);
      }
    } else
      this.graphBuilder.changeLinkStatus(link, newStatus);
  }
View Full Code Here

   * @param linkId
   * @return
   */
  public boolean removeLink(String linkId) {
   
    LabeledLink link = this.getLinkById(linkId);
    if (link != null)
      return this.graphBuilder.removeLink(link);
    logger.debug("Cannot find the link " + linkId + " in the graph.");
    return false;
  }
View Full Code Here

     
      if (source == null || target == null)
        continue;

      String id = LinkIdFactory.getLinkId(l.getUri(), source.getId(), target.getId());
      LabeledLink newLink = l.copy(id);
     
        if (newLink == null) continue;
     
      this.getGraphBuilder().addLink(source, target, newLink); // returns false if link already exists
      tree.addEdge(source, target, newLink);
           
      if (target instanceof ColumnNode) {
        SemanticType st = new SemanticType(((ColumnNode)target).getHNodeId(),
            newLink.getLabel(), source.getLabel(), SemanticType.Origin.User, 1.0);
        semanticTypes.add(st);
      }
     
    }
View Full Code Here

 
        Collections.sort(possibleLinks, new LinkPriorityComparator());
        if (possibleLinks.size() > 0) {
         
          // pick the first one
          LabeledLink newLink = possibleLinks.get(0);
         
          linkSourceId = LinkIdFactory.getLinkSourceId(newLink.getId());
          //linkTargetId = LinkIdFactory.getLinkTargetId(newLink.getId());
         
          if (linkSourceId.equals(sourceId)) {
            tree.addEdge(link.getSource(), link.getTarget(), newLink);
            tree.setEdgeWeight(newLink, link.getWeight());
View Full Code Here

           
            // Create the predicate
            Predicate pred = new Predicate(olink.getId());
           
            // Check if a specialization link exists
            LabeledLink specializedEdge = getSpecializationLinkIfExists(olink, node);
            if (specializedEdge != null) {
              Node specializedEdgeTarget = specializedEdge.getTarget();
              if (specializedEdgeTarget instanceof ColumnNode) {
                String columnName = translator.getColumnNameForHNodeId(((ColumnNode) specializedEdgeTarget).getHNodeId());
                ColumnTemplateTerm cnTerm =
                    new ColumnTemplateTerm(columnName);
                pred.getTemplate().addTemplateTermToSet(cnTerm);
              }
            } else {
              pred.getTemplate().addTemplateTermToSet(
                  new StringTemplateTerm(olink.getLabel().getUri(), true));
            }
            poMap.setPredicate(pred);
            if (generateInverse)
              addInversePropertyIfExists(subjMap, poMap, olink, subjTrMap);
           
            // Add the links in the graph links data structure
            TriplesMapLink link = new TriplesMapLink(subjTrMap, objTrMap, poMap)
            r2rmlMapping.getAuxInfo().getTriplesMapGraph().addLink(link);
          }
         
          else if(target instanceof LiteralNode) {
            LiteralNode lnode = (LiteralNode) target;
           
            //Create the object
            TemplateTermSet termSet = new TemplateTermSet();
            StringTemplateTerm literalTerm = new StringTemplateTerm(lnode.getValue(), lnode.isUri());
            termSet.addTemplateTermToSet(literalTerm);
           
            StringTemplateTerm rdfLiteralTypeTerm = new StringTemplateTerm(lnode.getLabel().getUri(), true);
            TemplateTermSet rdfLiteralTypeTermSet = new TemplateTermSet();
            rdfLiteralTypeTermSet.addTemplateTermToSet(rdfLiteralTypeTerm);
           
            ObjectMap objMap = new ObjectMap(target.getId(), termSet, rdfLiteralTypeTermSet);
            poMap.setObject(objMap);
           
            // Create the predicate
            Predicate pred = new Predicate(olink.getId());
            pred.getTemplate().addTemplateTermToSet(
                  new StringTemplateTerm(olink.getLabel().getUri(), true));
           
            poMap.setPredicate(pred);
            if (generateInverse)
              addInversePropertyIfExists(subjMap, poMap, olink, subjTrMap);
           
          }
         
          // Create a data property map
          else if(target instanceof ColumnNode) {
            // Create the object map
            ColumnNode cnode = (ColumnNode) target;
            String hNodeId = cnode.getHNodeId();
            String columnName = translator.getColumnNameForHNodeId(hNodeId);
            ColumnTemplateTerm cnTerm = new ColumnTemplateTerm(columnName);
            TemplateTermSet termSet = expandColumnTemplateTermForPyTransforms(
                hNodeId, cnTerm);
           
            String rdfLiteralUri =   cnode.getRdfLiteralType() == null? "" : cnode.getRdfLiteralType().getUri();
            StringTemplateTerm rdfLiteralTypeTerm = new StringTemplateTerm(rdfLiteralUri, true);
            TemplateTermSet rdfLiteralTypeTermSet = new TemplateTermSet();
            rdfLiteralTypeTermSet.addTemplateTermToSet(rdfLiteralTypeTerm);

            ObjectMap objMap = new ObjectMap(hNodeId, termSet, rdfLiteralTypeTermSet);
            poMap.setObject(objMap);
           
            // Create the predicate
            Predicate pred = new Predicate(olink.getId());
           
            // Check if a specialization link exists
            LabeledLink specializedEdge = getSpecializationLinkIfExists(olink, node);
            if (specializedEdge != null) {
              Node specializedEdgeTarget = specializedEdge.getTarget();
              if (specializedEdgeTarget instanceof ColumnNode) {
                String targetColumnName = translator.getColumnNameForHNodeId(((ColumnNode) specializedEdgeTarget).getHNodeId());
                ColumnTemplateTerm cnsplTerm =
                    new ColumnTemplateTerm(targetColumnName);
                pred.getTemplate().addTemplateTermToSet(cnsplTerm);
View Full Code Here

        || type.getUri().equals(ColumnSubClassLink.getFixedLabel().getUri()));
    if (case1)
      return true;
    Set<LabeledLink> incomingLinks = alignment.getCurrentIncomingLinksToNode(alignmentColumnNode.getId());
    if (incomingLinks != null && !incomingLinks.isEmpty()) {
      LabeledLink incomingLink = incomingLinks.iterator().next();
      if (incomingLink != null && (incomingLink instanceof ClassInstanceLink)
          && incomingLink.getKeyType().equals(LinkKeyInfo.UriOfInstance))
        return true;
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of edu.isi.karma.rep.alignment.LabeledLink

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.