Data Types
The types property tells Describo what type of data can be provided for a property. It can be an array of classes like ["Person", "Organisation"]
or simple data types like ["Text", "Number", "Date"]
. It can also include the special ANY
type to indicate that an entity of any type can be attached at that location.
The simple data types you can define for a type are as follows:
Text
Text
: a simple text box
{
"id": "...",
"name": "...",
...
"type": ["Text"]
},
Constraints can be defined for this type:
minLength
: minimum required length for valuemaxLength
: maximum allowed length for valueregex
: a regular expression the value has to matchdateFormat
: one or many (array) of possible date formats to be matched: see: Day.js formats. In some cases a date picker can be difficult to use and an ISO String is not what is required. Use this constraint to get something that looks like a date but without the limitations of the date picker.
INFO
TextArea
TextArea
: a text area box that expands to the size of its content
{
"id": "...",
"name": "...",
...
"type": ["TextArea"]
},
Constraints can be defined for this type:
minLength
: minimum required length for valuemaxLength
: maximum allowed length for valueregex
: a regular expression the value has to matched
INFO
Boolean
INFO
From version 0.60.0
Boolean
: A switch to input true or false.
{
"id": "...",
"name": "...",
...
"type": ["Boolean"]
},
TIP
Note that this primitive stores JS 'true' && 'false' not 'True' && 'False' as described in schema.org. This is valid in the JSON-LD file and though it doesn't strictly conform to schema.org, the intent is clear and unambiguous.
Number
Number
: A number input
{
"id": "...",
"name": "...",
...
"type": ["Number"]
},
Constraints can be defined for this type:
minValue
: minimum possible value to be enteredmaxValue
: maximum possible value to be enterednumberType
: one or many (array) of "any", "long", "int", "float", "double". It maybe an array to allow specifying any of the possible numberType values
INFO
Date, DateTime, Time
Date
: A date inputDateTime
: A date time inputTime
: A time input
{
"id": "...",
"name": "...",
...
"type": ["Date", "DateTime", "Time" ]
},
Geo
Geo
: A geo selection input; allows selecting an area or a single point
{
"id": "...",
"name": "...",
...
"type": ["Geo"]
},
URL
URL
: Allows the user to input a URL
{
"id": "...",
"name": "...",
...
"type": ["URL"]
},
Returns:
{ @id: ${URL}, @type: 'URL', name: ${URL} }
Will report an error if the user types in something that doesn't look like a URL. Accepted protocols are: 'http', 'https', 'ftp', 'ftps', 'arcp'.
Select, SelectURL, SelectObject
Select
: A control where the user can select from a number of predefined options:
{
"id": "...",
"name": "...",
...
"type": ["Select"],
"values": [
"Yes = in copyright",
"No - out of copyright",
]
},
SelectURL
: A control where the user can select from a number of predefined URLs and get back a URL object:
{
"id": "...",
"name": "...",
...
"type": ["SelectURL"],
"values": [
"http://schema.org",
]
},
SelectObject
: A control where the user can select from a number of complete objects defined in the profile:
{
"id": "...",
"name": "...",
...
"type": ["SelectObject"],
"values": [
{ "@id": "http://schema.org/Person", "@type": "rdfs:Class", name: 'Person', description: 'It's people!" },
{ "@id": "http://schema.org/Organization", "@type": "rdfs:Class", name: 'Organization', description: 'It's not people!" },
]
},
returns the selected object as defined and links it into the graph.
TIP
If you need to define objects in your profile as pre-created bits of configuration to inject, then you are likely better off creating a datapack and just wiring up lookups from the Describo component to the service hosting the pack. We recommend elastic search as it's easy to run and manage, and Describo will emit an elastic query for you to send to the server.
Value
Value
: A control where a specified value is set for a property
{
"id": "...",
"name": "...",
...
"type": "Value",
"value": "red"
}