@Before
  public void setUp() throws Exception {
    when(entity.getIRI()).thenReturn(iri);
    when(iriShortFormProvider.getShortForm(iri)).thenReturn(SHORT_FORM);
    shortFromProvider = new WebProtegeShortFormProvider(iriShortFormProvider);

    when(((HasPrefixedName) entityWithPrefixedName).getPrefixedName()).thenReturn(PREFIXED_FORM);
  }
示例#2
0
  /**
   * Lexicalize URI by using the short form and split into tokens.
   *
   * @param uri
   * @return
   */
  private String[] lexicalize(String uri) {
    // get short form
    String s = sfp.getShortForm(IRI.create(uri));

    // split by camel case
    String[] tokens = s.split(regex);

    // to lower case
    for (int i = 0; i < tokens.length; i++) {
      String token = tokens[i];
      if (token.length() == 1
          || (Character.isUpperCase(token.charAt(0)) && !Character.isUpperCase(token.charAt(1)))) {
        tokens[i] = token.toLowerCase();
      }
    }

    return tokens;
  }
示例#3
0
 private boolean singleToken(String uri) {
   return sfp.getShortForm(IRI.create(uri)).split(regex).length == 1;
 }
示例#4
0
 private String buildNewURI(String subClassURI, String superClassHead) {
   String shortForm = sfp.getShortForm(IRI.create(subClassURI));
   String newShortForm = shortForm + StringUtils.capitalize(superClassHead);
   String newClassURI = subClassURI.replace(shortForm, newShortForm);
   return newClassURI;
 }