Просмотр исходного кода

Create abstract 'dict' vocabulary to represent key,value-pairs. Useful for XML attributes, etc.

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

Разница между файлами не показана из-за своего большого размера
+ 41 - 40
examples/oml/CDF/src/oml/flandersmake.be/cdf/description/my_xopp.oml


+ 25 - 0
examples/oml/CDF/src/oml/flandersmake.be/cdf/vocabulary/dict.oml

@@ -0,0 +1,25 @@
+// Extension of object_diagram vocabulary
+vocabulary <http://flandersmake.be/cdf/vocabulary/dict#> as dict {
+	
+	extends <http://flandersmake.be/cdf/vocabulary/object_diagram#> as object_diagram
+	extends <http://www.w3.org/2001/XMLSchema#> as xsd
+
+	aspect Object []
+	
+	// In many vocabularies, we want to have "dictionaries" (key-value mappings).
+	// We choose to represent every dictionary entry by an 'Object', that has a 'key' and 'value' field
+	aspect DictEntry :> Object [
+		restricts scalar property hasKey to exactly 1
+		restricts scalar property hasValue to exactly 1
+	]
+	scalar property hasKey :> object_diagram:hasField [
+		domain DictEntry
+		range xsd:string
+		functional
+	]
+	scalar property hasValue :> object_diagram:hasField [
+		domain DictEntry
+		range xsd:string
+		functional
+	]
+}

+ 4 - 13
examples/oml/CDF/src/oml/flandersmake.be/cdf/vocabulary/xopp.oml

@@ -1,6 +1,8 @@
+// Vocabulary for the Xournal++ file format
 vocabulary <http://flandersmake.be/cdf/vocabulary/xopp#> as xopp {
 
 	extends <http://flandersmake.be/cdf/vocabulary/object_diagram#> as object_diagram
+	extends <http://flandersmake.be/cdf/vocabulary/dict#> as dict
 	extends <http://www.w3.org/2001/XMLSchema#> as xsd
 
 	aspect element :> object_diagram:Object []
@@ -23,21 +25,9 @@ vocabulary <http://flandersmake.be/cdf/vocabulary/xopp#> as xopp {
 		inverse functional
 	]
 	
-	concept XMLAttribute :> element [
-		restricts scalar property hasKey to exactly 1
-		restricts scalar property hasValue to exactly 1
+	concept XMLAttribute :> element, dict:DictEntry [
 		restricts relation ofLayerElement to exactly 1
 	]
-	scalar property hasKey :> object_diagram:hasField [
-		domain XMLAttribute
-		range xsd:string
-		functional
-	]
-	scalar property hasValue :> object_diagram:hasField [
-		domain XMLAttribute
-		range xsd:string
-		functional
-	]
 	
 	concept Text :> LayerElement []
 	concept Stroke :> LayerElement []
@@ -140,6 +130,7 @@ vocabulary <http://flandersmake.be/cdf/vocabulary/xopp#> as xopp {
 		inverse functional
 	]
 	
+	// A Xournal++ file:
 	concept Model :> object_diagram:Model [
 		restricts all relation object_diagram:hasObject to element
 	]