Joeri Exelmans 2 лет назад
Родитель
Сommit
e88f73d188

+ 116 - 5
examples/oml/CDF/src/oml/flandersmake.be/cdf/vocabulary/drawio.oml

@@ -4,8 +4,11 @@ vocabulary <http://flandersmake.be/cdf/vocabulary/drawio#> as drawio {
 	extends <http://flandersmake.be/cdf/vocabulary/object_diagram#> as object_diagram
 	extends <http://flandersmake.be/cdf/vocabulary/object_diagram#> as object_diagram
 	extends <http://flandersmake.be/cdf/vocabulary/acyclic#> as acyclic
 	extends <http://flandersmake.be/cdf/vocabulary/acyclic#> as acyclic
 	extends <http://flandersmake.be/cdf/vocabulary/dict#> as dict
 	extends <http://flandersmake.be/cdf/vocabulary/dict#> as dict
+	extends <http://flandersmake.be/cdf/vocabulary/ordered#> as ordered
 	extends <http://www.w3.org/2001/XMLSchema#> as xsd
 	extends <http://www.w3.org/2001/XMLSchema#> as xsd
 
 
+	extends <http://flandersmake.be/cdf/vocabulary/xopp#> as xopp
+
 	aspect element :> object_diagram:Object []
 	aspect element :> object_diagram:Object []
 	
 	
 	// Cells and Pages have a GUID generated by drawio.
 	// Cells and Pages have a GUID generated by drawio.
@@ -18,9 +21,19 @@ vocabulary <http://flandersmake.be/cdf/vocabulary/drawio#> as drawio {
 		functional
 		functional
 	]
 	]
 
 
+	// All cells are vertices or edges, except for:
+	//   (1) The root cell of a page
+	//   (2) The cells that represent layers (direct children of the root cell)
 	concept Cell :> elementWithDrawioId [
 	concept Cell :> elementWithDrawioId [
-		
+		restricts scalar property hasValue to exactly 1
 	]
 	]
+	
+	scalar property hasValue [
+		domain Cell
+		range xsd:string
+		functional
+	]
+	
 	relation entity HasParentCell :> acyclic:Acyclic, object_diagram:Link [
 	relation entity HasParentCell :> acyclic:Acyclic, object_diagram:Link [
 		from Cell
 		from Cell
 		to Cell
 		to Cell
@@ -31,19 +44,117 @@ vocabulary <http://flandersmake.be/cdf/vocabulary/drawio#> as drawio {
 		functional // all cells have one parent, except for the root cell
 		functional // all cells have one parent, except for the root cell
 	]
 	]
 	
 	
+	relation entity HasProperty :> object_diagram:Link [
+		from Cell
+		to CellProperty
+		forward hasProperty
+		reverse propertyOf
+		asymmetric
+		irreflexive
+		inverse functional
+	]
+	relation entity HasStyleEntry :> object_diagram:Link [
+		from Cell
+		to CellStyleEntry
+		forward hasStyleEntry
+		reverse styleEntryOf
+		asymmetric
+		irreflexive
+		inverse functional
+	]
+	relation entity HasCellAttribute :> object_diagram:Link [
+		from Cell
+		to CellAttribute
+		forward hasCellAttribute
+		reverse attributeOf
+		asymmetric
+		irreflexive
+		inverse functional
+	]
+	
+	concept CellProperty :> dict:DictEntry, element []
+	concept CellStyleEntry :> dict:DictEntry, element []
+	concept CellAttribute :> dict:DictEntry, element []
+	
+	structure Point [
+		restricts scalar property hasX to exactly 1
+		restricts scalar property hasY to exactly 1
+	]
+	scalar property hasX :> object_diagram:hasField [
+		domain Point
+		range xsd:decimal
+		functional
+	]
+	scalar property hasY :> object_diagram:hasField [
+		domain Point
+		range xsd:decimal
+		functional
+	]
+	
+	structure VertexGeometry :> Point [
+		restricts scalar property hasWidth to exactly 1
+		restricts scalar property hasHeight to exactly 1
+	]
+	scalar property hasWidth :> object_diagram:hasField [
+		domain VertexGeometry
+		range xsd:decimal
+		functional
+	]
+	scalar property hasHeight :> object_diagram:hasField [
+		domain VertexGeometry
+		range xsd:decimal
+		functional
+	]
+	
+	structure PointListItem :> Point [
+		restricts scalar property hasListIndex to exactly 1
+	]
+	scalar property hasListIndex [
+		domain PointListItem
+		range xsd:nonNegativeInteger
+		functional
+	]
+	
+	structure EdgeGeometry []
+	structured property hasPoint [
+		domain EdgeGeometry
+		range PointListItem
+	]
+	structured property hasSourcePoint [
+		domain EdgeGeometry
+		range Point
+		functional
+	]
+	structured property hasTargetPoint [
+		domain EdgeGeometry
+		range Point
+		functional
+	]
+	
 	concept Vertex :> Cell []
 	concept Vertex :> Cell []
 	concept Edge :> Cell []
 	concept Edge :> Cell []
 	
 	
