// Vocabulary for the Xournal++ file format
vocabulary <http://ua.be/sdo2l/vocabulary/formalisms/xopp#> as xopp {

	extends <http://ua.be/sdo2l/vocabulary/formalisms/object_diagram#> as object_diagram
	extends <http://ua.be/sdo2l/vocabulary/formalisms/dict#> as dict
	extends <http://www.w3.org/2001/XMLSchema#> as xsd

	aspect element < object_diagram:Object []
	
	aspect LayerElement [
		//restricts inLayer to exactly 1
		//restricts  hasText to exactly 1
	]< element 
	scalar property hasText [
		domain LayerElement
		range xsd:string
		functional
	]< object_diagram:hasField 

	relation entity HasXMLAttribute [
		from LayerElement
		to XMLAttribute
		forward hasAttribute
		reverse ofLayerElement
		inverse functional
	]< object_diagram:Link 
	
	concept XMLAttribute < element, dict:DictEntry [
		restricts  ofLayerElement to exactly 1
	]
	
	concept Text < LayerElement []
	concept Stroke < LayerElement []
	
	concept Layer [
		//restricts inPage to exactly 1
	]< element 
	
	relation entity HasLayerElement [
		from Layer
		to LayerElement
		forward hasElement
		reverse inLayer
		inverse functional
		asymmetric
		irreflexive
	] < object_diagram:Link 
	
	concept Page  [
		//restricts inFile to exactly 1
		//restricts hasWidth to exactly 1
		//restricts  hasHeight to exactly 1
		//restricts  hasBackgroundType to exactly 1
		//restricts  hasBackgroundColor to exactly 1
		//restricts hasBackgroundStyle to exactly 1
	]< element

	scalar property hasWidth  [
		domain Page
		range xsd:decimal
		functional
	]< object_diagram:hasField
	scalar property hasHeight  [
		domain Page
		range xsd:decimal
		functional
	]< object_diagram:hasField
	scalar property hasBackgroundType[
		domain Page
		range xsd:string
		functional
	] < object_diagram:hasField 
	scalar property hasBackgroundColor [
		domain Page
		range xsd:string
		functional
	]< object_diagram:hasField 
	scalar property hasBackgroundStyle [
		domain Page
		range xsd:string
		functional
	]< object_diagram:hasField 
	relation entity HasLayer [
		from Page
		to Layer
		forward hasLayer
		reverse inPage
		inverse functional
		asymmetric
		irreflexive
	]< object_diagram:Link 
		
	scalar property hasCreator [
		domain Model
		range xsd:string
		functional
	]< object_diagram:hasField 
	scalar property hasFileVersion [
		domain Model
		range xsd:integer
		functional
	]< object_diagram:hasField 
	scalar property hasTitle [
		domain Model
		range xsd:string
		functional
	]< object_diagram:hasField 
	scalar property hasPreview  [
		domain Model
//		range xsd:base64Binary // PNG-encoded // Doesn't seem to be working, workaround below
		range xsd:string // Workaround
		functional
	]	< object_diagram:hasField
	
	relation entity HasPage  [
		from Model
		to Page
		forward hasPage
		reverse inFile
		asymmetric
		irreflexive
		inverse functional
	]< object_diagram:Link
	
	// A Xournal++ file:
	concept Model < object_diagram:Model [
		restricts all object_diagram:hasObject to element
	]
}