Validate HSML

If you're not interested in the command line or the REST APIs for this, you can use the simple validator page on core.hsml.dev.verses.buildarrow-up-right or on spec.hsml.dev.verses.buildarrow-up-right to perform simple HSML validation on JSON-LD and TURTLE formatted data.

Step 1: Install

From the sdk zip

pip install path/to/hsml_core-VERSION-py3-none-any.whl

if you have access to VERSES internal pypi set up

pip install hsml_core

Step 2: Run the CLI

hsml_validate_jsonld path/to/file.jsonld

Example: Valid HSML

hsml_validate_jsonld simple_valid_hsml_entity_example.jsonld
# Output: JSON-LD is valid HSML.

Example: Invalid HSML

hsml_validate_jsonld simple_invalid_hsml_entity_example.jsonld
# Output: Error: Validation failed ...

Notes

You can add additional SHACL shapes to the default HSML core shapes with --shacl:


Command-Line Usage (POSIX-style Help)

  • JSONLD_FILE: Path to the JSON-LD file to validate. This can be either a local file path or an HTTP(S) URL.

  • --shacl SHACL_FILE [SHACL_FILE ...]: (Optional) Additional SHACL extension files (local paths or URLs) to validate against.

Examples:

  • Validate a local file with the default schema:

  • Validate a file from a URL with a custom SHACL file:

  • Validate a local file with multiple SHACL files (mixing local and URL):

REST API

HSML.d provides simple rest APIs for validating HSML encoded as JSON or turtle.

If you'd like to try running it on your own computer, please see HOW TO: Start HSML.d using docker composearrow-up-right

Last updated