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