Package edu.isi.karma.rep.alignment

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


 
  // private methods
 
  private void loadClasses() {
   
    this.classes.put(Uris.THING_URI, new Label(Uris.THING_URI, Namespaces.OWL, Prefixes.OWL));

    ExtendedIterator<OntClass> itrC = ontHandler.getOntModel().listNamedClasses();
   
    while (itrC.hasNext()) {
     
View Full Code Here


  }

  private void loadProperties() {

    this.properties.put(Uris.RDF_TYPE_URI, new Label(Uris.RDF_TYPE_URI, Namespaces.RDF, Prefixes.RDF));
    this.properties.put(Uris.RDF_VALUE_URI, new Label(Uris.RDF_VALUE_URI, Namespaces.RDF, Prefixes.RDF));
    this.properties.put(Uris.RDFS_SUBCLASS_URI, new Label(Uris.RDFS_SUBCLASS_URI, Namespaces.RDFS, Prefixes.RDFS));
    this.properties.put(Uris.RDFS_LABEL_URI, new Label(Uris.RDFS_LABEL_URI, Namespaces.RDFS, Prefixes.RDFS));
    this.properties.put(Uris.RDFS_COMMENT_URI, new Label(Uris.RDFS_COMMENT_URI, Namespaces.RDFS, Prefixes.RDFS));

    this.objectProperties.put(Uris.RDF_TYPE_URI, new Label(Uris.RDF_TYPE_URI, Namespaces.RDF, Prefixes.RDF));
    this.objectProperties.put(Uris.RDF_VALUE_URI, new Label(Uris.RDF_VALUE_URI, Namespaces.RDF, Prefixes.RDF));
    this.objectProperties.put(Uris.RDFS_SUBCLASS_URI, new Label(Uris.RDFS_SUBCLASS_URI, Namespaces.RDFS, Prefixes.RDFS));
    this.dataProperties.put(Uris.RDFS_LABEL_URI, new Label(Uris.RDFS_LABEL_URI, Namespaces.RDFS, Prefixes.RDFS));
    this.dataProperties.put(Uris.RDFS_COMMENT_URI, new Label(Uris.RDFS_COMMENT_URI, Namespaces.RDFS, Prefixes.RDFS));

    this.properties.put(Uris.CLASS_INSTANCE_LINK_URI, new Label(Uris.CLASS_INSTANCE_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV));
    this.properties.put(Uris.COLUMN_SUBCLASS_LINK_URI, new Label(Uris.COLUMN_SUBCLASS_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV));
    this.properties.put(Uris.DATAPROPERTY_OF_COLUMN_LINK_URI, new Label(Uris.DATAPROPERTY_OF_COLUMN_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV));
    this.properties.put(Uris.OBJECTPROPERTY_SPECIALIZATION_LINK_URI, new Label(Uris.OBJECTPROPERTY_SPECIALIZATION_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV));
    this.properties.put(Uris.DEFAULT_LINK_URI, new Label(Uris.DEFAULT_LINK_URI, Namespaces.KARMA_DEV, Prefixes.KARMA_DEV));
   
    ExtendedIterator<OntProperty> itrP = ontHandler.getOntModel().listAllOntProperties();
   
    while (itrP.hasNext()) {
     
View Full Code Here

      if (superClasses == null) {
        superClasses = new HashMap<String, Label>();
        this.indirectSuperClasses.put(c, superClasses);
      }
      if (!c.equalsIgnoreCase(Uris.THING_URI) && !superClasses.containsKey(Uris.THING_URI))
        superClasses.put(Uris.THING_URI, new Label(Uris.THING_URI, Namespaces.OWL, Prefixes.OWL));
    }
   
  }
View Full Code Here

  private void classifyProperties() {

    boolean haveDomain;
    boolean haveRange;
    Label label;
   
    HashSet<String> directDomains;
    HashSet<String> indirectDomains;
    HashSet<String> directRanges;
    HashSet<String> indirectRanges;
View Full Code Here

    }

    /** Remove the labels that are not in the ontology or are already used as the semantic type **/
    List<SemanticTypeLabel> removeLabels = new ArrayList<SemanticTypeLabel>();
    String domainUri, typeUri;
    Label domain, type;
    for (int i=0; i<result.size(); i++) {
      SemanticTypeLabel semLabel = result.get(i);
      String label = semLabel.getLabel();
      /** Check if not in ontology **/
      if (label.contains("|")) {
View Full Code Here

          if (parts == null || parts.length != 2) continue;
 
          String domainUri = parts[0].trim();
          String propertyUri = parts[1].trim();
 
          Label domainLabel = ontologyManager.getUriLabel(domainUri);
          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

        clearOldSemanticTypeLink(oldIncomingLinkToColumnNode,
            oldDomainNode, alignment, classNode);
      }

      if (classNode == null) {
        Label classNodeLabel = ontMgr.getUriLabel(metaPropertyUri);
        if (classNodeLabel == null) {
          String errorMessage = "Error while setting a classLink. MetaPropertyUri '"
              + 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.addClassInstanceLink(classNode, columnNode,
          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);
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

        String edgeSourceUri = edgeSource.getUri();
        String edgeTargetLabel = edgeTarget.getDisplayId();
        String edgeTargetId = edgeTarget.getId();
        String edgeTargetUri = edgeTarget.getUri();
       
        Label srcNodeLabel = edgeSource.getLabel();
        if (srcNodeLabel.getUri() !=null && srcNodeLabel.getNs() != null
            && srcNodeLabel.getUri().equalsIgnoreCase(srcNodeLabel.getNs())) {
          edgeSourceLabel = edgeSource.getId();
        }
        Label trgNodeLabel = edgeTarget.getLabel();
        if (trgNodeLabel.getUri() !=null && trgNodeLabel.getNs() != null
            && trgNodeLabel.getUri().equalsIgnoreCase(trgNodeLabel.getNs())) {
          edgeTargetLabel = edgeTarget.getId();
        }
         
        JSONObject edgeObj = new JSONObject();
        edgeObj.put(JsonKeys.edgeId.name(), link.getLabel().getUri());
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.