Package edu.isi.karma.rep.alignment

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


        try {
          obj.put(JsonKeys.updateType.name(), "PropertyList");
         
          for (LabeledLink link:finalProperties) {
            Label linkLabel = link.getLabel();
            String edgeLabelStr = linkLabel.getDisplayName();
            JSONObject edgeObj = new JSONObject();
            if (linkLabel.getUri() !=null && linkLabel.getNs() != null
                && linkLabel.getUri().equalsIgnoreCase(linkLabel.getNs())) {
              edgeLabelStr = linkLabel.getUri();
            }
           
            edgeObj.put(JsonKeys.label.name(), edgeLabelStr);
            edgeObj.put(JsonKeys.uri.name(), linkLabel.getUri());
            edgeObj.put(JsonKeys.id.name(), link.getId());
           
           
            if(link instanceof ObjectPropertyLink)
              edgeObj.put(JsonKeys.type.name(), "objectProperty");
View Full Code Here


    oldAlignment = alignment.getAlignmentClone();
    oldGraph = (DirectedWeightedMultigraph<Node, DefaultLink>) alignment
        .getGraph().clone();

    try {
      alignment.addForcedInternalNode(new Label(nodeUri));
      if(!this.isExecutedInBatch())
        alignment.align();
     
    } catch (JSONException e) {
      logger.error("Error adding Internal Node:" , e);
View Full Code Here

      String sourceUri = newEdge.has(JsonKeys.edgeSourceUri.name()) ? newEdge.getString(JsonKeys.edgeSourceUri.name()) : null;
      String targetUri = newEdge.has(JsonKeys.edgeTargetUri.name()) ? newEdge.getString(JsonKeys.edgeTargetUri.name()) : null;
     
     
      if (sourceNode == null && sourceUri != null) {
        sourceNode = alignment.addInternalNode(new Label(sourceUri));
      }
     
      if (targetNode == null && targetUri != null) {
        targetNode = alignment.addInternalNode(new Label(targetUri));
      }

      Label linkLabel = ontMgr.getUriLabel(edgeUri);

      LabeledLink newLink = alignment.addObjectPropertyLink(sourceNode,
          targetNode, linkLabel);
      alignment.changeLinkStatus(newLink.getId(),
          LinkStatus.ForcedByUser);
View Full Code Here

      if (n1 == null) {

        if (source instanceof InternalNode) {
          String id = this.nodeIdFactory.getNodeId(source.getLabel().getUri());
          InternalNode node = new InternalNode(id, new Label(source.getLabel()));
          if (this.graphBuilder.addNode(node)) {
            n1 = node;
          } else continue;
        }
        else {
          String id = new RandomGUID().toString();
          ColumnNode node = new ColumnNode(id, id, ((ColumnNode)target).getColumnName(), null);
          if (this.graphBuilder.addNode(node)) {
            n1 = node;
          } else continue;
        }

        visitedNodes.put(source, n1);
      }

      if (n2 == null) {

        if (target instanceof InternalNode) {
          String id = nodeIdFactory.getNodeId(target.getLabel().getUri());
          InternalNode node = new InternalNode(id, new Label(target.getLabel()));
          if (this.graphBuilder.addNode(node)) {
            n2 = node;
          } else continue;
        }
        else if(target instanceof LiteralNode) {
          LiteralNode lTarget = (LiteralNode)target;
          String id = nodeIdFactory.getNodeId(lTarget.getValue());
          LiteralNode node = new LiteralNode(id, lTarget.getValue(), new Label(target.getLabel()), lTarget.isUri());
          if (this.graphBuilder.addNode(node)) {
            n2 = node;
          } else continue;
        }
        else {
View Full Code Here

      return false;
    }
   
    if (node instanceof InternalNode) {
      String uri = node.getUri();
      Label label = this.ontologyManager.getUriLabel(uri);
      if (label == null) {
        logger.error("The resource " + uri + " does not exist in the ontology.");
        return false;
      }
      node.getLabel().setNs(label.getNs());
      node.getLabel().setPrefix(label.getPrefix());
    }
   
    if(node.isForced())
      this.forcedNodes.add(node);
   
View Full Code Here

        linkFrequency = t.getLinkFrequency();

        nodes = this.graphBuilder.getUriToNodesMap().get(subjectUri);
        if (nodes == null || nodes.isEmpty()) {
          id = this.nodeIdFactory.getNodeId(subjectUri);
          node = new InternalNode(id, new Label(subjectUri));
          if (this.graphBuilder.addNode(node)) {
            addedNodes.add((InternalNode)node);
            n1 = node;
          } else {
            continue;
          }
        } else {
          n1 = nodes.iterator().next();
        }

        nodes = this.graphBuilder.getUriToNodesMap().get(objectUri);
        if (nodes == null || nodes.isEmpty()) {
          id = this.nodeIdFactory.getNodeId(objectUri);
          node = new InternalNode(id, new Label(objectUri));
          if (this.graphBuilder.addNode(node)) {
            addedNodes.add((InternalNode)node);
            n2 = node;
          } else {
            continue;
          }
        } else {
          n2 = nodes.iterator().next();
        }

        id = LinkIdFactory.getLinkId(predicateUri, n1.getId(), n2.getId())
        link = new ObjectPropertyLink(id, new Label(predicateUri), ObjectPropertyType.None);
        if (this.graphBuilder.addLink(n1, n2, link)) {
          this.graphBuilder.changeLinkWeight(link, 1 - ((double)linkFrequency / (double)countOfObjectProperties));
//          this.graphBuilder.changeLinkWeight(link, countOfObjectProperties - linkFrequency);
//          this.graphBuilder.changeLinkWeight(link, linkFrequency);
        }
View Full Code Here

        linkFrequency = t.getLinkFrequency();

        nodes = this.graphBuilder.getUriToNodesMap().get(subjectUri);
        if (nodes == null || nodes.isEmpty()) {
          id = this.nodeIdFactory.getNodeId(subjectUri);
          node = new InternalNode(id, new Label(subjectUri));
          if (this.graphBuilder.addNode(node)) {
            addedNodes.add((InternalNode)node);
            n1 = node;
          } else {
            continue;
          }
        } else {
          n1 = nodes.iterator().next();
        }

        id = new RandomGUID().toString();
        node = new ColumnNode(id, id, "", null);
        if (this.graphBuilder.addNode(node)) {
          n2 = node;
        } else {
          continue;
        }

        id = LinkIdFactory.getLinkId(predicateUri, n1.getId(), n2.getId())
        link = new DataPropertyLink(id, new Label(predicateUri));
        if (this.graphBuilder.addLink(n1, n2, link)) {
          this.graphBuilder.changeLinkWeight(link, 1 - ((double)linkFrequency / (double)countOfDataProperties));
//          this.graphBuilder.changeLinkWeight(link, countOfDataProperties - linkFrequency);
//          this.graphBuilder.changeLinkWeight(link, linkFrequency);
        }
View Full Code Here

      return false;
    }

    if (link instanceof LabeledLink) {
      String uri = link.getUri();
      Label label = this.ontologyManager.getUriLabel(uri);
      if (label == null) {
        logger.error("The resource " + uri + " does not exist in the ontology.");
        return false;
      }
      ((LabeledLink)link).getLabel().setNs(label.getNs());
      ((LabeledLink)link).getLabel().setPrefix(label.getPrefix());
    }
     
    if (source instanceof InternalNode && target instanceof ColumnNode) {
     
      // remove other incoming links to this column node
View Full Code Here

    logger.debug("<enter");
   
    // Add Thing to the Graph
    if (ModelingConfiguration.getThingNode()) {
      String id = nodeIdFactory.getNodeId(Uris.THING_URI);
      Label label = new Label(Uris.THING_URI, Namespaces.OWL, Prefixes.OWL);
      Node thing = new InternalNode(id, label);
      addNode(thing);
    }
   
    logger.debug("exit>");
View Full Code Here

    HashSet<String> links =
        this.ontologyManager.getPossibleUris(sourceUri, targetUri);

    String id;
    Label label;
    ObjectPropertyType linkObjectPropertyType;

    for (String uri : links) {
     
      if (linkType == LinkType.SubClassLink && !uri.equalsIgnoreCase(Uris.RDFS_SUBCLASS_URI))
        continue;
     
      if (linkType == LinkType.ObjectPropertyLink && uri.equalsIgnoreCase(Uris.RDFS_SUBCLASS_URI))
        continue;
     
      linkObjectPropertyType = ontologyManager.getObjectPropertyType(sourceUri, targetUri, uri);
      if (linkType == LinkType.ObjectPropertyLink &&
          objectProertyType != null &&
          objectProertyType != ObjectPropertyType.None &&
          objectProertyType != linkObjectPropertyType)
        continue;
     
      id = LinkIdFactory.getLinkId(uri, sourceId, targetId);
      label = new Label(ontologyManager.getUriLabel(uri));
     
      LabeledLink newLink;
      if (uri.equalsIgnoreCase(Uris.RDFS_SUBCLASS_URI))
        newLink = new SubClassLink(id);
      else
View Full Code Here

TOP

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

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.