2020-05-07 13:37:21 +00:00
|
|
|
defmodule RDF.TestDatatypes do
|
2020-05-17 20:54:07 +00:00
|
|
|
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
|
|
|
|
|
2020-05-21 15:54:38 +00:00
|
|
|
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
|
|
|
|
|
2020-05-07 13:37:21 +00:00
|
|
|
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
|
2020-05-17 19:33:12 +00:00
|
|
|
|
|
|
|
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
|
2020-05-07 13:37:21 +00:00
|
|
|
end
|