Examples of OntologyMetadata


Examples of edu.isi.karma.metadata.OntologyMetadata

    VWorkspaceRegistry.getInstance().registerVWorkspace(workspace.getId(), vwsp);
   
    logger.info("Start Metadata Setup");
    try {
      metadataManager.register(new SemanticTypeModelMetadata(workspace), updateContainer);
      metadataManager.register(new OntologyMetadata(workspace), updateContainer);
      metadataManager.register(new JSONModelsMetadata(workspace), updateContainer);
      metadataManager.register(new PythonTransformationMetadata(workspace), updateContainer);
      metadataManager.register(new GraphVizMetadata(workspace), updateContainer);
      metadataManager.register(new ModelLearnerMetadata(workspace), updateContainer);
      metadataManager.register(new R2RMLMetadata(workspace), updateContainer);
View Full Code Here

Examples of org.mmisw.orrclient.gwt.client.rpc.OntologyMetadata

  /**
   * @return the ontologyMetadata
   */
  public OntologyMetadata getOntologyMetadata() {
    if ( ontologyMetadata == null ) {
      ontologyMetadata = new OntologyMetadata();
    }
    return ontologyMetadata;
  }
View Full Code Here

Examples of org.mmisw.orrclient.gwt.client.rpc.OntologyMetadata

   
    if ( log.isDebugEnabled() ) {
      log.debug("prepareOntologyMetadata: ontologyUri=" +ontologyInfo.getUri());
    }
   
    OntologyMetadata ontologyMetadata = ontologyInfo.getOntologyMetadata();

    Resource ontRes = JenaUtil2.getFirstIndividual(model, OWL.Ontology);
   
    StringBuilder moreDetails = new StringBuilder();
   
    Map<String, Property> uriPropMap = MdHelper.getUriPropMap();
    Map<String,String> originalValues = new HashMap<String, String>();
   
    if ( ontRes != null ) {
      //
      // Get values from the existing ontology resource
      //
      for ( AttrGroup attrGroup : metadataBaseInfo.getAttrGroups() ) {
        for ( AttrDef attrDef : attrGroup.getAttrDefs() ) {
         
          // get value of MMI property:
          Property mmiProp = uriPropMap.get(attrDef.getUri());
          String prefixedMmi = MdHelper.prefixedName(mmiProp);
          String value = JenaUtil2.getValue(ontRes, mmiProp);
         
          // DC equivalent, which is obtained if necessary
          Property dcProp = null;
         
          if (value == null) {
            // try a DC equivalent to use:
            dcProp = MdHelper.getEquivalentDcProperty(mmiProp);
            if ( dcProp != null ) {
              value = JenaUtil2.getValue(ontRes, dcProp);
            }
          }
         
          if ( value != null ) {
           
            // get value:
            if ( log.isDebugEnabled() ) {
              log.debug("Assigning: " +attrDef.getUri()+ " = " + value);
            }
            originalValues.put(attrDef.getUri(), value);
           
            // Special case: Omv.acronym/OmvMmi.shortNameUri 
            if ( Omv.acronym.getURI().equals(attrDef.getUri()) ) {
              // add also the value of OmvMmi.shortNameUri:
              String shortNameValue = JenaUtil2.getValue(ontRes, OmvMmi.shortNameUri);
              if ( log.isDebugEnabled() ) {
                log.debug("Also assigning " +OmvMmi.shortNameUri.getURI()+ " = " +shortNameValue);
              }
              originalValues.put(OmvMmi.shortNameUri.getURI(), shortNameValue);
            }
           
           

            // add detail:
            if ( dcProp != null ) {
              String prefixedDc = MdHelper.prefixedName(dcProp);
              _addDetail(moreDetails, prefixedMmi, "not present", "Will use " +prefixedDc);
            }
            else {
              _addDetail(moreDetails, prefixedMmi, "present", " ");
            }
          }
          else {
            if ( attrDef.isRequired() && ! attrDef.isInternal() ) {
              if ( dcProp != null ) {
                String prefixedDc = MdHelper.prefixedName(dcProp);
                _addDetail(moreDetails, prefixedMmi, "not present", "and " +prefixedDc+ " not present either");
             
              else {
                _addDetail(moreDetails, prefixedMmi, "not present", " not equivalent DC");
              }
            }
          }
        }
      }
    }
    else {
      //
      // No ontology resource. Check required attributes to report in the details:
      //
      for ( AttrGroup attrGroup : metadataBaseInfo.getAttrGroups() ) {
        for ( AttrDef attrDef : attrGroup.getAttrDefs() ) {
          if ( attrDef.isRequired() && ! attrDef.isInternal() ) {
            Property mmiProp = uriPropMap.get(attrDef.getUri());
            String prefixedMmi = MdHelper.prefixedName(mmiProp);
            _addDetail(moreDetails, prefixedMmi, "not present", "required");
          }
        }
      }
    }
   
    // add the new details if any:
    if ( moreDetails.length() > 0 ) {
      String details = ontologyMetadata.getDetails();
      if ( details == null ) {
        ontologyMetadata.setDetails(moreDetails.toString());
      }
      else {
        ontologyMetadata.setDetails(details + "\n" +moreDetails.toString());
      }
    }
   
    ontologyMetadata.setOriginalValues(originalValues);
   
    if ( ontologyInfo.getUri() == null ) {
      // associate the original base URI:
      String uri = model.getNsPrefixURI("");
      if ( uri != null ) {
View Full Code Here

Examples of org.mmisw.orrclient.gwt.client.rpc.OntologyMetadata

   * confirming with the user in case of any possible overwriting of attributes.
   */
  public void tempOntologyInfoObtained(TempOntologyInfo tempOntologyInfo) {

    // get the new values from temp file:
    OntologyMetadata ontologyMetadata = tempOntologyInfo.getOntologyMetadata();
   
   
    // get current values in the editor:
   
    Map<String, String> valuesInEditor = new HashMap<String, String>();
    putValues(valuesInEditor, false);
   
    // and from the file
    Map<String, String> tempValues = ontologyMetadata.getOriginalValues();

    Set<String> commonKeysWithDiffValues = new HashSet<String>();
   
    // see if there're common attributes with different values in both the editor and the new file
    for (String tempKey : tempValues.keySet() ) {
      if ( valuesInEditor.keySet().contains(tempKey) ) {
        String valueInEditor = valuesInEditor.get(tempKey);
        String valueInTemp = tempValues.get(tempKey);
        if ( ((valueInEditor == null) ^ (valueInTemp == null ))
        ||   ! valueInEditor.equals(valueInTemp)
        ) {
          commonKeysWithDiffValues.add(tempKey);
        }
      }
    }

    if ( ! commonKeysWithDiffValues.isEmpty() ) {
     
      // prompt the user for the action to take:
     
      String confirmationMsg =
        "There are different values in the uploaded file for " +commonKeysWithDiffValues.size()+ " of the " +
        "non-empty attributes in the metadata editor. " +
        "Do you want to replace the existing values in the editor with those from the file?\n" +
        "\n" +
        "Select Accept to replace those attributes with values from the file.\n" +
        "\n" +
        "Select Cancel to keep the values in the editor.\n" +
        "\n" +
        "In either case, missing attributes in the editor will be updated with " +
        "available values from the file. \n"
      ;
     
      // add the attribute names for administrators:
      if ( PortalControl.getInstance().getLoginResult() != null ) {
        LoginResult loginResult = PortalControl.getInstance().getLoginResult();
        if ( loginResult.isAdministrator() ) {
          confirmationMsg +=
            "\n" +
            "The attributes are:\n" +
            commonKeysWithDiffValues
            ;
        }
      }
     
      if ( true ) {  // this block is just a quick way to open the enclosing DisclosurePanel, if any
        Widget parent = this.getParent();
        while ( parent != null ) {
          if ( parent instanceof DisclosurePanel ) {
            ((DisclosurePanel) parent).setOpen(true);
            break;
          }
          parent = parent.getParent();
        }
      }

      if ( Window.confirm(confirmationMsg) ) {
        // replace common attributes with values from the file.
        // Keep tempValues map as it is. See below.
      }
      else {
        // keep values in the editor, so remove the corresponding keys from tempValues:
        for ( String tempKey : commonKeysWithDiffValues ) {
          tempValues.remove(tempKey);
        }
      }
     
      // use valuesInEditor map to collect the final set of attributes:
      for ( String tempKey : tempValues.keySet() ) {
        valuesInEditor.put(tempKey, tempValues.get(tempKey));
      }
     
      // and set the final set of attributes:
      ontologyMetadata.setOriginalValues(valuesInEditor);
    }

   
    for ( int i = 0, c = tabPanel.getWidgetCount(); i < c; i++ ) {
      Widget w = tabPanel.getWidget(i);
View Full Code Here

Examples of org.mmisw.orrclient.gwt.client.rpc.OntologyMetadata

    return enabled;
  }

 
  public void resetToOriginalValues(BaseOntologyInfo ontologyInfo, ReviewResult_Old reviewResult_Old, boolean confirm, boolean link) {
    OntologyMetadata ontologyMetadata = ontologyInfo.getOntologyMetadata();
    String ontologyUri = ontologyInfo.getUri();
    resetToOriginalOrNewValues(ontologyUri, ontologyMetadata, true, reviewResult_Old, confirm, link);
  }
View Full Code Here

Examples of org.mmisw.orrclient.gwt.client.rpc.OntologyMetadata

    resetToOriginalOrNewValues(ontologyUri, ontologyMetadata, true, reviewResult_Old, confirm, link);
  }
 

  public void resetToOriginalValues(OntologyInfoPre ontologyInfoPre, ReviewResult_Old reviewResult_Old, boolean confirm, boolean link) {
    OntologyMetadata ontologyMetadata = ontologyInfoPre.getOntologyMetadata();
    String ontologyUri = ontologyInfoPre.getUri();
    resetToOriginalOrNewValues(ontologyUri, ontologyMetadata, true, reviewResult_Old, confirm, link);
  }
View Full Code Here

Examples of org.mmisw.orrclient.gwt.client.rpc.OntologyMetadata

    String ontologyUri = ontologyInfoPre.getUri();
    resetToOriginalOrNewValues(ontologyUri, ontologyMetadata, true, reviewResult_Old, confirm, link);
  }
 
  void resetToNewValues(OntologyInfoPre ontologyInfoPre, ReviewResult_Old reviewResult_Old, boolean confirm, boolean link) {
    OntologyMetadata ontologyMetadata = ontologyInfoPre.getOntologyMetadata();
    String ontologyUri = ontologyInfoPre.getUri();
    resetToOriginalOrNewValues(ontologyUri, ontologyMetadata, false, reviewResult_Old, confirm, link);
  }
View Full Code Here

Examples of org.mmisw.orrclient.gwt.client.rpc.OntologyMetadata

   
    if ( log.isDebugEnabled() ) {
      log.debug("prepareOntologyMetadata: ontologyUri=" +ontologyInfo.getUri());
    }
   
    OntologyMetadata ontologyMetadata = ontologyInfo.getOntologyMetadata();

    Resource ontRes = JenaUtil2.getFirstIndividual(model, OWL.Ontology);
   
    StringBuilder moreDetails = new StringBuilder();
   
    Map<String, Property> uriPropMap = MdHelper.getUriPropMap();
    Map<String,String> originalValues = new HashMap<String, String>();
   
    if ( ontRes != null ) {
      //
      // Get values from the existing ontology resource
      //
      for ( AttrGroup attrGroup : metadataBaseInfo.getAttrGroups() ) {
        for ( AttrDef attrDef : attrGroup.getAttrDefs() ) {
         
          // get value of MMI property:
          Property mmiProp = uriPropMap.get(attrDef.getUri());
          String prefixedMmi = MdHelper.prefixedName(mmiProp);
          String value = JenaUtil2.getValue(ontRes, mmiProp);
         
          // DC equivalent, which is obtained if necessary
          Property dcProp = null;
         
          if (value == null) {
            // try a DC equivalent to use:
            dcProp = MdHelper.getEquivalentDcProperty(mmiProp);
            if ( dcProp != null ) {
              value = JenaUtil2.getValue(ontRes, dcProp);
            }
          }
         
          if ( value != null ) {
           
            // get value:
            if ( log.isDebugEnabled() ) {
              log.debug("Assigning: " +attrDef.getUri()+ " = " + value);
            }
            originalValues.put(attrDef.getUri(), value);
           
            // Special case: Omv.acronym/OmvMmi.shortNameUri 
            if ( Omv.acronym.getURI().equals(attrDef.getUri()) ) {
              // add also the value of OmvMmi.shortNameUri:
              String shortNameValue = JenaUtil2.getValue(ontRes, OmvMmi.shortNameUri);
              if ( log.isDebugEnabled() ) {
                log.debug("Also assigning " +OmvMmi.shortNameUri.getURI()+ " = " +shortNameValue);
              }
              originalValues.put(OmvMmi.shortNameUri.getURI(), shortNameValue);
            }
           
           

            // add detail:
            if ( dcProp != null ) {
              String prefixedDc = MdHelper.prefixedName(dcProp);
              _addDetail(moreDetails, prefixedMmi, "not present", "Will use " +prefixedDc);
            }
            else {
              _addDetail(moreDetails, prefixedMmi, "present", " ");
            }
          }
          else {
            if ( attrDef.isRequired() && ! attrDef.isInternal() ) {
              if ( dcProp != null ) {
                String prefixedDc = MdHelper.prefixedName(dcProp);
                _addDetail(moreDetails, prefixedMmi, "not present", "and " +prefixedDc+ " not present either");
             
              else {
                _addDetail(moreDetails, prefixedMmi, "not present", " not equivalent DC");
              }
            }
          }
        }
      }
    }
    else {
      //
      // No ontology resource. Check required attributes to report in the details:
      //
      for ( AttrGroup attrGroup : metadataBaseInfo.getAttrGroups() ) {
        for ( AttrDef attrDef : attrGroup.getAttrDefs() ) {
          if ( attrDef.isRequired() && ! attrDef.isInternal() ) {
            Property mmiProp = uriPropMap.get(attrDef.getUri());
            String prefixedMmi = MdHelper.prefixedName(mmiProp);
            _addDetail(moreDetails, prefixedMmi, "not present", "required");
          }
        }
      }
    }
   
    // add the new details if any:
    if ( moreDetails.length() > 0 ) {
      String details = ontologyMetadata.getDetails();
      if ( details == null ) {
        ontologyMetadata.setDetails(moreDetails.toString());
      }
      else {
        ontologyMetadata.setDetails(details + "\n" +moreDetails.toString());
      }
    }
   
    ontologyMetadata.setOriginalValues(originalValues);
   
    // associate the original base URI:
    String uri = model.getNsPrefixURI("");
    if ( uri != null ) {
      String base_ = JenaUtil2.removeTrailingFragment(uri);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.