source: trunk/docs/json.ebnf

Last change on this file was 279, checked in by lgiessmann, 14 years ago

docs: fixed some bad ebnf definitions of the json interface; json: currently only active topics are exported, mark-as-deleted topics are not exported; ajax: added the possibility that the ui is able to mark topics, names and occurrences as deleted ---> at the moment there is a problem when recreating occurrences and names that have already existed

File size: 9.3 KB
Line 
1//+-----------------------------------------------------------------------------
2//+ Overview:
3//+  *Part 1: Basic elements
4//+  *Part 2: XTM - data model
5//+  *Part 3: Object summaries
6//+  *Part 4: TMCL - data model
7//+  *Part 5: Object notation for marking objects as deleted
8//+-----------------------------------------------------------------------------
9
10//+-----------------------------------------------------------------------------
11//+ Part 1: Basic elements
12//+-----------------------------------------------------------------------------
13
14Char = "a" | "b" | ... | "A" | "B" | ... | "0" | "1" | ... | "-" | "_" | ...
15String = "\"" char* "\""
16Null = "\"null\""
17List = "[" string ("," string)* "]"
18DblList = ("[" List ("," List)* "]")
19TrpList = ("[" DblList ("," DblList)* "]")
20Bool = "\"true\"" | "\"false\""
21Cipher = "1" | "2" | ...
22Number = "\"0\"" | "\"" (Cipher (Cipher | "0")*) "\""
23ENumber = Number | "\"MAX_INT\""
24
25
26//+-----------------------------------------------------------------------------
27//+ Part 2: XTM - data model
28//+ A fragment contains a valid but incomplete topic map with one main topic
29//+ all referenced associations and all referenced topic stubs.
30//+ The schema is close to XTM 2.0 with the difference that referencing topics
31//+ is done via their PSIs, so a reference is always a list of PSIs.
32//+-----------------------------------------------------------------------------
33Datatype = "\"datatype\":" String
34Value = "\"value\":" String
35Data = "\"resourceData\":{" Datatype "," Value "}"
36RData = "\"resourceRef\":" ((string ",\"resourceData\":null") | (Null "," Data))
37
38ItemIdentity = "\"itemIdentities\":" (List | Null)
39SubjectLocator = "\"subjectLocators\":" (List | Null)
40SubjectIdentifier = "\"subjectItentifers\":" (List | Null)
41Scope = "\"scopes\":" (DblList | Null)
42InstanceOf = "\"instanceOfs\":" (DblList | Null)
43Type = "\"type\":" List
44ID = "\id\":" String
45TopicRef = "\"topicRef\":" List
46
47Variant = "{" ItemIdentity "," Scope "," RData "}"
48Variants = "\"variants\":" (("[" Variant+ "]") | Null)
49
50Name = "{" ItemIdentity "," Type "," Scope "," Value "," Variants "}"
51Names = "\"names\":" (("[" Name+ "]") | Null)
52
53Occurrence = "{" ItemIdentity "," Type "," Scope "," RData "}"
54Occurrences = "\"occurrences\":" (("[" Occurrence+ "]") | Null)
55
56Topic = "\"topic\":{" ID "," ItemIdentity "," SubjectLocator ","
57        SubjectIdentifier "," InstanceOf "," Names "," Occurences "}"
58
59Role = "{" ItemIdentity "," Type "," TopicRef "}"
60Roles = "\"roles\":" (("[" Role+ "]") | Null)
61
62Association = "{" ItemIdentity "," Type "," Scope "," Roles "}"
63Associations = "\"associations\":" (("[" Association "]") | Null)
64
65TopicStub = "{" ID "," ItemIdentity "," SubjectLocator "," SubjectIdentifier "}"
66TopicStubs = "\"topicStubs\":" (("[" TopicStub+ "]") | Null)
67
68TmIDs = "\"tmIds\":" List
69
70Fragment = "{" Topic "," TopicStubs "," Associations "," TmIDs "}"
71
72
73//+-----------------------------------------------------------------------------
74//+ Part 3: Object summaries
75//+ These Summaries are necessary to offer information of existing topics in the
76//+ store. A PsiSummary contains a list of PSI lists, so the client is able to
77//+ find out all existing topics. The TreeView contains a hierarchical
78//+ map of the stored Topics.
79//+-----------------------------------------------------------------------------
80PsiSummary = DblList | Null
81
82NameSummary = "\"names\":" (List | Null)
83OccurrenceSummary = "\"occurrences\":" (List | Null)
84
85TopicSummary = "{" ID "," ItemIdentity "," SubjectLocator ","
86               SubjectIdentifier "," InstanceOf "," NameSummary ","
87               OccurrenceSummary "}"
88TopicSummaries = ("[" TopicSummary+ "]") | Null
89
90TopicList = "\"topic\":" List
91IsType = "\isType\":" Bool
92IsInstance = "\"isInstance\":" Bool
93Instances = "\"instances\":" (("[" TreeNode "]") | Null)
94
95TreeNode = "{" TopicList "," isType "," isInstance "," Instances "}"
96TreeView = ("[" TreeNode+ "]") | Null
97
98//+-----------------------------------------------------------------------------
99//+ Part 4: TMCL - data model
100//+-----------------------------------------------------------------------------
101CardMin = "\"cardMin\":" Number
102CardMax = "\"cardMax\":" ENumber
103RegExp = "\"regexp\":" String
104
105SimpleConstraint = "{" RegExp "," CardMin "," CardMax "}"
106Constraints = "\"constraints\":[" SimpleConstraint+ "]"
107
108// Contains the owner instances and all topic types that are defined
109// es exclusives for the owner type
110ExclusiveInstances = "\"exclusiveInstances\":{\"owner\":" List
111                     ",\"exclisives\":" (DblList | Null) "}"
112
113// Contains a list of constraints that offer information about
114// the regular expressions and cardinalities for subjectIdentifiers
115// or subjectLocators
116SubjectIdentifierConstraints = "\"subjectIdentifierConstraints\":" (Constraints | Null)
117SubjectLocatorConstraints = "\"subjectLocatorConstraints\":" (Constraints | Null)
118
119// Offers scope information. The ScopeType contains a representation of all
120// available scopes and their subtys. Further constructs describe the
121// cardinalities
122ScopeType = "\"scopeTypes\":" TrpList
123ScopeConstraint = "{" ScopeType "," CardMin "," CardMax "}"
124ScopeConstraints = "\"scopeConstraints\":" (("[" scopeConstraint "]") | Null)
125
126// Describes a name constraint for a nametype and its subtypes.
127NameTypeScope = "{\"nameType\":" List "," scopeConstraints "}"
128NameTypeScopes = "\"nametypescopes\":[" NameTypeScope+ "]"
129TopicNameConstraint = "{" NameTypeScopes "," Constraints "}"
130TopicNameConstraints "\"topicNameConstraints\":" (("[" TopicNameConstraint+ "]") | Null)
131
132// Describes an occurrence constraint for an occurencetype and its subtypes.
133UniqueConstraints = "\"uniqeConstraints\":[" SimpleConstraint+ "]"
134DatatypeConstraint = "\"datatypeConstraint\":" String
135OccurrenceTypeScope = "{\"occurrenceType\":" List "," scopeConstraints ","
136                      DatatypeConstraint "}"
137OccurrenceTypeScopes = "\"occurrenceTypes\":[" OccurrenceTypeScope+ "]"
138TopicOccurrenceConstraint = "{" OccurrenceTypeScopes "," Constraints ","
139                            UniqueConstraints "}"
140TopicOccurrenceConstraints = "\"topicOccurrenceConstraints\":"
141                             (("[" TopicOccurrenceConstraints+ "]") | Null)
142
143// Contains all constraints that depends on a topic
144TopicConstraint = "{" ExclusiveInstances "," SubjectIdentifierConstraints ","
145                  SubjectLocatorConstraints "," TopicNameConstraints ","
146                  TopicOccurrenceConstraints "," AbstractConstraint "}"
147
148// Describes an associationrole-constraint
149RoleType = "\"roleType\":" DblList
150ARC = "{" RoleType "," cardMin "," cardMax "}"
151ARCs = "\"AssociationRoleConstraints\":" (("[" ARC+ "]") | Null)
152
153// Describes a roleplayer-constraint and also contains all possible
154// players.
155PlayerType = "\"playerType\":" DblList
156Players = "\"players\":" DblList
157RPC = "{" playerType "," Players "," RoleType "," cardMin "," cardMax "}"
158RPCs = "\"rolePlayerConstraints\":" (("[" RPC+ "]") | Null)
159
160// Describes an otherrole-constraint and also contains all possible
161// players and otherplayers.
162OtherRoleType = "\"otherRoleType\":" DblList
163OtherPlayerType = "\"otherPlayewrType\":" DblList
164OtherPlayers = "\"otherPlayers\":" DblList
165ORC = "{" PlayerType "," Players "," RoleType "," OtherPlayerType ","
166      OtherPlayers "," OtherRoleType "," cardMin "," cardMax "}"
167ORCs "\"otehrRoleConstraints\":" (("[" ORC+ "]") | Null)
168
169// Describes all constraints of all associations depending to the topic
170AssocType = "\"associationType\":" List
171AConstraints = "{" AssocType "," ARCs "," RPCs "," ORCs "," ScopeConstraints "}"
172AssociationsConstraints "\"associationsConstraints\":" (("[" AConstraints+ "]") | Null)
173
174// Contains the entire TMCL information
175FragmentConstraint ="{" TopicConstraints "," AssociationsConstraints "}"
176
177
178//+-----------------------------------------------------------------------------
179//+ Part 5: Object notation for marking objects as deleted
180//+    type: the type of the deleted object, e.g. Topic for TopicC
181//+    topics: a list of PSIs, where every single PSI represents a topic that
182//+            has to be deleted
183//+    associations: a list of associations that have to be deleted
184//+    parent-topic: a single PSI of the name's, occurrence's or variant's owner
185//+                  topic
186//+    parent-name: the parent name of the variants that have to be deleted
187//+                 (in this case the parent-topic is the topic of the name)
188//+    names: a list of the deletable names
189//+    variants: a list of deletable names
190//+    occurrences: a list of the deletable occurrences
191//+    parent-association: the parent association of the deletable roles
192//+    roles: a list of the deltable roles
193//+-----------------------------------------------------------------------------
194DeleteType = "\"type\":" ("Topic" | "Occurrence" | "Name" | "Association" | "Role" | "Variant")
195DeleteTopics = "\"topics\":" List
196DeleteAssociations = "\"associations\":" Associations
197DeleteParentTopic = "\"parentTopic\":" String
198DeleteParentName = "\"parentName\":" Name
199DeleteNames = "\"names\":" Names
200DeleteVariants = "\"variants\":" Variants
201DeleteOccurrences = "\"occurrences\":" Occurrences
202DeleteParentAssociation = "\"parentAssociation\":" Association
203DeleteRoles = "\"roles\":" Roles
204
205DeleteObject = "{" DeleteType "," DeleteTopics "," DeleteAssociations ","
206               DeleteParentTopic "," DeleteParentName "," DeleteNames ","
207               DeleteVariants "," DeleteOccurrences "," DeleteParentAssociation
208               "," DeleteRoles "}"
Note: See TracBrowser for help on using the repository browser.