added locations, controllers and variables

trunk
HeNine 2 years ago
parent 60b9b2c981
commit 383ae4fa8e

@ -0,0 +1,42 @@
local entity = import '../lib/entity.libsonnet';
entity
{
'$id': 'https://picc.app/schemata/v0.1-dev/controller',
title: 'Controller',
description: 'Describes a relationship between two entities.',
properties+: {
module: {
type: 'string',
description: 'Module name of the controller.',
},
arg: {
description: 'Additional arguments. Can be any JSON type.',
},
entities: {
type: 'array',
description: 'Entities this controller controls.',
items:
$.properties.id,
},
measures: {
type: 'array',
description: 'List of variables this controller measures.',
items: 'string',
minItems: 1,
uniqueItems: true,
},
controls: {
type: 'array',
description: 'List of variables this controller controls.',
items: 'string',
minItems: 1,
uniqueItems: true,
}
},
required+: [
'module',
'entities',
],
}

@ -1,3 +1,4 @@
local types = import 'types.libsonnet';
local entity = import 'entity.libsonnet'; local entity = import 'entity.libsonnet';
entity entity
@ -7,4 +8,13 @@ entity
description: ||| description: |||
A sensor device entity. A sensor device entity.
|||, |||,
properties+: {
measures: {
type: 'array',
items: types.id,
description: 'List of variables measured by sensor.',
uniqueItems: true,
}
}
} }

@ -1,7 +1,7 @@
local loom = import 'lib/loom.libsonnet'; local loom = import 'lib/loom.libsonnet';
loom.weave(import 'src/entity.jsonnet') + loom.weave(import 'src/entity.jsonnet') +
loom.weave(import 'src/room.jsonnet') + loom.weave(import 'src/locations/room.jsonnet') +
loom.weave(import 'src/relationship.jsonnet') + loom.weave(import 'src/relationship.jsonnet') +
loom.weave(import 'src/devices/light.jsonnet') + loom.weave(import 'src/devices/light.jsonnet') +
loom.weave(import 'src/devices/sensor.jsonnet') loom.weave(import 'src/devices/sensor.jsonnet')

@ -9,6 +9,7 @@ entity
|||, |||,
properties+: { properties+: {
location: types.location,
rooms: { rooms: {
type: 'array', type: 'array',
description: 'Rooms contained in this building.', description: 'Rooms contained in this building.',
@ -21,17 +22,5 @@ entity
], ],
}, },
}, },
relationships: {
type: 'array',
description: 'Relationships that bind other entities to this room.',
items: {
oneOf: [
{
'$ref': 'https://picc.app/schemata/v0.1-dev/relationship',
},
$.properties.id,
],
},
},
}, },
} }

@ -1,4 +1,5 @@
local entity = import '../lib/entity.libsonnet'; local entity = import 'entity.libsonnet';
local types = import 'types.libsonnet';
entity entity
{ {
@ -9,6 +10,7 @@ entity
|||, |||,
properties+: { properties+: {
location: types.location,
relationships: { relationships: {
type: 'array', type: 'array',
description: 'Relationships that bind other entities to this room.', description: 'Relationships that bind other entities to this room.',

@ -4,26 +4,16 @@ entity
{ {
'$id': 'https://picc.app/schemata/v0.1-dev/relationship', '$id': 'https://picc.app/schemata/v0.1-dev/relationship',
title: 'Relationship', title: 'Relationship',
description: 'Describes a relationship between two entities.', description: 'Describes a relationship between entities. An arity of 1 is used to describe a property of an entity (a relationship of the entity to itself).',
properties+: { properties+: {
module: { arity: {
type: 'string', type: 'number',
description: 'Module name of the relationship.', description: 'The number of entities involved in the relationship.',
}, minimum: 1,
entities: {
type: 'array',
description: 'Entities invloved in the relationship.',
items:
$.properties.id,
},
arg: {
description: 'Additional arguments. Can be any JSON type.',
}, },
}, },
required+: [ required+: [
'module', 'description',
'entities',
], ],
} }

@ -1,11 +1,14 @@
local loom = import 'lib/loom.libsonnet'; local loom = import 'lib/loom.libsonnet';
loom.tangle(import 'src/entity.jsonnet') + loom.tangle(import 'src/entity.jsonnet') +
loom.tangle(import 'src/relationship.jsonnet') +
loom.tangle(import 'src/controller.jsonnet') +
loom.tangle(import 'src/variables/real.jsonnet') +
loom.tangle(import 'src/locations/room.jsonnet') + loom.tangle(import 'src/locations/room.jsonnet') +
loom.tangle(import 'src/locations/building.jsonnet') + loom.tangle(import 'src/locations/building.jsonnet') +
loom.tangle(import 'src/locations/site.jsonnet') + loom.tangle(import 'src/locations/site.jsonnet') +
loom.tangle(import 'src/relationship.jsonnet') +
loom.tangle(import 'src/devices/light.jsonnet') + loom.tangle(import 'src/devices/light.jsonnet') +
loom.tangle(import 'src/devices/sensor.jsonnet') loom.tangle(import 'src/devices/sensor.jsonnet')

@ -0,0 +1,34 @@
local entity = import '../lib/entity.libsonnet';
entity
{
'$id': 'https://picc.app/schemata/v0.1-dev/variables/real',
title: 'Real',
description: 'Real-valued variable.',
properties+: {
moreThan: {
type: 'number',
description: 'Open lower bound on value of variable.',
},
moreThanEq : {
type: 'number',
description: 'Closed lower bound on value of variable.',
},
lessThan: {
type: 'number',
description: 'Open upper bound on value of variable.',
},
lessThanEq: {
type: 'number',
description: 'Closed lower bound on the value of variable.',
},
distribution: {
type: 'string',
description: 'Assumed distribution of variable.',
enum: ['normal', 'uniform', 'exponential', 'gamma'],
},
},
required+: [
],
}
Loading…
Cancel
Save