axiom.n3_terms ============== .. py:module:: axiom.n3_terms .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: axiom.n3_terms.TURTLE_ECMA_BLANK_NODE_PATTERN axiom.n3_terms.RDF_GRAPH_TERM axiom.n3_terms.RDF_DATASET axiom.n3_terms.RDF_NAMESPACE axiom.n3_terms.TURTLE_BLANK_NODE axiom.n3_terms.TURTLE_BLANK_NODE_EXAMPLES axiom.n3_terms.TURTLE_IRI axiom.n3_terms.TURTLE_IRI_EXAMPLES axiom.n3_terms.TURTLE_LITERAL axiom.n3_terms.TURTLE_LITERAL_EXAMPLES axiom.n3_terms.N3Resource axiom.n3_terms.N3IRIRef axiom.n3_terms.N3Node axiom.n3_terms.N3ContextIdentifier Module Contents --------------- .. py:data:: TURTLE_ECMA_BLANK_NODE_PATTERN :type: Final[str] :value: '^_:[a-zA-Z0-9_](?:[a-zA-Z0-9_.]*[a-zA-Z0-9_])?$' .. py:data:: RDF_GRAPH_TERM :type: Final[str] :value: 'Graph Name as defined by RDF 1.1 Concepts and Abstract Syntax § 4. RDF Datasets... .. py:data:: RDF_DATASET :type: Final[str] :value: 'Dataset as defined by RDF 1.1 Concepts and Abstract Syntax § 4. RDF Datasets... .. py:data:: RDF_NAMESPACE :type: Final[str] :value: 'RDF Vocabulary (Namespace) as defined in RDF 1.1 Concepts and Abstract Syntax § 3.3 Literals... .. py:data:: TURTLE_BLANK_NODE :type: Final[str] :value: 'RDF Blank Node as defined in RDF 1.1 Turtle § 2.6 RDF Blank Nodes... .. py:data:: TURTLE_BLANK_NODE_EXAMPLES :type: Final[list[str]] :value: ['_:b', '_:g70', '_:personEntity'] .. py:data:: TURTLE_IRI :type: Final[str] :value: 'RFC 3987 IRI as used in RDF 1.1 Turtle § 2.4 IRIs (https://www.w3.org/TR/turtle/#sec-iri)' .. py:data:: TURTLE_IRI_EXAMPLES :type: Final[list[str]] :value: ['', '', ''] .. py:data:: TURTLE_LITERAL :type: Final[str] :value: 'RDF Literal as defined in RDF 1.1 Turtle § 2.5 RDF Literals (https://www.w3.org/TR/turtle/#literals)' .. py:data:: TURTLE_LITERAL_EXAMPLES :type: Final[list[str]] :value: ['"Project report"', '"A short human-readable description."', '"Hello, World!"@en', '"Hello,... .. py:type:: N3Resource :canonical: 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 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)] .. py:type:: N3IRIRef :canonical: 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 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'])] .. py:type:: N3Node :canonical: 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 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)] .. py:type:: N3ContextIdentifier :canonical: 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 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)]