Package edu.isi.karma.rep.alignment

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


        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;
View Full Code Here


      return null;
    }

    logger.debug("semantic type: " + domainUri + "|" + propertyUri + "|" + confidence + "|" + origin);

    InternalNode source = null;
    String nodeId;

    nodeId = nodeIdFactory.getNodeId(domainUri);
    source = new InternalNode(nodeId, new Label(domainUri));
    if (!this.graphBuilder.addNodeAndUpdate(source, addedNodes)) return null;

    nodeId = new RandomGUID().toString();
    ColumnNode target = new ColumnNode(nodeId, nodeId, sourceColumn.getColumnName(), null);
    if (!this.graphBuilder.addNode(target)) return null;
    addedNodes.add(target);

    String linkId = LinkIdFactory.getLinkId(propertyUri, source.getId(), target.getId())
    LabeledLink link;
    if (propertyUri.equalsIgnoreCase(ClassInstanceLink.getFixedLabel().getUri()))
      link = new ClassInstanceLink(linkId);
    else {
      Label label = this.ontologyManager.getUriLabel(propertyUri);
View Full Code Here

      return null;
    }

    logger.debug("semantic type: " + domainUri + "|" + propertyUri + "|" + confidence + "|" + origin);

    InternalNode source = null;
    String nodeId;

    nodeId = nodeIdFactory.getNodeId(domainUri);
    source = new InternalNode(nodeId, new Label(domainUri));
    if (!this.graphBuilder.addNodeAndUpdate(source, addedNodes)) return null;

    nodeId = new RandomGUID().toString();
    ColumnNode target = new ColumnNode(nodeId, nodeId, sourceColumn.getColumnName(), null);
    if (!this.graphBuilder.addNode(target)) return null;
    addedNodes.add(target);

    String linkId = LinkIdFactory.getLinkId(propertyUri, source.getId(), target.getId())
    LabeledLink link;
    if (propertyUri.equalsIgnoreCase(ClassInstanceLink.getFixedLabel().getUri()))
      link = new ClassInstanceLink(linkId);
    else {
      Label label = this.ontologyManager.getUriLabel(propertyUri);
View Full Code Here

    }
      reader.endObject();
     
      Node n = null;
      if (type == NodeType.InternalNode) {
        n = new InternalNode(id, label);
      } else if (type == NodeType.ColumnNode) {
        n = new ColumnNode(id, hNodeId, columnName, rdfLiteralType);
        ((ColumnNode)n).setUserSelectedSemanticType(userSelectedSemanticType);
        ((ColumnNode)n).setSuggestedSemanticTypes(suggestedSemanticTypes);
      } else if (type == NodeType.LiteralNode) {
View Full Code Here

      predicateStr = getUri(predicateStr);
      objStr = getUri(objStr);

      if (predicateStr.equalsIgnoreCase(typePredicate)) {
       
        Node classNode = new InternalNode(objStr, new Label(objStr));
        uri2Classes.put(subjStr, classNode);
        graph.addVertex(classNode);
       
      }
    }
   
//    int countOfLiterals = 0;
    String id;
    for (Statement st : statements) {
     
      String subjStr = st.getSubject();
      String predicateStr = st.getPredicate();
      String objStr = st.getObject();
     
      subjStr = getUri(subjStr);
      predicateStr = getUri(predicateStr);
      objStr = getUri(objStr);

      if (predicateStr.equalsIgnoreCase(typePredicate))
        continue;
     
      Node subj = uri2Classes.get(subjStr);
      if (subj == null) {
        subj = new InternalNode(subjStr, new Label(subjStr));
        graph.addVertex(subj);
      }

      Node obj = uri2Classes.get(objStr);
      if (obj == null) {
        if (objStr.startsWith(attPrefix)) {
          id = new RandomGUID().toString();
          obj = new ColumnNode(id, objStr, objStr, null);
          SemanticType semanticType = new SemanticType(((ColumnNode)obj).getHNodeId(),
              new Label(predicateStr),
              subj.getLabel(),
              Origin.User,
              1.0);
          ((ColumnNode)obj).setUserSelectedSemanticType(semanticType);

        } else if (objStr.indexOf(":") == -1 && objStr.indexOf("\"") != -1) {
//          String literalId = "lit:" + serviceId + "_l" + String.valueOf(countOfLiterals);
          obj = new LiteralNode(objStr, objStr, null, false);
//          countOfLiterals ++;
        } else
          obj = new InternalNode(objStr, new Label(objStr));
       
        graph.addVertex(obj);
      }
     
      LabeledLink e;
View Full Code Here

  }
 
  public InternalNode addInternalNode(Label label) {
   
    String id = nodeIdFactory.getNodeId(label.getUri());
    InternalNode node = new InternalNode(id, label);
    if (this.graphBuilder.addNodeAndUpdate(node)) return node;
    return null
  }
