Examples of MmiUri


Examples of org.mmisw.ont.mmiuri.MmiUri

      assertEquals("someVocab", mmiUri.getTopic());
      assertEquals(null, mmiUri.getVersion());
    }

    public void testNoTerm2() throws URISyntaxException {
      MmiUri mmiUri = new MmiUri("http://mmisw.org/ont/mmi/someVocab/");
   
      assertEquals("", mmiUri.getTerm());
      assertEquals(null, mmiUri.getVersion());
    }
View Full Code Here

Examples of org.mmisw.ont.mmiuri.MmiUri

      assertEquals(null, mmiUri.getVersion());
    }

    public void testTopicExt() throws URISyntaxException {
      // topic without extension
      MmiUri mmiUri = new MmiUri("http://mmisw.org/ont/mmi/someVocab/someTerm");
   
      assertEquals("", mmiUri.getExtension());

      // ontologyUri with an extension:
        assertEquals("http://mmisw.org/ont/mmi/someVocab.owl", mmiUri.getOntologyUriWithExtension(".owl"));
    }
View Full Code Here

Examples of org.mmisw.ont.mmiuri.MmiUri

      // ontologyUri with an extension:
        assertEquals("http://mmisw.org/ont/mmi/someVocab.owl", mmiUri.getOntologyUriWithExtension(".owl"));
    }

    public void testVersionNull() throws URISyntaxException {
      MmiUri mmiUri = new MmiUri("http://mmisw.org/ont/mmi/someVocab/someTerm");
   
      assertEquals(null, mmiUri.getVersion());
    }
View Full Code Here

Examples of org.mmisw.ont.mmiuri.MmiUri

      MmiUri.checkVersion("20081030T2130");
      MmiUri.checkVersion("20081030T213059");
      MmiUri.checkVersion(MmiUri.LATEST_VERSION_INDICATOR);
    }
    public void testVersion1() throws URISyntaxException {
      MmiUri mmiUri = new MmiUri("http://mmisw.org/ont/mmi/20081021/someVocab/someTerm");
      assertEquals("20081021", mmiUri.getVersion());
    }
View Full Code Here

Examples of org.mmisw.ont.mmiuri.MmiUri

      MmiUri mmiUri = new MmiUri("http://mmisw.org/ont/mmi/20081021/someVocab/someTerm");
      assertEquals("20081021", mmiUri.getVersion());
    }
    public void testVersionInvalid() throws URISyntaxException {
      try {
        new MmiUri("http://mmisw.org/ont/mmi/2008x1021/someVocab/someTerm");
        fail(); // test fails!
      }
      catch (URISyntaxException ok) {
      }
    }
View Full Code Here

Examples of org.mmisw.ont.mmiuri.MmiUri

    }
    public void testVersionInvalid2() throws URISyntaxException {
      try {
        // Note: 4 parts={mmi, badversion, someVocab, someTerm} forces parts[1] to be the version,
        // which is malformed in this case.
        new MmiUri("http://mmisw.org/ont/mmi/badversion/someVocab/someTerm");
        fail(); // test fails!
      }
      catch (URISyntaxException ok) {
      }
    }
View Full Code Here

Examples of org.mmisw.ont.mmiuri.MmiUri

    OntologyInfo ontology = null;
   
   
    // this flag will be true if we have an unversioned request, see Issue 24.
    boolean unversionedRequest = false;
    MmiUri foundMmiUri = null;
   
    OntRequest ontReq = _getThreadLocalOntRequest();
    String version = ontReq.mmiUri.getVersion();
    if ( version == null || version.equals(MmiUri.LATEST_VERSION_INDICATOR) ) {
     
      //
      // handling of unversioned and latest-version requests.  (see Issue 24)
      //
     
      // Get latest version trying all possible topic extensions:
      OntologyInfo mostRecentOntology = db.getMostRecentOntologyVersion(ontReq.mmiUri);

      if ( mostRecentOntology != null ) {
       
        try {
          //
          // Note that mostRecentOntology.getUri() won't have the term component.
          // So, we have to transfer it to foundMmiUri:
          //
          foundMmiUri = new MmiUri(mostRecentOntology.getUri()).copyWithTerm(ontReq.mmiUri.getTerm());
         
          if ( log.isDebugEnabled() ) {
            log.debug("Found ontology version: " +mostRecentOntology.getUri());

            if ( ! ontReq.mmiUri.getExtension().equals(foundMmiUri.getExtension()) ) {
              log.debug("Restored requested extension to: " +ontReq.mmiUri);
            }
          }
         
          // also, restore the original requested extension:
          foundMmiUri = foundMmiUri.copyWithExtension(ontReq.mmiUri.getExtension());
        }
        catch (URISyntaxException e) {
          return new InternalErrorResponse("Shouldn't happen", e);
        }
       
        // OK: here, foundMmiUri refers to the latest version.
       
        if ( version == null ) {
          // unversioned request.
          unversionedRequest = true;
         
          ontology = mostRecentOntology;
         
          // and let the dispatch continue.
        }
        else {
          // request was with version = MmiUri.LATEST_VERSION_INDICATOR.
          // Use a redirect so the user gets the actual latest version:
          String latestUri = foundMmiUri.getTermUri();
          return new RedirectResponse(latestUri);
        }
      }
      else {
        // No versions available!
View Full Code Here

Examples of org.mmisw.ont.mmiuri.MmiUri

   
    List<Item> selected = new ArrayList<Item>();
   
    for (OntologyInfo ontology : onts) {
      try {
        MmiUri mmiUri = new MmiUri(ontology.getUri());
        if ( authority.equalsIgnoreCase(mmiUri.getAuthority())) {
          Item item = new Item();
          item.name = ontology.getDisplayLabel();
          item.version = mmiUri.getVersion();
          item.uri = mmiUri.copyWithVersion(null).getOntologyUri();
          selected.add(item);
        }
      }
      catch (URISyntaxException ignore) {
      }
View Full Code Here

Examples of org.mmisw.ont.mmiuri.MmiUri

          while ( rs.next() ) {
            String ontologyUri = rs.getString(1);
            String display_label = rs.getString(2);
           
            try {
              MmiUri mmiUri = new MmiUri(ontologyUri);

              // discard mapping ontologies:
              String topic = mmiUri.getTopic().toLowerCase();
              if (_isMappingAccordingToTopic(topic)) {
                // discard mapping ontology
                if (log.isDebugEnabled()) {
                  log.debug("listVocabularies: mapping ontology discarded: " + ontologyUri);
                }
                continue;
              }

              String unversionedOntologyUri = mmiUri.copyWithVersion(null).toString();

              // always add unversioned one:
              out.println(unversionedOntologyUri+ SEP +display_label);
             
              if ( unverAndVer ) {   
View Full Code Here

Examples of org.mmisw.ont.mmiuri.MmiUri

          while ( rs.next() ) {
            String ontologyUri = rs.getString(1);
            String display_label = rs.getString(2);
           
            try {
              MmiUri mmiUri = new MmiUri(ontologyUri);

              // only mapping ontologies:
              String topic = mmiUri.getTopic().toLowerCase();
              if (! _isMappingAccordingToTopic(topic)) {
                // discard non-mapping ontology
                if (log.isDebugEnabled()) {
                  log.debug("listMappings: non-mapping ontology discarded: " +ontologyUri);
                }
                continue;
              }

              String unversionedOntologyUri = mmiUri.copyWithVersion(null).toString();

              // always add unversioned one:
              out.println(unversionedOntologyUri+ SEP +display_label);
             
              if ( unverAndVer ) {   
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.