]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.structural.ontology/graph/Structural.pgraph
Replaceable Defined Component Types
[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.ConnectionRelation <T L0.Relation
117     @L0.assert L0.SharedRange STR.ConnectionRelation
118     >-- STR.ConnectionRelation.connectionRequired --> L0.Boolean <R L0.HasProperty : L0.FunctionalRelation
119     >-- STR.ConnectionRelation.equivalentConnectionPoint --> STR.ConnectionRelation <R L0.IsRelatedTo
120         L0.InverseOf STR.ConnectionRelation.equivalentConnectionPoint
121     @L0.assert L0.valueAccessor STR.Functions.connectionValueAccessor
122     @L0.assert L0.domainProperties L0.Functions.standardPropertyDomainProperties
123     @L0.assert L0.domainChildren L0.Functions.standardPropertyDomainChildren            
124
125 STR.SynchronizedRelation <T L0.Relation
126 STR.SynchronizedConnectionRelation <T STR.ConnectionRelation
127 STR.ProvidingConnectionRelation <T STR.ConnectionRelation
128
129 STR.InComposite <R L0X.HasTemplate
130
131
132 // deprecated
133 //IsConnected <R L0.DependsOn : ConnectionRelation
134 //    @L0.tag L0.Abstract
135 //    L0.InverseOf IsConnected
136 /*
137 STR.DirectedConnectionRelation <T STR.ConnectionRelation
138     L0.Asserts _ : L0.Assertion
139       L0.HasPredicate L0.SharedRange
140       L0.HasObject STR.DirectedConnectionRelation
141 */
142 STR.IsConnectedTo <R L0.DependsOn : STR.ConnectionRelation
143     @L0.tag L0.Abstract 
144     L0.InverseOf STR.Connects
145     
146 //// Connection types
147
148 //deprecated
149 STR.SupportsConnectionType <R L0.IsRelatedTo
150     L0.HasRange STR.ConnectionType    
151
152 STR.HasConnectionType <R L0.IsRelatedTo : L0.FunctionalRelation
153     L0.HasRange STR.ConnectionType    
154     
155 STR.ConnectionType <T L0.Entity
156     >-- STR.ConnectionType.isUserSelectable --> "Boolean" <R L0.HasProperty : L0.FunctionalRelation
157     @L0.assert STR.ConnectionType.isUserSelectable false
158     //[STR.HasCardinalityRestriction all STR.CardinalityRestriction]   
159     
160 STR.SupportsDirection <R L0.IsRelatedTo
161     L0.HasRange STR.ConnectionDirection
162
163 STR.ConnectionDirection <T L0.Entity
164
165 STR.InputDirection : STR.ConnectionDirection
166 STR.OutputDirection : STR.ConnectionDirection
167     
168 STR.HasCardinalityRestriction <R L0.IsRelatedTo
169
170 STR.CardinalityRestriction <T L0.Entity
171     //[STR.HasLowerBound card "0..1"]
172     //[STR.HasUpperBound card "0..1"]
173     //[STR.HasConnectionDirection card "0..1"]
174     
175 STR.HasLowerBound <R L0.HasProperty
176 STR.HasUpperBound <R L0.HasProperty
177 STR.HasConnectionDirection <R L0.IsRelatedTo    
178
179 STR.ConnectionJoin <T L0.Entity
180     @L0.property STR.Joins
181 STR.Joins <R L0.DependsOn
182     L0.InverseOf STR.IsJoinedBy <R L0.DependsOn
183         L0.HasDomain STR.Connection
184         L0.HasRange STR.ConnectionJoin
185 STR.HasConnectionJoin <R L0.DependsOn
186     L0.HasDomain STR.Composite
187     L0.HasRange STR.ConnectionJoin
188     L0.InverseOf STR.JoinsComposite <R L0.IsWeaklyRelatedTo
189
190 //// Modeling rules
191
192 STR.ModelingRules <T L0.Entity
193     L0.HasDescription """Defines what can be populated to a composite 
194 and what can be connected. 
195 See <https://www.simantics.org/wiki/index.php/Diagram_ontology>."""
196
197 STR.HasModelingRules <R L0.IsRelatedTo : L0.FunctionalRelation
198     L0.HasDomain STR.Composite
199     L0.HasDomain STR.OrderedComposite
200     L0.HasRange STR.ModelingRules
201     
202 STR.SimpleModelingRules <T STR.ModelingRules
203     @L0.singleProperty STR.HasConnectionType
204     @L0.singleProperty STR.HasAttachmentRelation
205     L0.HasDescription """Modeling rules that allow all connections."""
206 STR.HasAttachmentRelation <R L0.IsRelatedTo : L0.FunctionalRelation
207     L0.HasRange L0.Relation    
208
209 STR.DefaultConnectionType : STR.ConnectionType   
210 STR.DefaultModelingRules : STR.SimpleModelingRules
211     STR.HasConnectionType STR.DefaultConnectionType
212 STR.StandardModelingRules : STR.ModelingRules
213 STR.AllowsConnectionType <R L0.DependsOn
214     L0.HasDomain L0.Relation
215     L0.HasRange STR.ConnectionType
216     L0.InverseOf STR.AllowsConnectionType.Inverse <R L0.IsWeaklyRelatedTo
217 STR.OverridesConnectionType <R L0.DependsOn
218     L0.HasDomain STR.ConnectionType
219     L0.HasRange STR.ConnectionType
220 STR.IsIncludedInConnectionType <R L0.DependsOn
221     L0.HasDomain STR.ConnectionType
222     L0.HasRange STR.ConnectionType
223 STR.DefaultsToConnectionType <R L0.DependsOn : L0.FunctionalRelation
224     <-- L0.Relation
225     --> STR.ConnectionType
226     L0.InverseOf STR.DefaultsToConnectionType.Inverse <R L0.IsWeaklyRelatedTo
227 STR.ConnectionConstraint <T L0.Entity
228 STR.HasConnectionConstraint <R L0.IsRelatedTo
229     L0.HasDomain STR.ConnectionType
230     L0.HasRange STR.ConnectionConstraint    
231
232 // Groups
233
234 STR.BelongsTo <R L0.IsRelatedTo
235     L0.HasRange STR.ComponentGroup
236     L0.InverseOf STR.BelongsToInverse <R L0.IsWeaklyRelatedTo
237 STR.GroupBelongsTo <R L0.IsRelatedTo
238     L0.HasRange STR.GroupSubsumption
239     L0.InverseOf STR.GroupBelongsToInverse <R L0.IsWeaklyRelatedTo
240 STR.ComponentGroup <T L0.Entity
241 STR.GroupSubsumption <T L0.Entity
242     @L0.property STR.HasSubgroup
243     @L0.property STR.BelongsTo
244 STR.HasSubgroup <R L0.IsRelatedTo
245     L0.HasRange STR.ComponentGroup
246
247 // Support for expressions
248 STR.HasExpression <R L0.HasProperty
249     >-- L0.Value 
250     ==> "String" 
251     L0.valueAccessor STR.Functions.expressionValueAccessor : L0.ExternalValue
252     
253 STR.Functions : L0.Library
254
255 STR.Run <T SIMU.Run
256
257 // Removed these changes after r25103 since they cause ManyObjectsForFunctionalRelationException: Functional relation has assertions from multiple inherited types.
258 // problems for domainProperties and possibly valueAccessor too when simply viewing the properties of an instance whose type uses multi-inheritance.
259 // Need a solution for this before enabling.
260 STR.Component
261   @L0.assert L0.domainProperties 
262     STR.Functions.structuralChildDomainProperties : L0.ExternalValue
263       L0.HasValueType "VariableMap"
264   @L0.assert L0.domainChildren 
265     STR.Functions.structuralChildDomainChildren : L0.ExternalValue
266       L0.HasValueType "VariableMap"
267   @L0.assert L0.typeResource
268     _ : L0.SCLValue
269       L0.SCLValue.expression "structuralTypeResource"
270       L0.HasValueType "Variable -> Resource -> <ReadGraph> Resource"
271
272 STR.Run
273   @L0.assert L0.domainChildren 
274     STR.Functions.structuralRunDomainChildren : L0.ExternalValue
275       L0.HasValueType "VariableMap"
276
277 STR.Connection
278   @L0.assert L0.domainProperties L0.Functions.standardPropertyDomainProperties
279   @L0.assert L0.domainChildren L0.Functions.standardPropertyDomainChildren
280   @L0.assert L0.valueAccessor STR.Functions.connectionValueAccessor
281
282 STR.SCLValue <T L0.SCLValue
283   @L0.assert L0.ConvertsToValueWith STR.Functions.computeExpression
284   @L0.assert L0.SCLValue.environment
285     _ : L0.SCLValue.Environment
286       L0.SCLValue.Environment.moduleName "Simantics/All"
287       L0.SCLValue.Environment.namespace ""
288
289 STR.scl : L0.Template
290     @template %subject %property %expression %valueType
291         %subject
292             %property _ : STR.SCLValue
293               L0.SCLValue.expression %expression
294               L0.HasValueType %valueType
295
296 STR.sclValue : L0.Template
297     @template %subject %expression %valueType
298         %subject : STR.SCLValue
299             L0.SCLValue.expression %expression
300             L0.HasValueType %valueType
301
302 STR.InvalidSCLExpressionIssue <T ISSUE.Issue
303
304 STR.Property <T L0.FunctionalRelation <T L0.PropertyRelation
305     @L0.assert STR.HasExpression 
306         _ /* dummy */ : L0.Value
307             L0.HasValueType "String"
308
309 STR.Component
310   L0.HasConstraint STR.ConnectionConstraint : L0.Constraint
311     L0.Constraint.Validator
312       STR.Functions.connectionValidator : L0.Function
313
314 STR.ConnectionConstraint.ErrorIssue
315   @ISSUE.issue ISSUE.Severity.Error
316     STR.Functions.connectionIssueDescription : L0.Function
317       L0.HasValueType "String" 
318   
319 STR.ConnectionConstraint.Source <T ISSUE.Sources.DependencyTracker
320   L0.HasLabel "Structural connection validity"
321   @L0.assert ISSUE.Sources.DependencyTracker.HasType STR.Component
322   @L0.assert ISSUE.Sources.DependencyTracker.HasSearchType STR.Connection
323   @L0.assert ISSUE.Sources.DependencyTracker.HasSearchType STR.ConnectionJoin
324   @L0.assert ISSUE.Sources.DependencyTracker.HasExtension STR.Functions.connectionExtension
325   @L0.assert ISSUE.Sources.DependencyTracker.HasConstraint STR.ConnectionConstraint
326
327 STR.HasJoinClusterSet <R L0.IsComposedOf
328   --> L0.ClusterSet
329   
330 STR.structuralRevision <R L0.HasProperty : L0.FunctionalRelation
331   --> DATATYPE.GUID
332   
333 STR.synchronizedRevision <R L0.HasProperty : L0.FunctionalRelation
334   ==> "Long"             
335   
336 STR.input <R L0.HasProperty : L0.FunctionalRelation
337   ==> "Variable"             
338
339 STR.UserDefinedProperty <T L0.Entity
340
341 STR.ComponentType
342     // This relation is inherited from L0.IsComposedOf because changes in the code
343     // need to be propagated to the component type
344     >-- STR.ComponentType.hasScript --> STR.ComponentTypeScript <R L0.IsComposedOf
345 STR.ComponentTypeScript <T L0.Entity
346     >-- STR.ComponentTypeScript.type --> L0.String <R L0.HasProperty : L0.FunctionalRelation
347     >-- STR.ComponentTypeScript.code --> L0.String <R L0.HasProperty : L0.FunctionalRelation
348
349 STR.ComponentType.Locked
350     @L0.defTag
351     L0.HasDomain STR.ComponentType
352     L0.HasDescription "Indicates that the component type is locked and cannot be opened for editing."
353     
354  
355 STR.TypeOverride <T L0.Entity
356     >-- STR.TypeOverride.HasOriginalType --> STR.ComponentType <R L0.IsRelatedTo : L0.TotalFunction
357     >-- STR.TypeOverride.HasReplacementType --> STR.ComponentType <R L0.IsRelatedTo : L0.TotalFunction 
358 STR.HasTypeOverride --> STR.TypeOverride <R L0.IsRelatedTo