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

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


      mappingMetadata.put(Vine.confidence.getURI(), confidences[i]);
      mapping.setMetadata(mappingMetadata);
      mappings.add(mapping);
      originalTriples.add(new StmtKey(mapp[0], mapp[1], mapp[2]));
    }   
    CreateOntologyInfo coi = new CreateOntologyInfo();
    coi.setUri(ontologyUri);
    coi.setAuthority(authority);
    coi.setShortName(shortName);
    Map<String, String> metadataValues = new HashMap<String, String>();
    coi.setMetadataValues(metadataValues);
   
    MappingOntologyCreator creator = new MappingOntologyCreator(coi, mdci);
   
    CreateOntologyResult result = new CreateOntologyResult();
    creator.createOntology(result);
View Full Code Here


 
  public RegisterOntologyResult registerOntology(CreateOntologyResult createOntologyResult, LoginResult loginResult) {
    RegisterOntologyResult registerOntologyResult = null;

        CreateOntologyInfo createOntologyInfo = createOntologyResult.getCreateOntologyInfo();
    if ( createOntologyInfo.getHostingType() != null ) {
      // use of this attribute indicates to use the new method
      registerOntologyResult = registerOntology_newMethod(createOntologyResult, loginResult);
    }
    else {
      registerOntologyResult = registerOntology_oldMethod(createOntologyResult, loginResult);
    }

        if (registerOntologyResult.getError() == null) {
            /////////////////////////////////////////////////////////////////////////
            // send email to notify successful registration
            // (this is very ad hoc -- will be more configurable in a next version)
            /////////////////////////////////////////////////////////////////////////

            // TODO update to reuse auxiliary methods introduced later

            final Set<String> recipients = new LinkedHashSet<String>();
            try {
                File f = new File(notifyEmailsFilename);
                FileInputStream is = new FileInputStream(f);
                for (Object line: IOUtils.readLines(is)) {
                    String email = String.valueOf(line).trim();
                    if (email.length() > 0 && !email.startsWith("#")) {
                        recipients.add(email);
                    }
                }
                IOUtils.closeQuietly(is);
            }
            catch (Exception e) {
                log.warn("could not read in: " + notifyEmailsFilename, e);
            }

            if (recipients.size() > 0) {
                final Map<String, String> data = new LinkedHashMap<String, String>();
                try {
                    String ontologyUri = registerOntologyResult.getUri();
                    String version = null;
                    String withUriParam = null;

                    if ( OntServiceUtil.isOntResolvableUri(ontologyUri) ) {
                        // prefer to show the unversioned URI
                        try {
                            MmiUri mmiUri = new MmiUri(ontologyUri);
                            version = mmiUri.getVersion();
                            ontologyUri = mmiUri.copyWithVersion(null).getOntologyUri();
                        }
                        catch (URISyntaxException ignore) {
                        }
                    }
                    else {
                        withUriParam = config.getOntServiceUrl() + "?uri=" + ontologyUri;
                    }

                    data.put("URI", ontologyUri);
                    if (version != null) {
                        data.put("version", version);
                    }
                    if (withUriParam != null) {
                        data.put("Resolve with", withUriParam);
                    }
                    data.put("Registered by",  loginResult.getUserName());
                    BaseOntologyInfo baseOntologyInfo = createOntologyInfo.getBaseOntologyInfo();
                    if (baseOntologyInfo != null) {
                        String displayLabel = baseOntologyInfo.getDisplayLabel();
                        if (displayLabel != null) {
                            data.put("DisplayLabel", baseOntologyInfo.getDisplayLabel());
                        }
View Full Code Here

    assert loginResult.getUserId() != null;
    assert loginResult.getSessionId() != null;
   
    log.info(": registering URI: " +uri+ " ...");

    CreateOntologyInfo createOntologyInfo = createOntologyResult.getCreateOntologyInfo();

    String ontologyId = createOntologyInfo.getPriorOntologyInfo().getOntologyId();
    String ontologyUserId = createOntologyInfo.getPriorOntologyInfo().getOntologyUserId();
   
    if ( ontologyId != null ) {
      log.info("Will create a new version for ontologyId = " +ontologyId+ ", userId=" +ontologyUserId);
    }
   
   
    Map<String, String> newValues = createOntologyInfo .getMetadataValues();
   

    try {
      // this is to get the filename for the registration
      String fileName = new URL(uri).getPath();
     
      //
      // make sure the fileName ends with ".owl" as the aquaportal back-end seems
      // to add that fixed extension in some operations (at least in the parse operation)
      //
      if ( ! fileName.toLowerCase().endsWith(".owl") ) {
        if ( log.isDebugEnabled() ) {
          log.debug("register: setting file extension to .owl per aquaportal requirement.");
        }
        fileName += ".owl";
      }
     
     
      if ( ontologyId == null ) {
        //
        // Submission of a new ontology (not version of a registered one)
        //
       
        // We are about to do the actual registration. But first, re-check that there is NO a preexisting
        // ontology that may conflict with this one.
        // NOTE: this check has been done already in the review operation; however, we repeat it here
        // in case there is a new registration done by other user in the meantime. Of course, we
        // are NOT completely solving the potential concurrency problem with this re-check; we are just
        // reducing the chances of that event.
       
       
        // TODO: the following can be simplified by obtaining the unversioned form of the URI and
        // calling Util2.checkNoPreexistingOntology(unversionedUri, registerOntologyResult)

        final String namespaceRoot = newValues.get("namespaceRoot") != null
            ? newValues.get("namespaceRoot")
            :  defaultNamespaceRoot;

        final String orgAbbreviation = createOntologyInfo.getAuthority();
        final String shortName = createOntologyInfo.getShortName();

        if ( ! Util2.checkNoPreexistingOntology(namespaceRoot, orgAbbreviation, shortName, registerOntologyResult) ) {
          return registerOntologyResult;
        }
View Full Code Here

   
    log.info("=============== authenticate user =================");
    LoginResult loginResult = _authenticateUser(orrClient);
   
    log.info("=============== createOntology =================");
    CreateOntologyInfo createOntologyInfo = new CreateOntologyInfo();
    OtherDataCreationInfo dataCreationInfo = new OtherDataCreationInfo();
    dataCreationInfo.setTempOntologyInfo(tempOntologyInfo);
//    createOntologyInfo.setBaseOntologyInfo(tempOntologyInfo);
    createOntologyInfo.setUri(namespace);
    createOntologyInfo.setDataCreationInfo(dataCreationInfo);
    createOntologyInfo.setHostingType(HostingType.RE_HOSTED);
    Map<String, String> metadataValues = _getMetadataValues(prefix);
    createOntologyInfo.setMetadataValues(metadataValues);
   
    CreateOntologyResult createOntologyResult = orrClient.createOntology(createOntologyInfo);
    assertNull("No error in createOntologyResult", createOntologyResult.getError());
    log.debug("createOntologyResult = " +createOntologyResult);
   
View Full Code Here

TOP

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

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.