Describes a textual value.
Constraints accepted by the string shape factory.
Length bounds accepted by the string shape factories.
Value constraints accepted by the string shape factories.
Creates a string shape.
Creates a shape for single-line plain text values.
Creates a shape for Markdown text values.
Creates a shape for email address values.
Creates a shape for telephone number values.
Creates a shape for Internationalized Resource Identifier values.
Creates a shape for hierarchical URL values.
Creates a shape for language tag values.
Creates a shape for ISO 8601 year values (YYYY).
Creates a shape for ISO 8601 calendar date values (YYYY-MM-DD).
Creates a shape for ISO 8601 time of day values (hh:mm:ss).
Creates a shape for ISO 8601 date and time values (YYYY-MM-DDThh:mm:ss).
Creates a shape for UTC timestamp values with millisecond precision (YYYY-MM-DDThh:mm:ss.sssZ).
Creates a shape for ISO 8601 duration values ([-]PnYnMnDTnHnMnS).
String shape types and operations.
Defines the shape describing the textual values a resource may carry and its constraint types, and provides the factories stating them, mapping the JSON string type to XSD 1.0 string and temporal datatypes. The string factory bounds a shape by length, lexical and enumeration constraints; the format factories fix the datatype and lexical pattern of a particular format.
Contradictory constraints are rejected as the shape is built, so a shape that exists admits at least one value: stating
minLengthabovemaxLengththrows a TraceError.¹ XSD 1.0 datatypes are referenced by RDF 1.1 and JSON-LD 1.1 as normative
² XSD 1.1 Part 2 § D.3.4 permits optional timezone indicators for
gYearas a deviation from ISO 8601³ Requires exactly 3 fractional second digits (millisecond precision) and UTC timezone (
Zonly); typed asxsd:dateTimerather than the more specificxsd:dateTimeStampfor compatibility with SPARQL temporal functions, which are defined overxsd:dateTimeThe temporal shorthands check the lexical form only: every field is bounded to its legal range and a timezone offset to the ±14:00 range XSD admits, but fields are not cross-checked. As a limitation of that check, a day is bounded to 31 whatever month it falls in, so a date the calendar does not carry, like
2026-02-31, is admitted: whoever needs a real date checks the day against the month.Compatibility
Defining string shapes
An enumeration also narrows the value the shape describes:
statusadmits"active" | "inactive", not the whole textual domain.Specialised string factories
Predefined factories for common string formats:
Using in resource shapes
See