axiom.n3_terms¶
Schema-facing N3 lexical validators and reusable type aliases for RDF terms.
Validators normalize string inputs to RDFLib Node values; serializers emit
canonical N3 for JSON Schema and round-trip fields. Description strings cite W3C
specification titles and public URLs only.
Attributes¶
Module Contents¶
- axiom.n3_terms.TURTLE_ECMA_BLANK_NODE_PATTERN: Final[str] = '^_:[a-zA-Z0-9_](?:[a-zA-Z0-9_.]*[a-zA-Z0-9_])?$'¶
- axiom.n3_terms.RDF_GRAPH_TERM: Final[str] = 'Graph Name as defined by RDF 1.1 Concepts and Abstract Syntax § 4. RDF Datasets...¶
- axiom.n3_terms.RDF_DATASET: Final[str] = 'Dataset as defined by RDF 1.1 Concepts and Abstract Syntax § 4. RDF Datasets...¶
- axiom.n3_terms.RDF_NAMESPACE: Final[str] = 'RDF Vocabulary (Namespace) as defined in RDF 1.1 Concepts and Abstract Syntax § 3.3 Literals...¶
- axiom.n3_terms.TURTLE_BLANK_NODE: Final[str] = 'RDF Blank Node as defined in RDF 1.1 Turtle § 2.6 RDF Blank Nodes...¶
- axiom.n3_terms.TURTLE_IRI: Final[str] = 'RFC 3987 IRI as used in RDF 1.1 Turtle § 2.4 IRIs (https://www.w3.org/TR/turtle/#sec-iri)'¶
- axiom.n3_terms.TURTLE_IRI_EXAMPLES: Final[list[str]] = ['<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<urn:example:s>', '<mailto:user@example.com>']¶
- axiom.n3_terms.TURTLE_LITERAL: Final[str] = 'RDF Literal as defined in RDF 1.1 Turtle § 2.5 RDF Literals (https://www.w3.org/TR/turtle/#literals)'¶
- axiom.n3_terms.TURTLE_LITERAL_EXAMPLES: Final[list[str]] = ['"Project report"', '"A short human-readable description."', '"Hello, World!"@en', '"Hello,...¶
- type axiom.n3_terms.N3Resource = Annotated[IdentifiedNode, BeforeValidator(_parse_identified_node, json_schema_input_type=str), PlainSerializer(_node_to_string, return_type=str), Field(description=textwrap.dedent(f'\n RDF resource accepted in canonical N3 lexical form and serialized in N3.\n It MUST resolve to a {TURTLE_IRI} or a {TURTLE_BLANK_NODE}.\n Full IRIs MAY be provided either as canonical N3 like <urn:example:s> or\n as a bare RFC 3987 IRI like urn:example:s.\n It SHOULD be an IRI when a globally stable identifier is available.\n ').strip(), examples=TURTLE_IRI_EXAMPLES + ['urn:example:s'] + TURTLE_BLANK_NODE_EXAMPLES)]¶
- type axiom.n3_terms.N3IRIRef = Annotated[URIRef, BeforeValidator(_parse_iri, json_schema_input_type=str), PlainSerializer(_node_to_string, return_type=str), Field(description=textwrap.dedent(f'\n RDF IRI reference accepted in canonical N3 lexical form and serialized in N3.\n It MUST resolve to a {TURTLE_IRI}.\n Full IRIs MAY be provided either as canonical N3 like <urn:example:p> or\n as a bare RFC 3987 IRI like urn:example:p.\n Use this for predicates and for resources that cannot be blank nodes.\n ').strip(), examples=TURTLE_IRI_EXAMPLES + ['urn:example:p'])]¶
- type axiom.n3_terms.N3Node = Annotated[Node, BeforeValidator(_parse_node, json_schema_input_type=str), PlainSerializer(_node_to_string, return_type=str), Field(description=textwrap.dedent(f'\n RDF node accepted in canonical N3 lexical form and serialized in N3.\n It MUST resolve to one of the following:\n - {TURTLE_IRI}\n - {TURTLE_BLANK_NODE}\n - {TURTLE_LITERAL}\n Full IRIs MAY be provided either as canonical N3 like <urn:example:o> or\n as a bare RFC 3987 IRI like urn:example:o.\n ').strip(), examples=TURTLE_IRI_EXAMPLES + ['urn:example:o'] + TURTLE_BLANK_NODE_EXAMPLES + TURTLE_LITERAL_EXAMPLES)]¶
- type axiom.n3_terms.N3ContextIdentifier = Annotated[IdentifiedNode, BeforeValidator(_parse_identified_node, json_schema_input_type=str), PlainSerializer(_node_to_string, return_type=str), Field(description=textwrap.dedent(f'\n RDF graph name accepted in canonical N3 lexical form and serialized in N3.\n It corresponds to a {RDF_GRAPH_TERM}.\n It MUST resolve to a {TURTLE_IRI} or a {TURTLE_BLANK_NODE}.\n Full IRIs MAY be provided either as canonical N3 like <urn:example:g> or\n as a bare RFC 3987 IRI like urn:example:g.\n It SHOULD be an IRI when a globally stable graph identifier is available.\n ').strip(), examples=TURTLE_IRI_EXAMPLES + ['urn:example:g'] + TURTLE_BLANK_NODE_EXAMPLES)]¶