{"id":27056596,"url":"https://github.com/maritimeconnectivity/mrnvalidation","last_synced_at":"2025-08-26T15:04:48.309Z","repository":{"id":57737429,"uuid":"261722529","full_name":"maritimeconnectivity/MRNValidation","owner":"maritimeconnectivity","description":"JAVA library for MRN (Maritime Resource Name) validation","archived":false,"fork":false,"pushed_at":"2020-05-18T16:56:52.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-01T16:09:38.667Z","etag":null,"topics":["java","java-library","maritime","maritime-resource-name","validation"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maritimeconnectivity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-06T10:13:31.000Z","updated_at":"2021-03-02T13:46:43.000Z","dependencies_parsed_at":"2022-08-24T14:59:41.714Z","dependency_job_id":null,"html_url":"https://github.com/maritimeconnectivity/MRNValidation","commit_stats":null,"previous_names":["maritimeconnectivityplatform/mrnvalidation"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maritimeconnectivity%2FMRNValidation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maritimeconnectivity%2FMRNValidation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maritimeconnectivity%2FMRNValidation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maritimeconnectivity%2FMRNValidation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maritimeconnectivity","download_url":"https://codeload.github.com/maritimeconnectivity/MRNValidation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247318725,"owners_count":20919483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","java-library","maritime","maritime-resource-name","validation"],"created_at":"2025-04-05T10:18:21.276Z","updated_at":"2025-04-05T10:18:21.814Z","avatar_url":"https://github.com/maritimeconnectivity.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/MaritimeConnectivityPlatform/MRNValidation.svg?branch=master)](https://travis-ci.org/MaritimeConnectivityPlatform/MRNValidation)\n# MRNValidation\nA Java library for MRN validation \n(registered in the Maven repository: https://mvnrepository.com/artifact/net.maritimeconnectivity.mrn/mrn-validation )\n\n## What is MRN?\n[**Maritime Resource Name (MRN)**](https://www.iala-aism.org/technical/data-modelling/mrn/)is a naming scheme under [Uniform Resource Name (URN)](https://en.wikipedia.org/wiki/Uniform_Resource_Name) that can uniquely identify any maritime resource on a global scale, hosted by [IALA](https://www.iala-aism.org/).\nThis implementation is based on the version 1 of MRN proposed by Kasper Nielsen. (https://www.iana.org/assignments/urn-formal/mrn)\n\n## How to use\n- Checking MRN compliance\n```\n  java -jar target/mrn-validation-0.1.0-SNAPSHOT-jar-with-dependencies.jar --mrn \"urn:mrn:mcp:user:granpa:thomas\"\n```\nExpected result of the command above:\n```\n  [main] INFO net.maritimeconnectivity.mrn.Main - PASS: urn:mrn:mcp:user:granpa:thomas is valid.\n```\n\n- Checking MRN compliance with custom regex\n```\n  java -jar target/mrn-validation-0.1.0-SNAPSHOT-jar-with-dependencies.jar --mrn \"urn:mrn:mcp:user:granpa:thomas\" --regex \"^urn:mrn:mcp:(device|org|user|vessel|service|mms):([a-z0-9]([a-z0-9]|-){0,20}[a-z0-9]):((([-._a-z0-9]|~)|%[0-9a-f][0-9a-f]|([!$\u0026'()*+,;=])|:|@)((([-._a-z0-9]|~)|%[0-9a-f][0-9a-f]|([!$\u0026'()*+,;=])|:|@)|/)*)$\"\n```\nExpected result of the command above:\n```\n  [main] INFO net.maritimeconnectivity.mrn.Main - PASS: urn:mrn:mcp:user:granpa:thomas is valid.\n```\n\n- Checking MCP MRN compliance\n```\n  java -jar target/mrn-validation-0.1.0-SNAPSHOT-jar-with-dependencies.jar --mrn \"urn:mrn:mcp:user:granpa:thomas\" --mcp\n```\nExpected result of the command above:\n```\n  [main] INFO net.maritimeconnectivity.mrn.Main - PASS: urn:mrn:mcp:user:granpa:thomas is valid as an MCP MRN.\n```\n\n## Build\nIn the root folder of the repository,\n```\n  mvn clean install\n```\n\n## Prerequisite\nThe MRN validation of this implementation is based on the [regular expression (REGEX)](https://en.wikipedia.org/wiki/Regular_expression), which can be obtained from a MRN syntax through several steps.\nIn the example with [the official MRN syntax](https://www.iana.org/assignments/urn-formal/mrn),\n\n      \u003cMRN\u003e   ::= \"urn\" \":\" \"mrn\" \":\" \u003cOID\u003e \":\" \u003cOSS\u003e\n                  [ rq-components ]\n                  [ \"#\" f-component ]\n      \u003cOID\u003e   ::= (alphanum) 0*20(alphanum / \"-\") (alphanum) ; Organization ID\n      \u003cOSS\u003e   ::= \u003cOSNID\u003e \":\" \u003cOSNS\u003e ; Organization-specific string\n      \u003cOSNID\u003e ::= (alphanum) 0*32(alphanum / \"-\") (alphanum) ; Organization-specific namespace ID\n      \u003cOSNS\u003e  ::= pchar *(pchar / \"/\") ; Organization-specific namespace string\n                  \nThis could be converted to the pure [Augmented Backus–Naur form (ABNF)](https://en.wikipedia.org/wiki/Augmented_Backus%E2%80%93Naur_form) as below:\n\n    mrn = \"urn\" \":\" \"mrn\" \":\" oid \":\" oss [rq-components] [ \"#\" f-component ]\n    oid = (alphanum) 0*20((alphanum) / \"-\") (alphanum) ; Organization ID\n    oss = osnid \":\" osns ; Organization-specific string\n    osnid = (alphanum) 0*20((alphanum) / \"-\") (alphanum) ; Organization-specific namespace ID\n    osns = pchar *(pchar / \"/\") ; Organization-specific namespace string\n    rq-components = [ \"?+\" r-component ][ \"?=\" q-component ] ; rfc8141\n    r-component = pchar *( pchar / \"/\" / \"?\" ) ; rfc8141\n    q-component = pchar *( pchar / \"/\" / \"?\" ) ; rfc8141\n    f-component   = fragment ; rfc8141\n    fragment = *( pchar / \"/\" / \"?\" ) ; ; rfc3986\n    alphanum = ALPHA / DIGIT ; rfc3986\n    pchar = unreserved / pct-encoded / sub-delims / \":\" / \"@\" ; rfc3986\n    unreserved = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\" ; rfc3986\n    pct-encoded = \"%\" HEXDIG HEXDIG ; rfc3986\n    sub-delims = \"!\" / \"$\" / \"\u0026\" / \"'\" / \"(\" / \")\" / \"*\" / \"+\" / \",\" / \";\" / \"=\" ; rfc3986\n\nYou can practice the generation of valid ABNF and corresponding REGEX by online tools, for example: https://abnf.msweet.org/.\n\nThe corresponding raw REGEX of the MRN syntax is:\n\n    mrn: ^[Uu][Rr][Nn]\\:[Mm][Rr][Nn]\\:([A-Za-z0-9]([A-Za-z0-9]|\\-){0,20}[A-Za-z0-9])\\:([A-Za-z0-9][-A-Za-z0-9]{0,20}[A-Za-z0-9])\\:((([-A-Z._a-z0-9]|~)|%[0-9A-Fa-f][0-9A-Fa-f]|(\\!|\\$|\u0026|'|\\(|\\)|\\*|\\+|,|;|\\=)|\\:|@)((([-A-Z._a-z0-9]|~)|%[0-9A-Fa-f][0-9A-Fa-f]|(\\!|\\$|\u0026|'|\\(|\\)|\\*|\\+|,|;|\\=)|\\:|@)|/)*)((\\?\\+((([-A-Z._a-z0-9]|~)|%[0-9A-Fa-f][0-9A-Fa-f]|(\\!|\\$|\u0026|'|\\(|\\)|\\*|\\+|,|;|\\=)|\\:|@)((([-A-Z._a-z0-9]|~)|%[0-9A-Fa-f][0-9A-Fa-f]|(\\!|\\$|\u0026|'|\\(|\\)|\\*|\\+|,|;|\\=)|\\:|@)|/|\\?)*))?(\\?\\=((([-A-Z._a-z0-9]|~)|%[0-9A-Fa-f][0-9A-Fa-f]|(\\!|\\$|\u0026|'|\\(|\\)|\\*|\\+|,|;|\\=)|\\:|@)((([-A-Z._a-z0-9]|~)|%[0-9A-Fa-f][0-9A-Fa-f]|(\\!|\\$|\u0026|'|\\(|\\)|\\*|\\+|,|;|\\=)|\\:|@)|/|\\?)*))?)?(#(((([-A-Z._a-z0-9]|~)|%[0-9A-Fa-f][0-9A-Fa-f]|(\\!|\\$|\u0026|'|\\(|\\)|\\*|\\+|,|;|\\=)|\\:|@)|/|\\?)*))?$\n\nYou can also practice with REGEX and the MRN complying with it by online tools, for example: https://regex101.com/.\n\n## Motivation\nMRN validation has been motivated for MRNs in [Maritime Connectivity Platform (MCP)](https://maritimeconnectivity.net/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaritimeconnectivity%2Fmrnvalidation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaritimeconnectivity%2Fmrnvalidation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaritimeconnectivity%2Fmrnvalidation/lists"}