Package edu.isi.karma.rep.alignment

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


        System.out.println(s);
      }
      Alignment al = new Alignment(mgr);
      ColumnNode c1 = al.addColumnNode("h1", "c1", null);
      ColumnNode c2 = al.addColumnNode("h2", "c2", null);
      InternalNode n1 = al.addInternalNode(new Label("http://example.com/layout/C01_"));
      InternalNode n2 = al.addInternalNode(new Label("http://example.com/layout/C02_"));
      al.addDataPropertyLink(n1, c1, new Label("http://example.com/layout/d1"));
      al.addDataPropertyLink(n2, c2, new Label("http://example.com/layout/d2"));
      al.align();
      System.out.println(GraphUtil.labeledGraphToString(al.getSteinerTree()));
    } else {
      logger.info("No directory for preloading ontologies exists.");
    }
View Full Code Here


    } else {
      logger.info("atom does not have an argument1.");
      return null;
    }
   
    Label predicateName = new Label(predicateUri, predicateNs, predicatePrefix);
    Argument arg1 = new Argument(argument1Id, argument1Id, argument1Type);
   
    ClassAtom classAtom = new ClassAtom(predicateName, arg1);

    return classAtom;
View Full Code Here

    } else {
      logger.info("atom does not have an argument2.");
      return null;
    }
   
    Label predicateName = new Label(predicateUri, predicateNs, predicatePrefix);
    Argument arg1 = new Argument(argument1Id, argument1Id, argument1Type);
    Argument arg2 = new Argument(argument2Id, argument2Id, argument2Type);
   
    IndividualPropertyAtom propertyAtom = new IndividualPropertyAtom(predicateName, arg1, arg2);
View Full Code Here

//    String geonamesOntology = "http://www.geonames.org/ontology#";
//    String wgs84Ontology = "http://www.w3.org/2003/01/geo/wgs84_pos#";
    String geoOntology = "http://isi.edu/ontologies/geo/current#";
   
    Label featurePredicatName = new Label(geoOntology + "Feature", geoOntology, "geo");
    Label latPredicatName = new Label(geoOntology + "lat", geoOntology, "geo");
    Label lngPredicatName = new Label(geoOntology + "long", geoOntology, "geo");
   
    ClassAtom c1 = new ClassAtom(featurePredicatName, new Argument("arg1", "arg1", ArgumentType.ATTRIBUTE));
    IndividualPropertyAtom p1 = new IndividualPropertyAtom(latPredicatName,
        new Argument("arg1", "arg1", ArgumentType.ATTRIBUTE),
        new Argument("arg2", "arg2", ArgumentType.ATTRIBUTE));
