AloeSchema is a simple schema.org accessor and validator that allows custom types and properties
Project description
AloeSchema
A Schema.org Multitool
Getting Started
See quickstart.ipynb for more detailed usage examples
Initialization: Loads schema.org and a validator
from aloeschema import load_schema_org
from aloeschema.validator import AloeSchemaValidator
schema_org = load_schema_org()
schema_validator = AloeSchemaValidator(schema_org)
Validating schema.org
- Input case is ignored by default (
ignore_case=True) - Detailed errors raised by default (
quiet=False)- Set
quiet=Trueto return a truthy result instead
- Set
from aloeschema.validator import AloeSchemaValidator
from aloeschema import load_schema_org
schema_org = load_schema_org()
schema_validator = AloeSchemaValidator(schema_org)
schema_validator.Validate(subject_type_name="person", property_type_name="potentialaction", object_type_name="planaction")
schema_validator._getType("schedule")
Extending Schema.org With Custom Types and Properties
use registerCustomType and registerCustomProperty to extend Schema.org with custom types and properties
from aloeschema.validator import AloeSchemaValidator
from aloeschema import load_schema_org, registerCustomProperty, registerCustomType
schema_org = load_schema_org()
schema_org = registerCustomType(schema_org, name="User", parent="Person", properties=[])
schema_org = registerCustomProperty(schema_org, name:="userName", domain=["Person", "User"], range=["Text"])
schema_validator = AloeSchemaValidator(schema_org)
print(f"""
Custom Property: `userName`
Description: {schema_validator._getProperty("userName", ignore_case=True)}
""")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aloeschema-0.1.0.tar.gz.
File metadata
- Download URL: aloeschema-0.1.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bdb7f06444cbb98dfd973fd49cc98bec13edf8ce004cefd773c4e7f8346909a
|
|
| MD5 |
1605a968185b052d1cbf1f809f70a234
|
|
| BLAKE2b-256 |
344247ad8c2ba62a1f4cab26031b18e484a4357e3a21320991aadefd1f5fe228
|
File details
Details for the file aloeschema-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aloeschema-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9110ffd4f58a21f9c6e9f00c42decb46eba50bc53886be4b920ac6bd4a5099d8
|
|
| MD5 |
9d954bc8661f752a9a78d3fed76f1e9a
|
|
| BLAKE2b-256 |
0d13dc4d432e99694e0425c282a176bdd0e6a571f7bbc48b7a0f5909f7a044cb
|