Package edu.isi.karma.rep.alignment

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


      String domain = (String) value
          .get(SemanticType.ClientJsonKeys.DomainUri.name());
      String fullType = (String) value
          .get(SemanticType.ClientJsonKeys.FullType.name());
     
      Label typeName = ontMgr.getUriLabel(fullType);
      Label domainName = null;
      if (domain != null && !domain.trim().equals(""))
        domainName = ontMgr.getUriLabel(domain);

      if (typeName != null) {
        type = new SemanticType(hNodeId, typeName, domainName,
View Full Code Here


       
        boolean isClassSemanticType = false;
        boolean semanticTypeAlreadyExists = false;
        Node domain = null;
        String domainUriOrId;
        Label linkLabel;
       
        // if domain value is empty, semantic type is a class semantic type
        if (domainValue.equals("")) {
          isClassSemanticType = true;
          domainUriOrId = fullTypeValue;
          linkLabel = ClassInstanceLink.getFixedLabel();
        } else {
          isClassSemanticType = false;
          domainUriOrId = domainValue;
          linkLabel = ontMgr.getUriLabel(fullTypeValue);
          if (linkLabel == null) {
            logger.error("URI/ID does not exist in the ontology or model: " + fullTypeValue);
            continue;
          }
        }
       
        if(domainUriOrId.endsWith(" (add)"))
          domainUriOrId = domainUriOrId.substring(0, domainUriOrId.length()-5).trim();
       
        domain = alignment.getNodeById(domainUriOrId);
        logger.info("Got domain for domainUriOrId:" + domainUriOrId + " ::" + domain);
        if (domain == null) {
          Label label = ontMgr.getUriLabel(domainUriOrId);
//          if (label == null) {
//            logger.error("URI/ID does not exist in the ontology or model: " + domainUriOrId);
//            continue;
//          }
          if (label == null) {
            if(type.has(ClientJsonKeys.DomainUri.name())) {
              label = new Label(type.getString(ClientJsonKeys.DomainUri.name()));
            } else {
              //This part of the code is for backward compatibility. Newer models should have domainUri
              int len = domainValue.length();
              if ((len > 1) && Character.isDigit(domainValue.charAt(len-1))) {
                String newDomainValue = domainValue.substring(0, len-1);
View Full Code Here

            VWorkspace vWorkspace) {
          JSONArray nodesArray = new JSONArray();
          JSONObject obj = new JSONObject();
          for (Entry<String, Label> entry : allClasses.entrySet()) {
            JSONObject nodeObj = new JSONObject();
            Label label = entry.getValue();
            nodeObj.put(JsonKeys.nodeLabel.name(), label.getDisplayName());
            nodeObj.put(JsonKeys.nodeId.name(), label.getUri());
            nodeObj.put(JsonKeys.nodeUri.name(), label.getUri());
            nodesArray.put(nodeObj);
          }
          obj.put(JsonKeys.nodes.name(), nodesArray);
          pw.println(obj.toString());
        }
      });
      return upd;
    }

    if (nodeSet == null) {
      nodeSet = new HashSet<Node>();
    }
    final Set<Node> finalNodeSet = nodeSet;

    UpdateContainer upd = new UpdateContainer(new AbstractUpdate() {
      @Override
      public void generateJson(String prefix, PrintWriter pw,
          VWorkspace vWorkspace) {
        JSONObject obj = new JSONObject();
        JSONArray nodesArray = new JSONArray();

        try {
          obj.put(JsonKeys.updateType.name(), "InternalNodesList");
          for (Node node:finalNodeSet) {
            if (!(node instanceof InternalNode)) {
              continue;
            }

            JSONObject nodeObj = new JSONObject();
            String nodeLabelStr = node.getDisplayId();

            Label nodeLabel = node.getLabel();
            if (nodeLabel.getUri() !=null && nodeLabel.getNs() != null
                && nodeLabel.getUri().equalsIgnoreCase(nodeLabel.getNs())) {
              nodeLabelStr = node.getId();
            } else if(nodeLabel.getPrefix() == null && nodeLabel.getUri() != null) {
              nodeLabelStr = nodeLabel.getUri() + "/" + nodeLabelStr;
            }
            nodeObj.put(JsonKeys.nodeLabel.name(), nodeLabelStr);
            nodeObj.put(JsonKeys.nodeId.name(), node.getId());
            nodeObj.put(JsonKeys.nodeUri.name(), nodeLabel.getUri());
            nodesArray.put(nodeObj);
          }

          obj.put(JsonKeys.nodes.name(), nodesArray);
          pw.println(obj.toString());
View Full Code Here

      return null;
    }

    Set<Label> nodeLabels = new HashSet<>();
    for(String domain : domains) {
      Label domainURI = ontMgr.getUriLabel(domain);
      if(domainURI == null)
        continue;
      nodeLabels.add(domainURI);
    }
View Full Code Here

     
      SemanticType type = null;
      String domain = (String) value.get(SemanticType.ClientJsonKeys.DomainUri.name());
      String fullType = (String) value.get(SemanticType.ClientJsonKeys.FullType.name());
     
      Label typeName = ontMgr.getUriLabel(fullType);
      Label domainName = null;
      if (domain != null && !domain.trim().equals(""))
        domainName = ontMgr.getUriLabel(domain);
     
      if(typeName != null) {
        type = new SemanticType(hNodeId, typeName, domainName, Origin.User, 1.00);
View Full Code Here

      Set<Node> matchedNodes = this.graphBuilder.getUriToNodesMap().get(uri);
      int graphNodeCount = matchedNodes == null ? 0 : matchedNodes.size();
     
      for (int i = 0; i < modelNodeCount - graphNodeCount; i++) {
        String id = this.nodeIdFactory.getNodeId(uri);
        Node n = new InternalNode(id, new Label(uri));
        if (this.graphBuilder.addNode(n))
          addedNodes.add((InternalNode)n);
      }
    }
   
View Full Code Here

              return null;
            }
            if (this.graphBuilder.addNode(newNode)) {
              matches.add(newNode);
              String linkId = LinkIdFactory.getLinkId(incomingLink.getUri(), m.getId(), newNode.getId());
              DataPropertyLink link = new DataPropertyLink(linkId, new Label(incomingLink.getLabel()));
              this.graphBuilder.addLink(m, newNode, link);
            }
          }
          columnNodeMatches.put(n, matches);
        }
View Full Code Here

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

        String linkId = LinkIdFactory.getLinkId(propertyUri, source.getId(), target.getId())
        LabeledLink link = new DataPropertyLink(linkId, new Label(propertyUri));
       
        boolean result = weight == null ? this.graphBuilder.addLink(source, target, link) : this.graphBuilder.addLink(source, target, link, weight);
        if (!result) continue;;

        SemanticTypeMapping mp = new SemanticTypeMapping(sourceColumn, semanticType, (InternalNode)source, link, target);
View Full Code Here

      InternalNode copyFrom = (InternalNode)nodesWithSameUri.iterator().next();
      source = this.graphBuilder.copyNode(copyFrom, false);
      if (source == null) return null;
    } else {
      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);
      link = new DataPropertyLink(linkId, label);
    }
    if (!this.graphBuilder.addLink(source, target, link)) return null;

    SemanticTypeMapping mappingStruct = new SemanticTypeMapping(sourceColumn, semanticType, source, link, target);
View Full Code Here

        obj3.put("value", array.toString());
        obj3.put("type", "other");
        input.put(obj3);
        try {
          OntologyManager ontMgr = workspace.getOntologyManager();
          Label label = ontMgr.getUriLabel(incoming ? otherClass : predicate);
          AddValuesCommand command = (AddValuesCommand) addFactory.createCommand(input, workspace, hNodeId, worksheetId, hnode.getHTableId(), label.getDisplayName(), HNodeType.AugmentData, selection.getName());
          command.doIt(workspace);
          outputColumns.addAll(command.getOutputColumns());
          isNewNode |= command.isNewNode();
          if (command.isNewNode())
            appliedCommands.push(command);
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.