View Full Code Here

    for (String label : sortedMap.keySet()) {
      double probability = scoreMap.get(label);
      // Check if the type contains domain
      if(label.contains("|")){
        Label domainURI = ontMgr.getUriLabel(label.split("\\|")[0]);
        Label typeURI = ontMgr.getUriLabel(label.split("\\|")[1]);
        if(domainURI == null || typeURI == null)
          continue;
       
        String clazzLocalNameWithPrefix = domainURI.getDisplayName();
        if(domainURI.getPrefix() == null)
          clazzLocalNameWithPrefix = domainURI.getUri() + "/" + domainURI.getLocalName();
         
        int graphLastIndex = alignment.getLastIndexOfNodeUri(domainURI.getUri());
        if (graphLastIndex == -1) { // No instance present in the graph
          insertSemanticTypeSuggestion(arr, clazzLocalNameWithPrefix + "1 (add)",
              domainURI.getUri(), domainURI.getUri() + "1",
              typeURI.getDisplayName(), label.split("\\|")[1], probability);
        } else {
          boolean hasLastNodeFromSteinerTree = false;
          for (int i=1; i<= graphLastIndex; i++) {
           
            if (steinerTreeNodeIds.contains(domainURI.getUri() + i)) {
              insertSemanticTypeSuggestion(arr, clazzLocalNameWithPrefix + i,
                  domainURI.getUri(),
                  domainURI.getUri() + i,
                  typeURI.getDisplayName(), label.split("\\|")[1], probability);
              if (i == graphLastIndex)
                hasLastNodeFromSteinerTree = true;
            } else {
              Node graphNode = alignment.getNodeById(domainURI.getUri() + i);
              if (graphNode != null)
                insertSemanticTypeSuggestion(arr, clazzLocalNameWithPrefix + i + " (add)",
                  graphNode.getUri(),
                  graphNode.getId(),
                  typeURI.getDisplayName(), label.split("\\|")[1], probability);
            }
          }
          // Add an option to add one more node for the domain
          if (hasLastNodeFromSteinerTree)
            insertSemanticTypeSuggestion(arr, clazzLocalNameWithPrefix + (graphLastIndex+1) + " (add)",
                domainURI.getUri(), domainURI.getUri() + (graphLastIndex+1),
              typeURI.getDisplayName(), label.split("\\|")[1], probability);
        }
      } else {
        Label typeURI = ontMgr.getUriLabel(label);
        if(typeURI == null)
          continue;
       
        String clazzLocalNameWithPrefix = typeURI.getDisplayName();
       
        int graphLastIndex = alignment.getLastIndexOfNodeUri(typeURI.getUri());
        if (graphLastIndex == -1) { // No instance present in the graph
          insertSemanticTypeSuggestion(arr, "", "", clazzLocalNameWithPrefix + "1 (add)", typeURI.getUri(), typeURI.getUri() + "1", probability);
        } else {
          boolean hasLastNodeFromSteinerTree = false;
          for (int i=1; i<= graphLastIndex; i++) {
            if (steinerTreeNodeIds.contains(typeURI.getUri() + (graphLastIndex))) {
              insertSemanticTypeSuggestion(arr, "", "", clazzLocalNameWithPrefix + i, typeURI.getUri(), typeURI.getUri() + i, probability);
            } else {
              Node graphNode = alignment.getNodeById(typeURI.getUri() + i);
              if (graphNode != null)
                insertSemanticTypeSuggestion(arr, "", "", clazzLocalNameWithPrefix + i + " (add)", graphNode.getUri(), graphNode.getId(), probability);
            }
          }
          // Add an option to add one more node for the domain
          if (hasLastNodeFromSteinerTree)
            insertSemanticTypeSuggestion(arr, "", "", clazzLocalNameWithPrefix + (graphLastIndex+1) + " (add)", typeURI.getUri(), typeURI.getUri() + (graphLastIndex+1), probability);
        }
      }
    }
    obj.put("Labels", arr);
    return obj;
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));
        if (!this.graphBuilder.addLink(source, target, link)) continue;;

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

    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);
      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

        continue;
     
      if (vertexIdToArgument.get(n.getId()) == null)
        continue;
     
      Label classPredicate = new Label(n.getLabel().getUri(), n.getLabel().getNs(), n.getLabel().getPrefix());

      ClassAtom classAtom = new ClassAtom(classPredicate, vertexIdToArgument.get(n.getId()));
      m.getAtoms().add(classAtom);
    }
   
    for (LabeledLink e : steinerTree.getLabeledSteinerTree().edgeSet()) {

      inputModelEdges.add(e.getId());
     
      if (vertexIdToArgument.get(e.getSource().getId()) == null ||
          vertexIdToArgument.get(e.getTarget().getId()) == null)
        continue;
     
      Label propertyPredicate = new Label(e.getLabel().getUri(), e.getLabel().getNs(), e.getLabel().getPrefix());
      IndividualPropertyAtom propertyAtom = null;
     
//      // has_subclass is from source to target, we substitute this with a rdfs:subClassOf from target to source
//      if (propertyPredicate.getUriString().equalsIgnoreCase(ModelingParams.HAS_SUBCLASS_URI)){
//        Label subClassPredicate = new Label(ModelingParams.SUBCLASS_URI, Namespaces.OWL, Prefixes.OWL);
View Full Code Here

     
      if (vertexIdToArgument.get(n.getId()) == null)
        continue;
     
     
      Label classPredicate = new Label(n.getLabel().getUri(), n.getLabel().getNs(), n.getLabel().getPrefix());

      ClassAtom classAtom = new ClassAtom(classPredicate, vertexIdToArgument.get(n.getId()));
      m.getAtoms().add(classAtom);
    }
   
    for (LabeledLink e : treeModel.edgeSet()) {
     
      if (inputModelEdges.indexOf(e.getId()) != -1)
        continue;
     
      if (vertexIdToArgument.get(e.getSource().getId()) == null ||
          vertexIdToArgument.get(e.getTarget().getId()) == null)
        continue;
     
      Label propertyPredicate = new Label(e.getLabel().getUri(), e.getLabel().getNs(), e.getLabel().getPrefix());
      IndividualPropertyAtom propertyAtom = null;
     
      // has_subclass is from source to target, we substitute this with a rdfs:subClassOf from target to source
//      if (propertyPredicate.getUriString().equalsIgnoreCase(ModelingParams.HAS_SUBCLASS_URI)){
//        Label subClassPredicate = new Label(ModelingParams.SUBCLASS_URI, Namespaces.OWL, Prefixes.OWL);
View Full Code Here

//  public HashSet<String> getConnectedByRangelessProperties() {
//    return connectedByRangelessProperties;
//  }

  public Label getUriLabel(String uri) {
    Label label = this.classes.get(uri);
    if (label == null) label = this.properties.get(uri);
    if (label == null) label = this.ontHandler.getUriLabel(uri);
    return label;
  }
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.