+	structured property hasVertexGeometry [
+		domain Vertex
+		range VertexGeometry
+		functional
+	]
+	structured property hasEdgeGeometry [
+		domain Edge
+		range EdgeGeometry
+		functional
+	]
+	
 	concept Page :> elementWithDrawioId [
 	concept Page :> elementWithDrawioId [
 		restricts relation ofModel to exactly 1
 		restricts relation ofModel to exactly 1
 		restricts scalar property hasName to exactly 1
 		restricts scalar property hasName to exactly 1
-
+		restricts relation hasRootCell to exactly 1
 	]
 	]
 	
 	
 	relation entity HasPageAttribute :> object_diagram:Link [
 	relation entity HasPageAttribute :> object_diagram:Link [
 		from Page
 		from Page
 		to PageAttribute
 		to PageAttribute
-		forward hasAttribute
+		forward hasPageAttribute
 		reverse ofPage
 		reverse ofPage
 		asymmetric
 		asymmetric
 		irreflexive
 		irreflexive
@@ -56,8 +167,8 @@ vocabulary <http://flandersmake.be/cdf/vocabulary/drawio#> as drawio {
 		reverse isRootOf
 		reverse isRootOf
 		asymmetric
 		asymmetric
 		irreflexive
 		irreflexive
-		functional
-		inverse functional
+		functional // every page has exactly one root cell
+		inverse functional // a cell can be the root of at most one page
 	]
 	]
 	
 	
 	concept PageAttribute :> dict:DictEntry []
 	concept PageAttribute :> dict:DictEntry []

+ 40 - 0
examples/oml/CDF/src/oml/flandersmake.be/cdf/vocabulary/ordered.oml

@@ -0,0 +1,40 @@
+vocabulary <http://flandersmake.be/cdf/vocabulary/ordered#> as ordered {
+	
+//	extends <http://flandersmake.be/cdf/vocabulary/acyclic#> as acyclic
+	extends <http://www.w3.org/2001/XMLSchema#> as xsd
+	
+	aspect List []
+	
+	relation entity HasItem [
+		from List
+		to ListItem
+		forward hasItem
+		reverse ofList
+		asymmetric
+		irreflexive
+		inverse functional
+	]
+	
+	aspect ListItem [
+		restricts scalar property hasIndex to exactly 1
+	]
+	
+//	relation entity Next :> acyclic:Acyclic [
+//		from ListItem
+//		to ListItem
+//		forward nextItem
+//		reverse prevItem
+//		asymmetric
+//		irreflexive
+//	]
+	
+//	rule N [
+//		hasItem(L,I1) ^ hasItem(L,I2) ^ hasIndex(I1, IDX1) ^ hasIndex(I2, IDX1+1) -> nextItem(I1, I2)
+//	]
+	
+	scalar property hasIndex [
+		domain ListItem
+		range xsd:nonNegativeInteger
+		functional
+	]
+}