-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathentity.pro
More file actions
45 lines (37 loc) · 1.01 KB
/
Copy pathentity.pro
File metadata and controls
45 lines (37 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/** <module> somewhat limited metamodel
*/
:- module(entity, [
entity/2
, entity_property_type/3
]).
/** entity(?Name:atom, ?Properties:list)
"Name refers to an entity whose properties are Properties."
Name must be globally unique in a Prolog process.
Properties is a list where
- Each element has shape property(PropName, PropList) where
- PropName has to be unique in one entity, but doesn't have to be globally unique
- PropList is a list of =Prop=s where
- A Prop is any of
- type(Type) where Type is any of
- string
- integer
Example:
```
entity(person, [
property(name, [
type(string)
]),
property(age, [
type(integer)
])
]).
```
*/
:- multifile entity/2.
/** entity_property_type(?Ent, ?Prop, ?Typ)
"Entity named Ent has property named Prop whose type is named Typ."
*/
entity_property_type(E,P,T) :-
entity(E, Props),
member(property(P,Descs), Props),
member(type(T), Descs).