View Full Code Here

    return null
  }
 
  public InternalNode addForcedInternalNode(Label label) {
    String id = nodeIdFactory.getNodeId(label.getUri());
    InternalNode node = new InternalNode(id, label);
    node.setForced(true);
    if (this.graphBuilder.addNodeAndUpdate(node)) return node;
    return null;
  }
View Full Code Here

    HashMap<Node, Node> modelToAlignmentNode = new HashMap<Node, Node>();
    for (Node n : model.getGraph().vertexSet()) {
      if (n instanceof InternalNode) {

        InternalNode iNode;

        iNode = (InternalNode)this.getNodeById(n.getId());
        if (iNode != null) {
          modelToAlignmentNode.put(n, iNode);
        } else {
View Full Code Here

          writer.key(JsonKeys.HNodeId.name())
              .value(type.getHNodeId())
              .key(JsonKeys.SemanticTypesArray.name()).array();
         
          ColumnNode alignmentColumnNode = hNodeIdTocolumnNodeMap.get(type.getHNodeId());
          InternalNode domainNode = hNodeIdToDomainNodeMap.get(type.getHNodeId());
         
          if (alignmentColumnNode == null || domainNode == null) {
            logger.error("Column node or domain node not found in alignment." +
                " (This should not happen conceptually!):" + type);
            continue;
          }
         
          // Add the primary semantic type
          writer.object()
              .key(JsonKeys.Origin.name())
              .value(type.getOrigin().name())
              .key(JsonKeys.ConfidenceLevel.name())
              .value(type.getConfidenceLevel().name())
              .key(JsonKeys.isPrimary.name())
              .value(true);
         
          // Add the RDF literal type to show in the text box
          String rdfLiteralType = alignmentColumnNode.getRdfLiteralType() == null? "" :
            alignmentColumnNode.getRdfLiteralType().getDisplayName();
          writer.key(JsonKeys.rdfLiteralType.name())
            .value(rdfLiteralType);
         
//          String domainDisplayLabel = (domainNode.getLabel().getPrefix() != null && (!domainNode.getLabel().getPrefix().equals(""))) ?
//              (domainNode.getLabel().getPrefix() + ":" + domainNode.getLocalId()) : domainNode.getLocalId();
          if (!type.isClass()) {
            writer
              .key(JsonKeys.FullType.name()).value(type.getType().getUri())
              .key(JsonKeys.DisplayLabel.name()).value(type.getType().getDisplayName())
              .key(JsonKeys.DomainId.name()).value(domainNode.getId())
              .key(JsonKeys.DomainUri.name()).value(domainNode.getUri())
              .key(JsonKeys.DisplayDomainLabel.name()).value(domainNode.getDisplayId());
          } else {
            writer
              .key(JsonKeys.FullType.name()).value(domainNode.getId())
              .key(JsonKeys.DisplayLabel.name()).value(domainNode.getDisplayId())
              .key(JsonKeys.DomainId.name()).value("")
              .key(JsonKeys.DomainUri.name()).value("")
              .key(JsonKeys.DisplayDomainLabel.name())
              .value("");
          }
View Full Code Here

      mgr.updateCache();
    }
   
    GraphBuilderTopK gbtk = new GraphBuilderTopK(mgr, false);
   
    Node n1 = new InternalNode("n1", new Label("http://erlangen-crm.org/current/E55_Type"));
    Node n2 = new InternalNode("n2", new Label("http://erlangen-crm.org/current/E70_Thing"));
    Node n3 = new InternalNode("n3", new Label("http://erlangen-crm.org/current/E39_Actor"));
    Node n4 = new InternalNode("n4", new Label("http://erlangen-crm.org/current/E74_Group"));

    gbtk.addNode(n1);
    gbtk.addNode(n2);
    gbtk.addNode(n3);
    gbtk.addNode(n4);
View Full Code Here

TOP

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

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.