# AbstractProperty Specification
**Warning:** This specification is outdated. It is included to serve as a starting point for a more
up-to-date description of the `Property` entity.
## Note ##
> This document has not been updated for a long time. Although it is concerned with the mostly
> stable API, its content may no longer reflect the actual CaosDB behavior.
## Introduction
An `AbstractProperty` is one of the basal objects of CaosDB.
An `AbstractProperty` MUST have the following _qualities_ (shortcut in brackets):
* a persistent id (`id`)
* an unique name (`name`)
* a description (`description`)
* a type (`type`)
* a generator `generator`)
* a creator (`creator`)
* a timestamp of it's date of creation (`created`)
* a set of owners and owning groups (`owner`)
* a set rules which controls the access to that `AbstractProperty` (`permission`)
Depending on the `AbstractProperty's` type it MUST have one of the following _qualities_:
* a unit (`unit`)
* a RecordType which is referenced by any instantiating ConcreteProperty. (`reference`)
This is described below.
## Property Types
An `AbstractProperty` MUST have one of the following 7 types:
* `text`
* `integer`
* `double`
* `datetime`
* `reference`
* `file`
An `AbstractProperty` of type `text`, `datetime`, or `file` MUST NOT have any unit or referenced RecordType. A `double`, `integer` AbstractProperty MUST have a unit but MUST NOT have a referenced RecordType. A `reference` `AbstractProperty` MUST have referenced RecordType und MUST NOT have a unit.
## XML Representation of AbstractProperty Objects
An `AbstractProperty` is represented in xml by a `` tag. It's _qualities_ except for `owner` and `permission` are represented by an xml attribute of the same name. E.g ` denotes an AbstractProperty which {{{name` is _length_. The `owner` and `permission` qualities are not in use, yet.
Depending on the purpose of the xml document (shall it represent an object in the database or an object _to be posted _to the database?) the `` tag may actually have just a few of the mentioned "quality-attributes".
### GET AbstractProperty
Any xml representation of an `AbstractProperty` that is retrieved from the CaosDB Server MUST have exactly ONE of the following forms, depending on the `AbstractProperty's` type:
#### text
#### integer
#### double
#### datetime
#### reference
#### file
'''General Notes:
* If the called Property does not exist or if the Property called without permission, the CaosDB Server will return an Error.
### POST AbstractProperty
Any xml representation of an `AbstractProperty` that is to be posted to the CaosDB server MUST have exactly ONE of the following forms, depending on the `AbstractProperty's` type:
#### text
#### integer
#### double
#### datetime
#### reference
#### file
*General Notes:*
* The `AbstractProperty's` `id` and timestamp (`created`) will be generated by the CaosDB Server.
* The `AbstractProperty's` creator will be determined by the CaosDB Server depending on it's policy configuration.
* Any given attribute beyond these will be *ignored*.
* If the `` tag isn't compliant with these the CaosDB Server will return an Error.
----
## Examples
### GET Requests
#### Single-Get
*Request:*
GET http://localhost:8122/mpidsserver/AbstractProperty/1
*Response:*
----
*Request:*
GET http://localhost:8122/mpidsserver/AbstractProperty/explanation
*Response:*
----
#### Multi-Get
*Request:*
GET http://localhost:8122/mpidsserver/AbstractProperty/explanation&2&3
*Response:*
----
#### Get all
*Request:*
GET http://localhost:8122/server/AbstractProperty/
GET http://localhost:8122/server/AbstractProperty
*Response:*
#### Erroneous Requests
##### Non-existing
*Request:*
GET http://localhost:8122/mpidsserver/AbstractProperty/123456
*Response:*
----
### POST Requests
*Request is to be sent to:*
POST http://localhost:8122/mpidsserver/AbstractProperty/
POST http://localhost:8122/mpidsserver/AbstractProperty
----
#### Single-Post
*Request body:*
*Response:*
----
*Request body (with a reference to Property 12345):*
----
#### Multi-Post
*Request body:*
*Response:*
...
----
#### Erroneous Requests
##### No Description
*Request body:*
*Response:*
----
##### No generator
*Request body:*
*Response:*
----
##### No Type
*Request body:*
*Response:*
----
##### No Unit
*Request body:*
*Response:*
----
##### No Name
*Request body:*
*Response:*
----
##### Invalid Name
*Request body:*
*Response:*
----
##### Mixed
*Request body:*
*Response:*
...
= DELETE AbstractProperties =
HTTP-DELETE-requests are to be send to `http://${host}:${port}/mpidsserver/AbstractProperty/...`. Default port is 8123.
*Example*
{{{
DELETE http://${host}:${port}/mpidsserver/AbstractProperty/1&2&3&4
}}}
## TODO
### UPDATE AbstractProperties
Notes:
* ids are persistent. They cannot be changed.
* Maybe we should take the PropertyTypes as persistent, too or just allow a few changes: Double <-> Integer?
Roadmap:
1) Specify and implement changing the name, description and unit of AbstractProperties.
2) Specify and implement changing the reference of an abstract reference property.
3) Anything else...