// Currently unused
// This is an attempt at showing how an instance of a Class Diagram itself can be seen as an object diagram.
// We could implement a conformance check between such instance and another object diagram, for instance in SHACL.
// Then, could we create an instance of 'class_diagram' that conforms to itself? I'm not entirely sure.
// All of this is out-of-scope for CDF.
vocabulary <http://flandersmake.be/cdf/vocabulary/class_diagram#> as class_diagram {

	extends <http://flandersmake.be/cdf/vocabulary/object_diagram#> as object_diagram
	extends <http://www.w3.org/2001/XMLSchema#> as xsd
	
	// objects that have a name
	aspect element :> object_diagram:Object [
		restricts scalar property hasName to exactly 1
	]
	
	scalar property hasName :> object_diagram:hasField [
		domain element
		range xsd:string
		functional
	]
	
	aspect classlike :> element []
	
	// A class is an object, with one field (its name):
	concept Class :> classlike []
	
	relation entity HasAttribute :> object_diagram:Link, element [
		from classlike
		to Attribute
		forward hasAttribute
		reverse isAttributeOf
		asymmetric
		irreflexive
	]
	
	// An attribute is an object, with two fields (name, type)
	concept Attribute :> element [
		restricts scalar property hasType to exactly 1
	]

	scalar property hasType :> object_diagram:hasField [
		domain Attribute
		range xsd:string // not sure if this will work out - maybe we need a relation to the actual type (=an object) itself
		functional
	]
	
	// An association is a link, with one field (its name)
	relation entity Association :> classlike, object_diagram:Link [
		from Class
		to Class
		asymmetric
		irreflexive
	]

	// A class diagram is a model (=a set of objects)
	concept ClassDiagram :> object_diagram:Model [
		restricts all relation object_diagram:hasObject to element
	]
}