| 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 | |
|---|
| 14 | Char = "a" | "b" | ... | "A" | "B" | ... | "0" | "1" | ... | "-" | "_" | ... |
|---|
| 15 | String = "\"" char* "\"" |
|---|
| 16 | Null = "\"null\"" |
|---|
| 17 | List = "[" string ("," string)* "]" |
|---|
| 18 | DblList = ("[" List ("," List)* "]") |
|---|
| 19 | TrpList = ("[" DblList ("," DblList)* "]") |
|---|
| 20 | Bool = "\"true\"" | "\"false\"" |
|---|
| 21 | Cipher = "1" | "2" | ... |
|---|
| 22 | Number = "\"0\"" | "\"" (Cipher (Cipher | "0")*) "\"" |
|---|
| 23 | ENumber = 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 | //+----------------------------------------------------------------------------- |
|---|
| 33 | Datatype = "\"datatype\":" String |
|---|
| 34 | Value = "\"value\":" String |
|---|
| 35 | Data = "\"resourceData\":{" Datatype "," Value "}" |
|---|
| 36 | RData = "\"resourceRef\":" ((string ",\"resourceData\":null") | (Null "," Data)) |
|---|
| 37 | |
|---|
| 38 | ItemIdentity = "\"itemIdentities\":" (List | Null) |
|---|
| 39 | SubjectLocator = "\"subjectLocators\":" (List | Null) |
|---|
| 40 | SubjectIdentifier = "\"subjectItentifers\":" (List | Null) |
|---|
| 41 | Scope = "\"scopes\":" (DblList | Null) |
|---|
| 42 | InstanceOf = "\"instanceOfs\":" (DblList | Null) |
|---|
| 43 | Type = "\"type\":" List |
|---|
| 44 | ID = "\id\":" String |
|---|
| 45 | TopicRef = "\"topicRef\":" List |
|---|
| 46 | |
|---|
| 47 | Variant = "{" ItemIdentity "," Scope "," RData "}" |
|---|
| 48 | Variants = "\"variants\":" (("[" Variant+ "]") | Null) |
|---|
| 49 | |
|---|
| 50 | Name = "{" ItemIdentity "," Type "," Scope "," Value "," Variants "}" |
|---|
| 51 | Names = "\"names\":" (("[" Name+ "]") | Null) |
|---|
| 52 | |
|---|
| 53 | Occurrence = "{" ItemIdentity "," Type "," Scope "," RData "}" |
|---|
| 54 | Occurrences = "\"occurrences\":" (("[" Occurrence+ "]") | Null) |
|---|
| 55 | |
|---|
| 56 | Topic = "\"topic\":{" ID "," ItemIdentity "," SubjectLocator "," |
|---|
| 57 | SubjectIdentifier "," InstanceOf "," Names "," Occurences "}" |
|---|
| 58 | |
|---|
| 59 | Role = "{" ItemIdentity "," Type "," TopicRef "}" |
|---|
| 60 | Roles = "\"roles\":" (("[" Role+ "]") | Null) |
|---|
| 61 | |
|---|
| 62 | Association = "{" ItemIdentity "," Type "," Scope "," Roles "}" |
|---|
| 63 | Associations = "\"associations\":" (("[" Association "]") | Null) |
|---|
| 64 | |
|---|
| 65 | TopicStub = "{" ID "," ItemIdentity "," SubjectLocator "," SubjectIdentifier "}" |
|---|
| 66 | TopicStubs = "\"topicStubs\":" (("[" TopicStub+ "]") | Null) |
|---|
| 67 | |
|---|
| 68 | TmIDs = "\"tmIds\":" List |
|---|
| 69 | |
|---|
| 70 | Fragment = "{" 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 | //+----------------------------------------------------------------------------- |
|---|
| 80 | PsiSummary = DblList | Null |
|---|
| 81 | |
|---|
| 82 | NameSummary = "\"names\":" (List | Null) |
|---|
| 83 | OccurrenceSummary = "\"occurrences\":" (List | Null) |
|---|
| 84 | |
|---|
| 85 | TopicSummary = "{" ID "," ItemIdentity "," SubjectLocator "," |
|---|
| 86 | SubjectIdentifier "," InstanceOf "," NameSummary "," |
|---|
| 87 | OccurrenceSummary "}" |
|---|
| 88 | TopicSummaries = ("[" TopicSummary+ "]") | Null |
|---|
| 89 | |
|---|
| 90 | TopicList = "\"topic\":" List |
|---|
| 91 | IsType = "\isType\":" Bool |
|---|
| 92 | IsInstance = "\"isInstance\":" Bool |
|---|
| 93 | Instances = "\"instances\":" (("[" TreeNode "]") | Null) |
|---|
| 94 | |
|---|
| 95 | TreeNode = "{" TopicList "," isType "," isInstance "," Instances "}" |
|---|
| 96 | TreeView = ("[" TreeNode+ "]") | Null |
|---|
| 97 | |
|---|
| 98 | //+----------------------------------------------------------------------------- |
|---|
| 99 | //+ Part 4: TMCL - data model |
|---|
| 100 | //+----------------------------------------------------------------------------- |
|---|
| 101 | CardMin = "\"cardMin\":" Number |
|---|
| 102 | CardMax = "\"cardMax\":" ENumber |
|---|
| 103 | RegExp = "\"regexp\":" String |
|---|
| 104 | |
|---|
| 105 | SimpleConstraint = "{" RegExp "," CardMin "," CardMax "}" |
|---|
| 106 | Constraints = "\"constraints\":[" SimpleConstraint+ "]" |
|---|
| 107 | |
|---|
| 108 | // Contains the owner instances and all topic types that are defined |
|---|
| 109 | // es exclusives for the owner type |
|---|
| 110 | ExclusiveInstances = "\"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 |
|---|
| 116 | SubjectIdentifierConstraints = "\"subjectIdentifierConstraints\":" (Constraints | Null) |
|---|
| 117 | SubjectLocatorConstraints = "\"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 |
|---|
| 122 | ScopeType = "\"scopeTypes\":" TrpList |
|---|
| 123 | ScopeConstraint = "{" ScopeType "," CardMin "," CardMax "}" |
|---|
| 124 | ScopeConstraints = "\"scopeConstraints\":" (("[" scopeConstraint "]") | Null) |
|---|
| 125 | |
|---|
| 126 | // Describes a name constraint for a nametype and its subtypes. |
|---|
| 127 | NameTypeScope = "{\"nameType\":" List "," scopeConstraints "}" |
|---|
| 128 | NameTypeScopes = "\"nametypescopes\":[" NameTypeScope+ "]" |
|---|
| 129 | TopicNameConstraint = "{" NameTypeScopes "," Constraints "}" |
|---|
| 130 | TopicNameConstraints "\"topicNameConstraints\":" (("[" TopicNameConstraint+ "]") | Null) |
|---|
| 131 | |
|---|
| 132 | // Describes an occurrence constraint for an occurencetype and its subtypes. |
|---|
| 133 | UniqueConstraints = "\"uniqeConstraints\":[" SimpleConstraint+ "]" |
|---|
| 134 | DatatypeConstraint = "\"datatypeConstraint\":" String |
|---|
| 135 | OccurrenceTypeScope = "{\"occurrenceType\":" List "," scopeConstraints "," |
|---|
| 136 | DatatypeConstraint "}" |
|---|
| 137 | OccurrenceTypeScopes = "\"occurrenceTypes\":[" OccurrenceTypeScope+ "]" |
|---|
| 138 | TopicOccurrenceConstraint = "{" OccurrenceTypeScopes "," Constraints "," |
|---|
| 139 | UniqueConstraints "}" |
|---|
| 140 | TopicOccurrenceConstraints = "\"topicOccurrenceConstraints\":" |
|---|
| 141 | (("[" TopicOccurrenceConstraints+ "]") | Null) |
|---|
| 142 | |
|---|
| 143 | // Contains all constraints that depends on a topic |
|---|
| 144 | TopicConstraint = "{" ExclusiveInstances "," SubjectIdentifierConstraints "," |
|---|
| 145 | SubjectLocatorConstraints "," TopicNameConstraints "," |
|---|
| 146 | TopicOccurrenceConstraints "," AbstractConstraint "}" |
|---|
| 147 | |
|---|
| 148 | // Describes an associationrole-constraint |
|---|
| 149 | RoleType = "\"roleType\":" DblList |
|---|
| 150 | ARC = "{" RoleType "," cardMin "," cardMax "}" |
|---|
| 151 | ARCs = "\"AssociationRoleConstraints\":" (("[" ARC+ "]") | Null) |
|---|
| 152 | |
|---|
| 153 | // Describes a roleplayer-constraint and also contains all possible |
|---|
| 154 | // players. |
|---|
| 155 | PlayerType = "\"playerType\":" DblList |
|---|
| 156 | Players = "\"players\":" DblList |
|---|
| 157 | RPC = "{" playerType "," Players "," RoleType "," cardMin "," cardMax "}" |
|---|
| 158 | RPCs = "\"rolePlayerConstraints\":" (("[" RPC+ "]") | Null) |
|---|
| 159 | |
|---|
| 160 | // Describes an otherrole-constraint and also contains all possible |
|---|
| 161 | // players and otherplayers. |
|---|
| 162 | OtherRoleType = "\"otherRoleType\":" DblList |
|---|
| 163 | OtherPlayerType = "\"otherPlayewrType\":" DblList |
|---|
| 164 | OtherPlayers = "\"otherPlayers\":" DblList |
|---|
| 165 | ORC = "{" PlayerType "," Players "," RoleType "," OtherPlayerType "," |
|---|
| 166 | OtherPlayers "," OtherRoleType "," cardMin "," cardMax "}" |
|---|
| 167 | ORCs "\"otehrRoleConstraints\":" (("[" ORC+ "]") | Null) |
|---|
| 168 | |
|---|
| 169 | // Describes all constraints of all associations depending to the topic |
|---|
| 170 | AssocType = "\"associationType\":" List |
|---|
| 171 | AConstraints = "{" AssocType "," ARCs "," RPCs "," ORCs "," ScopeConstraints "}" |
|---|
| 172 | AssociationsConstraints "\"associationsConstraints\":" (("[" AConstraints+ "]") | Null) |
|---|
| 173 | |
|---|
| 174 | // Contains the entire TMCL information |
|---|
| 175 | FragmentConstraint ="{" 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 | //+----------------------------------------------------------------------------- |
|---|
| 194 | DeleteType = "\"type\":" ("Topic" | "Occurrence" | "Name" | "Association" | "Role" | "Variant") |
|---|
| 195 | DeleteTopics = "\"topics\":" List |
|---|
| 196 | DeleteAssociations = "\"associations\":" Associations |
|---|
| 197 | DeleteParentTopic = "\"parentTopic\":" String |
|---|
| 198 | DeleteParentName = "\"parentName\":" Name |
|---|
| 199 | DeleteNames = "\"names\":" Names |
|---|
| 200 | DeleteVariants = "\"variants\":" Variants |
|---|
| 201 | DeleteOccurrences = "\"occurrences\":" Occurrences |
|---|
| 202 | DeleteParentAssociation = "\"parentAssociation\":" Association |
|---|
| 203 | DeleteRoles = "\"roles\":" Roles |
|---|
| 204 | |
|---|
| 205 | DeleteObject = "{" DeleteType "," DeleteTopics "," DeleteAssociations "," |
|---|
| 206 | DeleteParentTopic "," DeleteParentName "," DeleteNames "," |
|---|
| 207 | DeleteVariants "," DeleteOccurrences "," DeleteParentAssociation |
|---|
| 208 | "," DeleteRoles "}" |
|---|