Package edu.isi.karma.rep.alignment

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


      JSONObject typeObj = (JSONObject) inputJson.get(++i);
      JSONObject value = (JSONObject) typeObj
          .get(ClientJsonKeys.value.name());

      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);
        worksheet.getSemanticTypes().addType(type);
      }
    }
    return comm;
View Full Code Here


            } else {
              newLink = alignment.addDataPropertyLink(domain, columnNode, linkLabel);
            }           
          }
        } else { // Synonym semantic type
          SemanticType synType = new SemanticType(hNodeId, linkLabel, domain.getLabel(), SemanticType.Origin.User, 1.0);
          typesList.add(synType);
        }
       
        // Create the semantic type object
        newType = new SemanticType(hNodeId, linkLabel, domain.getLabel(), SemanticType.Origin.User, 1.0);
//        newType = new SemanticType(hNodeId, classNode.getLabel(), null, SemanticType.Origin.User, 1.0,isPartOfKey);
        columnNode.setUserSelectedSemanticType(newType);
       
        if(newLink != null) {
          alignment.changeLinkStatus(newLink.getId(),
View Full Code Here

      String hNodeId = (String) hnodeObj.get(ClientJsonKeys.value.name());
     
      JSONObject typeObj = (JSONObject) inputJson.get(++i);
      JSONObject value = (JSONObject) typeObj.get(ClientJsonKeys.value.name());
     
      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);
        worksheet.getSemanticTypes().addType(type);
      }
    }
    return comm;
  }
