70 lines
1.9 KiB
Elixir
70 lines
1.9 KiB
Elixir
defmodule RDF.TestDatatypes do
|
|
defmodule Initials do
|
|
use RDF.XSD.Datatype.Restriction,
|
|
name: "initials",
|
|
id: "http://example.com/initials",
|
|
base: RDF.XSD.String
|
|
|
|
def_facet_constraint RDF.XSD.Facets.Length, 2
|
|
end
|
|
|
|
defmodule UsZipcode do
|
|
use RDF.XSD.Datatype.Restriction,
|
|
name: "us_zipcode",
|
|
id: "http://example.com/us-zipcode",
|
|
base: RDF.XSD.String
|
|
|
|
def_facet_constraint RDF.XSD.Facets.Pattern, "[0-9]{5}(-[0-9]{4})?"
|
|
end
|
|
|
|
defmodule AltUsZipcode do
|
|
use RDF.XSD.Datatype.Restriction,
|
|
name: "alt_us_zipcode",
|
|
id: "http://example.com/alt-us-zipcode",
|
|
base: RDF.XSD.String
|
|
|
|
def_facet_constraint RDF.XSD.Facets.Pattern, [
|
|
"[0-9]{5}",
|
|
"[0-9]{5}-[0-9]{4}",
|
|
]
|
|
end
|
|
|
|
defmodule Age do
|
|
use RDF.XSD.Datatype.Restriction,
|
|
name: "age",
|
|
id: "http://example.com/Age",
|
|
base: RDF.XSD.PositiveInteger
|
|
|
|
def_facet_constraint RDF.XSD.Facets.MaxInclusive, 150
|
|
end
|
|
|
|
defmodule DecimalUnitInterval do
|
|
use RDF.XSD.Datatype.Restriction,
|
|
name: "decimal_unit_interval",
|
|
id: "http://example.com/decimalUnitInterval",
|
|
base: RDF.XSD.Decimal
|
|
|
|
def_facet_constraint RDF.XSD.Facets.MinInclusive, 0
|
|
def_facet_constraint RDF.XSD.Facets.MaxInclusive, 1
|
|
end
|
|
|
|
defmodule DoubleUnitInterval do
|
|
use RDF.XSD.Datatype.Restriction,
|
|
name: "double_unit_interval",
|
|
id: "http://example.com/doubleUnitInterval",
|
|
base: RDF.XSD.Double
|
|
|
|
def_facet_constraint RDF.XSD.Facets.MinInclusive, 0
|
|
def_facet_constraint RDF.XSD.Facets.MaxInclusive, 1
|
|
end
|
|
|
|
defmodule FloatUnitInterval do
|
|
use RDF.XSD.Datatype.Restriction,
|
|
name: "float_unit_interval",
|
|
id: "http://example.com/floatUnitInterval",
|
|
base: RDF.XSD.Float
|
|
|
|
def_facet_constraint RDF.XSD.Facets.MinInclusive, 0
|
|
def_facet_constraint RDF.XSD.Facets.MaxInclusive, 1
|
|
end
|
|
end
|