source: branches/new-datamodel/docs/json.ebnf

Last change on this file was 97, checked in by lgiessmann, 15 years ago

added some basic functions and unit tests for the rdf-importer

File size: 8.5 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: Server-side RESTful interface
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//+ Part 5: Server-side RESTful interface
178//+-----------------------------------------------------------------------------
179"/json/get/(.+)$" returns a Fragment after a HTTP-GET
180"/json/commit/?$" processes a Fragment as HTTP-POST or HTTP-PUT
181"/json/psis/?$" returns a PsiSummary after a HTTP-GET
182"/json/summary/?$" returns a TopicSummaries after A HTTP-GET
183"/json/tmcl/types/?$" returns a PsiSummary after A HTTP-GET with all types
184"/json/tmcl/instances/?$" returns a PsiSummary after a HTTP-GET with all instances
185"/json/topicstubs/(.+)$" returns a topicStub after a HTTP-GET
186"/json/tmcl/type/?$" returns a FragmentConstraint after a HTTP-POST/HTTP-PUT
187"/json/tmcl/instance/?$" returns a FragmentConstraint after a HTTP-POST/HTTP-PUT
188"/json/tmcl/overview/?$" returns a TreeView after a HTTP-GET
Note: See TracBrowser for help on using the repository browser.