Package edu.isi.karma.rep.alignment

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


        sources.add(link.getSource());
        targets.add(link.getTarget());

        id = LinkIdFactory.getLinkId(lf1.getLinkUri(), link.getSource().getId(), link.getTarget().getId());
        if (link instanceof ObjectPropertyLink)
          newLinks.add(new ObjectPropertyLink(id, new Label(lf1.getLinkUri()), ((ObjectPropertyLink) link).getObjectPropertyType()));
        else if (link instanceof SubClassLink)
          newLinks.add(new SubClassLink(id));

        weights.add(lf1.getWeight());
      } else if (c < 0) {
        sources.add(link.getTarget());
        targets.add(link.getSource());

        id = LinkIdFactory.getLinkId(lf2.getLinkUri(), link.getSource().getId(), link.getTarget().getId());
        if (link instanceof ObjectPropertyLink)
          newLinks.add(new ObjectPropertyLink(id, new Label(lf2.getLinkUri()), ((ObjectPropertyLink) link).getObjectPropertyType()));
        else if (link instanceof SubClassLink)
          newLinks.add(new SubClassLink(id));

        weights.add(lf2.getWeight());
      } else
View Full Code Here


  }

  private static Node readNode(JsonReader reader) throws IOException {
   
    String id = null;
    Label label = null;
    NodeType type = null;
    String hNodeId = null;
    String columnName = null;
    Label rdfLiteralType = null;
    Label datatype = null;
    String value = null;
    boolean isUri = false;
    SemanticType userSelectedSemanticType = null;
    List<SemanticType> suggestedSemanticTypes = null;
    Set<String> modelIds = null;
View Full Code Here

  }
 
  private static DefaultLink readLink(JsonReader reader, Double[] weight) throws IOException {
   
    String id = null;
    Label label = null;
    LinkType type = null;
    String hNodeId = null;
    ObjectPropertyType objectPropertyType = null;
    String specializedLinkId = null;
    LinkStatus status = null;
View Full Code Here

      }
    }
      reader.endObject();
     
//      Label label = new Label(uri, ns, prefix, rdfsLabel, rdfsComment);
      Label label = new Label(uri);
      return label;
  }
View Full Code Here

  }
 
  private static SemanticType readSemanticType(JsonReader reader) throws IOException {

    String hNodeId = null;
    Label domain = null;
    Label type = null;
    Origin origin = null;
    Double confidenceScore = null;
   
    reader.beginObject();
      while (reader.hasNext()) {
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;
      if (obj instanceof InternalNode)
        e = new ObjectPropertyLink(LinkIdFactory.getLinkId(predicateStr, subj.getId(), obj.getId()), new Label(predicateStr), ObjectPropertyType.None);
      else
        e = new DataPropertyLink(LinkIdFactory.getLinkId(predicateStr, subj.getId(), obj.getId()), new Label(predicateStr));
      graph.addEdge(subj, obj, e);
     
    }
   
    return graph;
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 : treeModel.edgeSet()) {
     
      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 LiteralNode addLiteralNode(String value, String type, boolean isUri) {
   
    type = type.replace(Prefixes.XSD + ":", Namespaces.XSD);
    Label literalType = new Label(type, Namespaces.XSD, Prefixes.XSD);
   
    String id = nodeIdFactory.getNodeId(value);
   
    LiteralNode node = new LiteralNode(id, value, literalType, isUri);
    if(this.graphBuilder.addNode(node)) return node;
View Full Code Here

  }
 
  public void updateLiteralNode(String nodeId, String value, String type, boolean isUri) {
    LiteralNode node = (LiteralNode) getNodeById(nodeId);
    type = type.replace(Prefixes.XSD + ":", Namespaces.XSD);
    Label literalType = new Label(type, Namespaces.XSD, Prefixes.XSD);
   
    node.setDatatype(literalType);
    node.setValue(value);
    node.setUri(isUri);
  }
View Full Code Here

    if (prefix == null || prefix.trim().length() == 0) prefix = null;
   
    OntResource ontR = null;
    try { ontR = (OntResource)r;} catch(Exception e) {}
    if (ontR == null)
      return new Label(r.getURI(), ns, prefix);
   
    String rdfsLabel = ontR.getLabel(null);
    String rdfsComment = ontR.getComment(null);
   
    return new Label(r.getURI(), ns, prefix, rdfsLabel, rdfsComment);
  }
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.