Package org.mmisw.orrclient.gwt.client.rpc

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


    if ( graphId == null || graphId.trim().length() == 0 ) {
      graphId = "";
    }

   
    TempOntologyInfo tempOntologyInfo = getTempOntologyInfo(file);
   
    String ontologyUri = fields.get("ontologyUri").trim();
    tempOntologyInfo.setIsOntResolvable(OntServiceUtil.isOntResolvableUri(ontologyUri));
   
    RegisteredOntologyInfo registeredOntologyInfo = orrClient.getOntologyInfo(ontologyUri);
   
    if ( registeredOntologyInfo == null ) {
      //
View Full Code Here


 
 

  private TempOntologyInfo getTempOntologyInfo(File file) throws Exception {
    TempOntologyInfo tempOntologyInfo = new TempOntologyInfo();

    try {
      Utf8Util.verifyUtf8(file);
    }
    catch (Exception e) {
      String error = "verifyUtf8: " +e.getMessage();
      log.error(error, e);
      throw new Exception(error, e);
    }
   
    String full_path = file.getAbsolutePath();
   
    try {
      Util2.readRdf(file);
    }
    catch (Throwable e) {
      String error = "Cannot read RDF model: " +full_path+ " : " +e.getMessage();
      log.info(error, e);
      tempOntologyInfo.setError(error);
      return tempOntologyInfo;
    }
 
    tempOntologyInfo.setFullPath(full_path);

    return tempOntologyInfo;
  }
View Full Code Here

    String filename;
    try {
      filename = _getFilePathFromUploadResults(uploadResults);
    }
    catch (Exception e) {
      TempOntologyInfo tempOntologyInfo = new TempOntologyInfo();
      tempOntologyInfo.setError(e.getMessage());
      return tempOntologyInfo;
    }
   
    return orrClient.getTempOntologyInfo(fileType, filename, includeContents, includeRdf);
  }
