]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.structural.ontology/graph/Structural.pgraph
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.structural.ontology / graph / Structural.pgraph
1 L0 = <http://www.simantics.org/Layer0-1.1>
2 L0X = <http://www.simantics.org/Layer0X-1.1>
3 SIMU = <http://www.simantics.org/Simulation-1.1>
4 ISSUE = <http://www.simantics.org/Issue-1.2>
5 DATATYPE = <http://www.simantics.org/Datatypes-1.1>
6
7 STR = <http://www.simantics.org/Structural-1.2> : L0.Ontology
8     @L0.new
9     L0.HasResourceClass "org.simantics.structural.stubs.StructuralResource2"
10
11 //// Components and types
12
13 STR.Component <T L0.Entity : STR.ComponentType
14     @L0.tag L0.Abstract
15     @L0.property STR.IsConnectedTo
16     @L0.property STR.BelongsTo
17     @L0.property STR.GroupBelongsTo
18     L0.HasDescription "Defines a structure by instantiating some Type."
19
20 STR.ComponentType <T L0.Type    
21     //[IsDefinedBy card "0..1"]
22     L0.HasDescription "Parametric structure that can be instantiated."
23     >-- STR.ComponentType.HasDefaultPropertyRelationType <R L0.IsRelatedTo
24     >-- STR.ComponentType.HasDefaultPropertyValueType <R L0.IsRelatedTo
25     >-- STR.ComponentType.HasDefaultMonitorValueType --> STR.MonitorValueType <R L0.IsRelatedTo
26     @L0.assert L0X.HasGeneratedNamePrefix ""
27
28 STR.MonitorValueType <T L0.Entity
29 STR.MonitorValue <T L0.SCLValue : STR.MonitorValueType
30
31 STR.IsDefinedBy <R L0.IsComposedOf : L0.FunctionalRelation
32     L0.HasRange STR.Component
33     L0.InverseOf STR.Defines
34
35 STR.AbstractDefinedComponentType <T STR.ComponentType
36
37 STR.DefinedComponentType <T STR.AbstractDefinedComponentType
38
39 STR.ReplaceableDefinedComponentType <T STR.AbstractDefinedComponentType
40
41 STR.ProceduralComponentType <T STR.AbstractDefinedComponentType
42     >-- STR.ProceduralComponentType.code --> STR.ProceduralComponentTypeCode <R L0.HasProperty : L0.TotalFunction
43     >-- STR.ProceduralComponentType.environment --> L0.SCLValue.Environment <R L0.IsRelatedTo : L0.FunctionalRelation
44
45 STR.ProceduralComponentTypeCode <T L0.String
46
47 //STR.proceduralConnectionPointPath --> L0.String <R L0.HasProperty : L0.FunctionalRelation
48
49 /*
50 STR.HasParameter <R L0.IsRelatedTo
51     L0.HasDomain STR.ComponentType
52     L0.HasRange STR.Variable
53     L0.HasDescription "Denotes that the given relation is a parameter to the Type."
54     L0.InverseOf STR.IsParameterOf <R L0.IsWeaklyRelatedTo
55
56 STR.ConnectionPointDefinition <T L0.PropertyDefinition
57 */
58 //// Specific structures
59
60 STR.Composite <T STR.Component
61 //    [L0.ConsistsOf all Component]
62     L0.HasDescription "A structure defined as a set of other structures."
63     >-- STR.Composite.namingFunction ==> "ComponentNamingStrategy" <R L0.HasProperty : L0.TotalFunction
64     >-- STR.Composite.instantiationFunction ==> "Resource -> String -> Resource -> Resource" <R L0.HasProperty : L0.FunctionalRelation
65         L0.HasDescription "Returns a function (Resource -> String -> Resource -> Resource) that takes the composite type, default name and target container as input and returns the created diagram."
66
67 STR.OrderedComposite <T STR.Component <T L0.OrderedSet
68     // Requirements are not currently expressible
69
70 //// Variables
71 /*
72 STR.Variable <T L0.Entity
73     @L0.tag L0.Abstract
74     @L0.singleProperty STR.Binds
75 */
76 STR.Binds <R L0.IsRelatedTo
77     L0.HasRange L0.Relation
78     L0.InverseOf STR.IsBoundBy <R L0.IsWeaklyRelatedTo
79
80 //// Literal properties
81
82 // Find better name!!!
83 /*
84 STR.LiteralVariable <T STR.Variable
85     //[Binds all VariableRelation]
86
87 STR.VariableRelation <T L0.Relation
88
89 STR.HasVariable <R L0.DependsOn : STR.VariableRelation
90     @L0.tag L0.Abstract
91     L0.InverseOf STR.VariableOf
92
93 STR.Expression <T L0.Entity
94     @L0.tag L0.Abstract
95     L0.HasDescription "Supertype of all value types that are not simple constant values or variables."
96
97 STR.ValueRelation <T L0.FunctionalRelation
98
99 STR.HasValue <R L0.HasProperty : STR.ValueRelation
100     @L0.tag L0.Abstract // can we use the tag for relations?
101     L0.HasDescription "Assigns a value to some parameter."
102 */
103 //// Connections
104
105 STR.Connection <T L0.Entity
106     @L0.property STR.Connects
107     @L0.property STR.IsJoinedBy
108 /*
109 STR.ConnectionVariable <T STR.Variable <T STR.Connection
110     //[STR.Binds all STR.ConnectionRelation]
111 */
112
113 STR.Functions.connectionValueAccessor : L0.ExternalValue
114     L0.HasValueType "ValueAccessor"
115
116 STR.ConnectionRelationType <T L0.Type
117
118 STR.ConnectionRelation <T L0.Relation : STR.ConnectionRelationType
119     @L0.assert L0.SharedRange STR.ConnectionRelation
120     >-- STR.ConnectionRelation.connectionRequired --> L0.Boolean <R L0.HasProperty : L0.FunctionalRelation
121     >-- STR.ConnectionRelation.equivalentConnectionPoint --> STR.ConnectionRelation <R L0.IsRelatedTo
122         L0.InverseOf STR.ConnectionRelation.equivalentConnectionPoint
123     @L0.assert L0.valueAccessor STR.Functions.connectionValueAccessor
124     @L0.assert L0.domainProperties L0.Functions.standardPropertyDomainProperties
125     @L0.assert L0.domainChildren L0.Functions.standardPropertyDomainChildren            
126
127 STR.SynchronizedRelation <T L0.Relation
128 STR.SynchronizedConnectionRelation <T STR.ConnectionRelation
129 STR.ProvidingConnectionRelation <T STR.ConnectionRelation
130
131 STR.InComposite <R L0X.HasTemplate
132
133
134 // deprecated
135 //IsConnected <R L0.DependsOn : ConnectionRelation
136 //    @L0.tag L0.Abstract
137 //    L0.InverseOf IsConnected
138 /*
139 STR.DirectedConnectionRelation <T STR.ConnectionRelation
140     L0.Asserts _ : L0.Assertion
141       L0.HasPredicate L0.SharedRange
142       L0.HasObject STR.DirectedConnectionRelation
143 */
144 STR.IsConnectedTo <R L0.DependsOn : STR.ConnectionRelation
145     @L0.tag L0.Abstract 
146     L0.InverseOf STR.Connects
147     
148 //// Connection types
149
150 //deprecated
151 STR.SupportsConnectionType <R L0.IsRelatedTo
152     L0.HasRange STR.ConnectionType    
153
154 STR.HasConnectionType <R L0.IsRelatedTo : L0.FunctionalRelation
155     L0.HasRange STR.ConnectionType    
156     
157 STR.ConnectionType <T L0.Entity
158     >-- STR.ConnectionType.isUserSelectable --> "Boolean" <R L0.HasProperty : L0.FunctionalRelation
159     @L0.assert STR.ConnectionType.isUserSelectable false
160     //[STR.HasCardinalityRestriction all STR.CardinalityRestriction]   
161     
162 STR.SupportsDirection <R L0.IsRelatedTo
163     L0.HasRange STR.ConnectionDirection
164
165 STR.ConnectionDirection <T L0.Entity
166
167 STR.InputDirection : STR.ConnectionDirection
168 STR.OutputDirection : STR.ConnectionDirection
169     
170 STR.HasCardinalityRestriction <R L0.IsRelatedTo
171
172 STR.CardinalityRestriction <T L0.Entity
173     //[STR.HasLowerBound card "0..1"]
174     //[STR.HasUpperBound card "0..1"]
175     //[STR.HasConnectionDirection card "0..1"]
176     
177 STR.HasLowerBound <R L0.HasProperty
178 STR.HasUpperBound <R L0.HasProperty
179 STR.HasConnectionDirection <R L0.IsRelatedTo    
180
181 STR.ConnectionJoin <T L0.Entity
182     @L0.property STR.Joins
183 STR.Joins <R L0.DependsOn
184     L0.InverseOf STR.IsJoinedBy <R L0.DependsOn
185         L0.HasDomain STR.Connection
186         L0.HasRange STR.ConnectionJoin
187 STR.HasConnectionJoin <R L0.DependsOn
188     L0.HasDomain STR.Composite
189     L0.HasRange STR.ConnectionJoin
190     L0.InverseOf STR.JoinsComposite <R L0.IsWeaklyRelatedTo
191
192 //// Modeling rules
193
194 STR.ModelingRules <T L0.Entity
195     L0.HasDescription """Defines what can be populated to a composite 
196 and what can be connected. 
197 See <https://www.simantics.org/wiki/index.php/Diagram_ontology>."""
198
199 STR.HasModelingRules <R L0.IsRelatedTo : L0.FunctionalRelation
200     L0.HasDomain STR.Composite
201     L0.HasDomain STR.OrderedComposite
202     L0.HasRange STR.ModelingRules
203     
204 STR.SimpleModelingRules <T STR.ModelingRules
205     @L0.singleProperty STR.HasConnectionType
206     @L0.singleProperty STR.HasAttachmentRelation
207     L0.HasDescription """Modeling rules that allow all connections."""
208 STR.HasAttachmentRelation <R L0.IsRelatedTo : L0.FunctionalRelation
209     L0.HasRange L0.Relation    
210
211 STR.DefaultConnectionType : STR.ConnectionType   
212 STR.DefaultModelingRules : STR.SimpleModelingRules
213     STR.HasConnectionType STR.DefaultConnectionType
214 STR.StandardModelingRules : STR.ModelingRules
215 STR.AllowsConnectionType <R L0.DependsOn
216     L0.HasDomain L0.Relation
217     L0.HasRange STR.ConnectionType
218     L0.InverseOf STR.AllowsConnectionType.Inverse <R L0.IsWeaklyRelatedTo
219 STR.OverridesConnectionType <R L0.DependsOn
220     L0.HasDomain STR.ConnectionType
221     L0.HasRange STR.ConnectionType
222 STR.IsIncludedInConnectionType <R L0.DependsOn
223     L0.HasDomain STR.ConnectionType
224     L0.HasRange STR.ConnectionType
225 STR.DefaultsToConnectionType <R L0.DependsOn : L0.FunctionalRelation
226     <-- L0.Relation
227     --> STR.ConnectionType
228     L0.InverseOf STR.DefaultsToConnectionType.Inverse <R L0.IsWeaklyRelatedTo
229 STR.ConnectionConstraint <T L0.Entity
230 STR.HasConnectionConstraint <R L0.IsRelatedTo
231     L0.HasDomain STR.ConnectionType
232     L0.HasRange STR.ConnectionConstraint    
233
234 // Groups
235
236 STR.BelongsTo <R L0.IsRelatedTo
237     L0.HasRange STR.ComponentGroup
238     L0.InverseOf STR.BelongsToInverse <R L0.IsWeaklyRelatedTo
239 STR.GroupBelongsTo <R L0.IsRelatedTo
240     L0.HasRange STR.GroupSubsumption
241     L0.InverseOf STR.GroupBelongsToInverse <R L0.IsWeaklyRelatedTo
242 STR.ComponentGroup <T L0.Entity
243 STR.GroupSubsumption <T L0.Entity
244     @L0.property STR.HasSubgroup
245     @L0.property STR.BelongsTo
246 STR.HasSubgroup <R L0.IsRelatedTo
247     L0.HasRange STR.ComponentGroup
248
249 // Support for expressions
250 STR.HasExpression <R L0.HasProperty
251     >-- L0.Value 
252     ==> "String" 
253     L0.valueAccessor STR.Functions.expressionValueAccessor : L0.ExternalValue
254     
255 STR.Functions : L0.Library
256
257 STR.Run <T SIMU.Run
258
259 // Removed these changes after r25103 since they cause ManyObjectsForFunctionalRelationException: Functional relation has assertions from multiple inherited types.
260 // problems for domainProperties and possibly valueAccessor too when simply viewing the properties of an instance whose type uses multi-inheritance.
261 // Need a solution for this before enabling.
262 STR.Component
263   @L0.assert L0.domainProperties 
264     STR.Functions.structuralChildDomainProperties : L0.ExternalValue
265       L0.HasValueType "VariableMap"
266   @L0.assert L0.domainChildren 
267     STR.Functions.structuralChildDomainChildren : L0.ExternalValue
268       L0.HasValueType "VariableMap"
269   @L0.assert L0.typeResource
270     _ : L0.SCLValue
271       L0.SCLValue.expression "structuralTypeResource"
272       L0.HasValueType "Variable -> Resource -> <ReadGraph> Resource"
273
274 STR.Run
275   @L0.assert L0.domainChildren 
276     STR.Functions.structuralRunDomainChildren : L0.ExternalValue
277       L0.HasValueType "VariableMap"
278
279 STR.Connection
280   @L0.assert L0.domainProperties L0.Functions.standardPropertyDomainProperties
281   @L0.assert L0.domainChildren L0.Functions.standardPropertyDomainChildren
282   @L0.assert L0.valueAccessor STR.Functions.connectionValueAccessor
283
284 STR.SCLValue <T L0.SCLValue
285   @L0.assert L0.ConvertsToValueWith STR.Functions.computeExpression
286   @L0.assert L0.SCLValue.environment
287     _ : L0.SCLValue.Environment
288       L0.SCLValue.Environment.moduleName "Simantics/All"
289       L0.SCLValue.Environment.namespace ""
290
291 STR.scl : L0.Template
292     @template %subject %property %expression %valueType
293         %subject
294             %property _ : STR.SCLValue
295               L0.SCLValue.expression %expression
296               L0.HasValueType %valueType
297
298 STR.sclValue : L0.Template
299     @template %subject %expression %valueType
300         %subject : STR.SCLValue
301             L0.SCLValue.expression %expression
302             L0.HasValueType %valueType
303
304 STR.InvalidSCLExpressionIssue <T ISSUE.Issue
305
306 STR.Property <T L0.FunctionalRelation <T L0.PropertyRelation
307     @L0.assert STR.HasExpression 
308         _ /* dummy */ : L0.Value
309             L0.HasValueType "String"
310
311 STR.Component
312   L0.HasConstraint STR.ConnectionValidationConstraint : L0.Constraint
313     L0.Constraint.Validator
314       STR.Functions.connectionValidator : L0.Function
315
316 STR.ConnectionValidationConstraint.ErrorIssue
317   @ISSUE.issue ISSUE.Severity.Error
318     STR.Functions.connectionIssueDescription : L0.Function
319       L0.HasValueType "String" 
320   
321 STR.ConnectionValidationConstraint.Source <T ISSUE.Sources.DependencyTracker
322   L0.HasLabel "Structural connection validity"
323   @L0.assert ISSUE.Sources.DependencyTracker.HasType STR.Component
324   @L0.assert ISSUE.Sources.DependencyTracker.HasSearchType STR.Connection
325   @L0.assert ISSUE.Sources.DependencyTracker.HasSearchType STR.ConnectionJoin
326   @L0.assert ISSUE.Sources.DependencyTracker.HasExtension STR.Functions.connectionExtension
327   @L0.assert ISSUE.Sources.DependencyTracker.HasConstraint STR.ConnectionConstraint
328
329 STR.HasJoinClusterSet <R L0.IsComposedOf
330   --> L0.ClusterSet
331   
332 STR.structuralRevision <R L0.HasProperty : L0.FunctionalRelation
333   --> DATATYPE.GUID
334   
335 STR.synchronizedRevision <R L0.HasProperty : L0.FunctionalRelation
336   ==> "Long"             
337   
338 STR.input <R L0.HasProperty : L0.FunctionalRelation
339   ==> "Variable"             
340
341 STR.UserDefinedProperty <T L0.Entity
342
343 STR.ComponentType
344     // This relation is inherited from L0.IsComposedOf because changes in the code
345     // need to be propagated to the component type
346     >-- STR.ComponentType.hasScript --> STR.ComponentTypeScript <R L0.IsComposedOf
347 STR.ComponentTypeScript <T L0.Entity
348     >-- STR.ComponentTypeScript.type --> L0.String <R L0.HasProperty : L0.FunctionalRelation
349     >-- STR.ComponentTypeScript.code --> L0.String <R L0.HasProperty : L0.FunctionalRelation
350
351 STR.ComponentType.Locked
352     @L0.defTag
353     L0.HasDomain STR.ComponentType
354     L0.HasDescription "Indicates that the component type is locked and cannot be opened for editing."
355     
356  
357 STR.TypeOverride <T L0.Entity
358     >-- STR.TypeOverride.HasOriginalType --> STR.ComponentType <R L0.IsRelatedTo : L0.TotalFunction
359     >-- STR.TypeOverride.HasReplacementType --> STR.ComponentType <R L0.IsRelatedTo : L0.TotalFunction 
360 STR.HasTypeOverride --> STR.TypeOverride <R L0.IsRelatedTo