/**
   * Returns the identifier of an LSRN-typed Resource
   *
   * @param lsrnNode
   * @return the identifier
   */
  public static String getID(Resource lsrnNode) {
    Set<String> namespaces = new HashSet<String>();
    for (Iterator<Resource> types = RdfUtils.getTypes(lsrnNode); types.hasNext(); ) {
      Resource type = types.next();
      if (type.isURIResource()) {
        String ns = getNamespaceFromLSRNTypeURI(type.getURI());
        if (ns != null) namespaces.add(ns);
      }
    }

    Iterator<Resource> ids =
        RdfUtils.getPropertyValues(lsrnNode, SIO.has_identifier, null)
            .andThen(RdfUtils.getPropertyValues(lsrnNode, SIO.has_attribute, null));
    while (ids.hasNext()) {
      Resource identifier = ids.next();
      for (Iterator<Resource> types = RdfUtils.getTypes(identifier); types.hasNext(); ) {
        Resource type = types.next();
        if (type.isURIResource()) {
          String ns = getNamespaceFromLSRNIdentifierTypeURI(type.getURI());
          if (ns != null && namespaces.contains(ns)) {
            Statement s = identifier.getProperty(SIO.has_value);
            if (s != null) {
              return s.getString();
            }
          }
        }
      }
    }

    return null;
  }
 /**
  * Adds the LSRN SIO identifier structure to an LSRN-typed Resource. Attempts to use the URL of
  * the Resource to determine the ID.
  *
  * @param lsrnNode
  */
 public static void addIdentifier(Resource lsrnNode) {
   if (lsrnNode.isURIResource()) {
     Matcher idMatcher = ID_PATTERN.matcher(lsrnNode.getURI());
     if (idMatcher.find()) {
       String id = idMatcher.group(1);
       for (Resource type : RdfUtils.getTypes(lsrnNode).toList()) {
         if (!type.isURIResource()) continue;
         Matcher typeMatcher = TYPE_PATTERN.matcher(type.getURI());
         if (typeMatcher.find()) {
           String idTypeURI = OUTPUT_ID_TYPE_PATTERN.replace("$NS", typeMatcher.group(1));
           SIOUtils.createAttribute(
               lsrnNode, SIO.has_identifier, ResourceFactory.createResource(idTypeURI), id);
         }
       }
     }
   }
 }