View Full Code Here

    assert ( newValues != null ) ;
   
    DataCreationInfo dataCreationInfo = createOntologyInfo.getDataCreationInfo();
    assert ( dataCreationInfo instanceof OtherDataCreationInfo ) ;
    final OtherDataCreationInfo otherDataCreationInfo = (OtherDataCreationInfo) dataCreationInfo;
    final TempOntologyInfo tempOntologyInfo = otherDataCreationInfo.getTempOntologyInfo();

   
    // to check if this is going to be a new submission (if ontologyId == null) or, otherwise, a new version.
    final String ontologyId = createOntologyInfo.getPriorOntologyInfo().getOntologyId();
   
   
    final String namespaceRoot = defaultNamespaceRoot;
    final String orgAbbreviation = createOntologyInfo.getAuthority();
    final String shortName = createOntologyInfo.getShortName();


    if ( orgAbbreviation == null ) {
      // should not happen.
      String error = "missing authority abbreviation";
      log.info(error);
      createOntologyResult.setError(error);
      return createOntologyResult;
    }
    if ( shortName == null ) {
      // should not happen.
      String error = "missing short name";
      log.info(error);
      createOntologyResult.setError(error);
      return createOntologyResult;
    }

    if ( ontologyId == null ) {
      // This is a new submission. We need to check for any conflict with a preexisting
      // ontology in the repository with the same shortName+orgAbbreviation combination
      //
      if ( ! Util2.checkNoPreexistingOntology(namespaceRoot, orgAbbreviation, shortName, createOntologyResult) ) {
        return createOntologyResult;
      }
    }
    else {
      // This is a submission of a *new version* of an existing ontology.
      // We need to check the shortName+orgAbbreviation combination as any changes here
      // would imply a *new* ontology, not a new version.
      //

      BaseOntologyInfo baseOntologyInfo = createOntologyInfo.getBaseOntologyInfo();
      assert baseOntologyInfo instanceof RegisteredOntologyInfo;
      RegisteredOntologyInfo roi = (RegisteredOntologyInfo) baseOntologyInfo;

      String originalOrgAbbreviation = roi.getAuthority();
      String originalShortName = roi.getShortName();

      if ( ! Util2.checkUriKeyCombinationForNewVersion(
          originalOrgAbbreviation, originalShortName,
          orgAbbreviation, shortName, createOntologyResult) ) {
        return createOntologyResult;
      }
    }
   
   
    ////////////////////////////////////////////////////////////////////////////
    // section to create the ontology the base:
   
    // external ontology case: the base ontology is already available, just use it
    // by setting the full path in the createOntologyResult:
     
    String full_path;

    if ( tempOntologyInfo != null ) {
      // new contents were provided. Use that:
      full_path = tempOntologyInfo.getFullPath();
    }
    else {
      // No new contents. Only possible way for this to happen is that this is
      // a new version of an existing ontology.

View Full Code Here

    assert ( newValues != null ) ;
   
    DataCreationInfo dataCreationInfo = createOntologyInfo.getDataCreationInfo();
    assert ( dataCreationInfo instanceof OtherDataCreationInfo ) ;
    final OtherDataCreationInfo otherDataCreationInfo = (OtherDataCreationInfo) dataCreationInfo;
    final TempOntologyInfo tempOntologyInfo = otherDataCreationInfo.getTempOntologyInfo();

   
    // to check if this is going to be a new submission (if ontologyId == null) or, otherwise, a new version.
    final String ontologyId = createOntologyInfo.getPriorOntologyInfo().getOntologyId();
   
   
    ////////////////////////////////////////////////////////////////////////////
    // section to create the ontology the base:
   
    // external ontology case: the base ontology is already available, just use it
    // by setting the full path in the createOntologyResult:
     
    String full_path;

    if ( tempOntologyInfo != null ) {
      // new contents were provided. Use that:
      full_path = tempOntologyInfo.getFullPath();
    }
    else {
      // No new contents. Only possible way for this to happen is that this is
      // a new version of an existing ontology.
View Full Code Here

    // and the user indicates that the original base namespace be preserved.
    createOntologyResult.setPreserveOriginalBaseNamespace(false);
   
    if ( dataCreationInfo instanceof OtherDataCreationInfo ) {
      OtherDataCreationInfo odci = (OtherDataCreationInfo) dataCreationInfo;
      TempOntologyInfo toi = odci.getTempOntologyInfo();
      createOntologyResult.setPreserveOriginalBaseNamespace(toi != null && toi.isPreserveOriginalBaseNamespace());
    }

   
    if ( ! createOntologyResult.isPreserveOriginalBaseNamespace() ) {
      // Note: if this is the submission of a new version (ontologyId != null) of an "external" (ie, re-hosted)
      // ontology, then set this flag to true
      if ( ontologyId != null && ! OntServiceUtil.isOntResolvableUri(createOntologyInfo.getUri()) ) {
        createOntologyResult.setPreserveOriginalBaseNamespace(true);
       
        // TODO However, note that we're goint to preserve the URI of the given ontology in this submission,
        // which may not coincide with the previous one.
      }
    }
    //}pons

   
    Map<String, String> newValues = createOntologyInfo.getMetadataValues();
   
    ////////////////////////////////////////////
    // check for errors
   
    if ( createOntologyResult.getError() != null ) {
      log.info(": error: " +createOntologyResult.getError());
      return createOntologyResult;
    }
   
   
    if ( newValues == null ) {
      String error = "Unexpected: no new values assigned for review. Please report this bug";
      createOntologyResult.setError(error );
      log.info(error);
      return createOntologyResult;
    }
   
   
    final String namespaceRoot = defaultNamespaceRoot;
   
    final String orgAbbreviation = newValues.get(OmvMmi.origMaintainerCode.getURI());
    String shortName = newValues.get(Omv.acronym.getURI());
    // TODO: shortName taken NOT from acronym but from a new field explicitly for the shortName piece

    if ( ! createOntologyResult.isPreserveOriginalBaseNamespace() ) {
      //pons: check the following if regular assignment of namespace
     
      if ( orgAbbreviation == null ) {
        log.info("missing origMaintainerCode");
        createOntologyResult.setError("missing origMaintainerCode");
        return createOntologyResult;
      }
     
      if ( shortName == null ) {
       
        if ( ontologyId == null ) {
          // This is a new submission.
          log.info("missing acronym (to be used as shortName)");
          createOntologyResult.setError("missing acronym (to be used as shortName)");
          return createOntologyResult;
        }
        else {
          // take from previous information
          String originalShortName = createOntologyInfo.getShortName();
          shortName = originalShortName;
        }
      }

      if ( ontologyId == null ) {
        // This is a new submission. We need to check for any conflict with a preexisting
        // ontology in the repository with the same shortName+orgAbbreviation combination
        //
        if ( ! Util2.checkNoPreexistingOntology(namespaceRoot, orgAbbreviation, shortName, createOntologyResult) ) {
          return createOntologyResult;
        }
      }
      else {
        // This is a submission of a *new version* of an existing ontology.
        // We need to check the shortName+orgAbbreviation combination as any changes here
        // would imply a *new* ontology, not a new version.
        //
       
        String originalOrgAbbreviation = createOntologyInfo.getAuthority();
        String originalShortName = createOntologyInfo.getShortName();
       
        if ( ! Util2.checkUriKeyCombinationForNewVersion(
            originalOrgAbbreviation, originalShortName,
            orgAbbreviation, shortName, createOntologyResult) ) {
          return createOntologyResult;
        }
      }
    }
    // Else: see below, where we obtain the original namespace.
   
   
    ////////////////////////////////////////////////////////////////////////////
    // section to create the ontology the base:
   
    if ( dataCreationInfo instanceof VocabularyDataCreationInfo ) {
      // vocabulary (voc2rdf) case:
     
      VocabularyDataCreationInfo vocabularyDataCreationInfo = (VocabularyDataCreationInfo) dataCreationInfo;
     
      _createTempVocabularyOntology(createOntologyInfo, vocabularyDataCreationInfo, createOntologyResult);
      if ( createOntologyResult.getError() != null ) {
        return createOntologyResult;
      }
    }
    else if dataCreationInfo instanceof MappingDataCreationInfo ) {
      // mapping (vine case):
     
      MappingDataCreationInfo mappingDataCreationInfo = (MappingDataCreationInfo) dataCreationInfo;
     
      _createTempMappingOntology(createOntologyInfo, mappingDataCreationInfo, createOntologyResult);
      if ( createOntologyResult.getError() != null ) {
        return createOntologyResult;
      }

    }
    else if dataCreationInfo instanceof OtherDataCreationInfo) {
      // external ontology case: the base ontology is already available, just use it
      // by setting the full path in the createOntologyResult:
     
      OtherDataCreationInfo otherDataCreationInfo = (OtherDataCreationInfo) dataCreationInfo;
      TempOntologyInfo tempOntologyInfo = otherDataCreationInfo.getTempOntologyInfo();
     
      String full_path;
     
      if ( tempOntologyInfo != null ) {
        // new contents were provided. Use that:
        full_path = tempOntologyInfo.getFullPath();
      }
      else {
        // No new contents. Only possible way for this to happen is that this is
        // a new version of an existing ontology.
       
View Full Code Here

 
  public TempOntologyInfo getTempOntologyInfo(
      String fileType, String filename,
      boolean includeContents, boolean includeRdf
  ) {
    TempOntologyInfo tempOntologyInfo = new TempOntologyInfo();
   
    if ( metadataBaseInfo == null ) {
      tempOntologyInfo.setError(OrrClientImpl.class.getSimpleName()+ " not properly initialized. Please report this bug. (metadataBaseInfo not initialized)");
      return tempOntologyInfo;
    }
   
    TempOntologyHelper tempOntologyHelper = new TempOntologyHelper(metadataBaseInfo);
    tempOntologyHelper.getTempOntologyInfo(fileType, filename, tempOntologyInfo, includeRdf);
   
    if ( tempOntologyInfo.getError() != null ) {
      return tempOntologyInfo;
    }
   
    if ( includeContents ) {
      _getOntologyContents(tempOntologyInfo);
View Full Code Here

  }
 
  private void _verifyMappings(OntModel ontModel) throws Exception {
    // now, test correct extraction
   
    TempOntologyInfo baseOntologyInfo = new TempOntologyInfo();
    baseOntologyInfo.setUri(ontologyUri);
    OntInfoUtil.getEntities(baseOntologyInfo, ontModel);
   
    OntologyData od = baseOntologyInfo.getOntologyData();
    assertSame("ontology data should be mapping", MappingOntologyData.class, od.getClass());

    // check that all mappings in the model exactly correspond to the original ones:
    MappingOntologyData mod = (MappingOntologyData) od;
    List<Mapping> mappings = mod.getMappings();
View Full Code Here

      log.info(error);
      registerOntologyResult.setError(error);
      return registerOntologyResult;
    }
   
    TempOntologyInfo tempOntologyInfo = (TempOntologyInfo) baseOntologyInfo;
   
    String full_path = tempOntologyInfo.getFullPath();
   
    log.info("registerOntologyDirectly: Reading in temporary file: " +full_path);
   
    // get the RDF contents:
    File file = new File(full_path);
View Full Code Here

    orrClient.getMetadataBaseInfo(false, resourceTypeClassUri, authorityClassUri);
   
   
    log.info("=============== GET getTempOntologyInfo =================");
   
    TempOntologyInfo tempOntologyInfo = orrClient.getTempOntologyInfo(fileType, filename, false, false);
    assertNull("No error in getTempOntologyInfo", tempOntologyInfo.getError());
    String namespace = tempOntologyInfo.getUri();
    log.info("tempOntologyInfo.getUri() = " +namespace);
    assertNotNull("namespace must be present", namespace);
   
    log.info("=============== authenticate user =================");
    LoginResult loginResult = _authenticateUser(orrClient);
View Full Code Here

TOP

Related Classes of org.mmisw.orrclient.gwt.client.rpc.TempOntologyInfo

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.