public static boolean isValidArcXri(XDI3SubSegment arcXri) {

    if (arcXri == null) return false;

    if (arcXri.isClassXs()) return false;
    if (!arcXri.isAttributeXs()) return false;

    if (XDIConstants.CS_PLUS.equals(arcXri.getCs())
        || XDIConstants.CS_DOLLAR.equals(arcXri.getCs())) {

      if (!arcXri.hasLiteral() && !arcXri.hasXRef()) return false;
    } else {

      return false;
    }

    return true;
  }
示例#2
0
  private static boolean isIri(String string) {

    int indexColon = string.indexOf(':');
    int indexEquals = string.indexOf(XDIConstants.CS_EQUALS.charValue());
    int indexAt = string.indexOf(XDIConstants.CS_AT.charValue());
    int indexPlus = string.indexOf(XDIConstants.CS_PLUS.charValue());
    int indexDollar = string.indexOf(XDIConstants.CS_DOLLAR.charValue());
    int indexStar = string.indexOf(XDIConstants.CS_STAR.charValue());
    int indexBang = string.indexOf(XDIConstants.CS_BANG.charValue());

    if (indexColon == -1) return false;

    if (indexEquals != -1 && indexEquals < indexColon) return false;
    if (indexAt != -1 && indexAt < indexColon) return false;
    if (indexPlus != -1 && indexPlus < indexColon) return false;
    if (indexDollar != -1 && indexDollar < indexColon) return false;
    if (indexStar != -1 && indexStar < indexColon) return false;
    if (indexBang != -1 && indexBang < indexColon) return false;

    return true;
  }