View Full Code Here

    if (n == null)
      return null;

    List<SemanticType> types = new ArrayList<>();

    SemanticType userSelectedType = n.getUserSelectedSemanticType();
    if (useCorrectType && userSelectedType != null) {
      double probability = 1.0;
      SemanticType newType = new SemanticType(
          userSelectedType.getHNodeId(),
          userSelectedType.getType(),
          userSelectedType.getDomain(),
          userSelectedType.getOrigin(),
          probability
View Full Code Here

      return;

    int numberOfAttributesWhoseTypeIsFirstCRFType = 0;
    int numberOfAttributesWhoseTypeIsInCRFTypes = 0;
    for (ColumnNode cn : columnNodes) {
      SemanticType userSelectedType = cn.getUserSelectedSemanticType();
      List<SemanticType> top4Suggestions = cn.getTopKSuggestions(4);

      for (int i = 0; i < top4Suggestions.size(); i++) {
        SemanticType st = top4Suggestions.get(i);
        if (userSelectedType != null &&
            st.getModelLabelString().equalsIgnoreCase(userSelectedType.getModelLabelString())) {
          if (i == 0) numberOfAttributesWhoseTypeIsFirstCRFType ++;
          numberOfAttributesWhoseTypeIsInCRFTypes ++;
          break;
        }
      }
View Full Code Here

           
      Set<LabeledLink> incomingLinks = this.graph.incomingEdgesOf(n);
      if (incomingLinks != null && incomingLinks.size() == 1) {
        LabeledLink link = incomingLinks.toArray(new LabeledLink[0])[0];
        Node domain = link.getSource();
        SemanticType st = new SemanticType(cn.getHNodeId(), link.getLabel(), domain.getLabel(), Origin.User, 1.0);
        cn.setUserSelectedSemanticType(st);
      } else
        logger.debug("The column node " + ((ColumnNode)n).getColumnName() + " does not have any domain or it has more than one domain.");
    }
  }
View Full Code Here

    if (n == null)
      return null;

    List<SemanticType> types = new ArrayList<>();

    SemanticType userSelectedType = n.getUserSelectedSemanticType();
    if (useCorrectType && userSelectedType != null) {
      double probability = 1.0;
      SemanticType newType = new SemanticType(
          userSelectedType.getHNodeId(),
          userSelectedType.getType(),
          userSelectedType.getDomain(),
          userSelectedType.getOrigin(),
          probability
View Full Code Here

      return;

    int numberOfAttributesWhoseTypeIsFirstCRFType = 0;
    int numberOfAttributesWhoseTypeIsInCRFTypes = 0;
    for (ColumnNode cn : columnNodes) {
      SemanticType userSelectedType = cn.getUserSelectedSemanticType();
      List<SemanticType> top4Suggestions = cn.getTopKSuggestions(4);

      for (int i = 0; i < top4Suggestions.size(); i++) {
        SemanticType st = top4Suggestions.get(i);
        if (userSelectedType != null &&
            st.getModelLabelString().equalsIgnoreCase(userSelectedType.getModelLabelString())) {
          if (i == 0) numberOfAttributesWhoseTypeIsFirstCRFType ++;
          numberOfAttributesWhoseTypeIsInCRFTypes ++;
          break;
        }
      }
View Full Code Here

          if (domainLabel == null) continue;
 
          Label propertyLabel = ontologyManager.getUriLabel(propertyUri);
          if (propertyLabel == null) continue;
 
          SemanticType semanticType = new SemanticType(hNodeId, propertyLabel, domainLabel, Origin.CRFModel, confidence);
          logger.info("\t" + propertyUri + " of " + domainUri + ": " + confidence);
          suggestedSemanticTypes.add(semanticType);
        }
      }
    }
View Full Code Here

          LinkKeyInfo.UriOfInstance);
      alignment.changeLinkStatus(newLink.getId(),
          LinkStatus.ForcedByUser);
     
      // Create the semantic type object
      newType = new SemanticType(hNodeId,
          ClassInstanceLink.getFixedLabel(), classNode.getLabel(),
          SemanticType.Origin.User, 1.0);
    } else if (metaPropertyName
        .equals(METAPROPERTY_NAME.isSpecializationForEdge)) {
      LabeledLink propertyLink = alignment.getLinkById(metaPropertyId);
      if (propertyLink == null) {
        String errorMessage = "Error while specializing a link. The DefaultLink '"
            + metaPropertyId
            + "' should already be in the alignment, but it is not.";
        logger.error(errorMessage);
        return new UpdateContainer(new ErrorUpdate(errorMessage));
      }

      Node classInstanceNode = alignment.getNodeById(LinkIdFactory
          .getLinkSourceId(metaPropertyId));
      if (semanticTypeAlreadyExists) {
        clearOldSemanticTypeLink(oldIncomingLinkToColumnNode,
            oldDomainNode, alignment, classInstanceNode);
      }

      if (propertyLink instanceof DataPropertyLink) {
        String targetHNodeId = ((ColumnNode) propertyLink.getTarget())
            .getHNodeId();
        LabeledLink newLink = alignment.addDataPropertyOfColumnLink(classInstanceNode,
            columnNode, targetHNodeId, propertyLink.getId());
        alignment.changeLinkStatus(newLink.getId(),
            LinkStatus.ForcedByUser);
       
        // Create the semantic type object
        newType = new SemanticType(hNodeId,
            DataPropertyOfColumnLink.getFixedLabel(),
            classInstanceNode.getLabel(), SemanticType.Origin.User,
            1.0);
      } else if (propertyLink instanceof ObjectPropertyLink) {
        LabeledLink newLink = alignment.addObjectPropertySpecializationLink(
            classInstanceNode, columnNode, propertyLink.getId());
        alignment.changeLinkStatus(newLink.getId(),
            LinkStatus.ForcedByUser);

        // Create the semantic type object
        newType = new SemanticType(hNodeId,
            ObjectPropertySpecializationLink.getFixedLabel(),
            classInstanceNode.getLabel(), SemanticType.Origin.User,
            1.0);
      }

    } else if (metaPropertyName.equals(METAPROPERTY_NAME.isSubclassOfClass)) {
      Node classNode = alignment.getNodeById(metaPropertyId);
      if (semanticTypeAlreadyExists) {
        clearOldSemanticTypeLink(oldIncomingLinkToColumnNode,
            oldDomainNode, alignment, classNode);
      }

      if (classNode == null) {
        Label classNodeLabel = ontMgr.getUriLabel(metaPropertyUri);
        if (classNodeLabel == null) {
          String errorMessage = "Error while setting an advances subclass. MetaPropertyValue '"
              + metaPropertyUri
              + "' should be in the Ontology Manager, but it is not.";
          logger.error(errorMessage);
          return new UpdateContainer(new ErrorUpdate(errorMessage));
        }
        classNode = alignment.addInternalNode(classNodeLabel);
      }
      LabeledLink newLink = alignment.addColumnSubClassOfLink(classNode, columnNode);
      alignment.changeLinkStatus(newLink.getId(),
          LinkStatus.ForcedByUser);
     
      // Create the semantic type object
      newType = new SemanticType(hNodeId,
          ColumnSubClassLink.getFixedLabel(), classNode.getLabel(),
          SemanticType.Origin.User, 1.0);
    }

    columnNode.setUserSelectedSemanticType(newType);
View Full Code Here

TOP

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

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.