@prefix owl:      <http://www.w3.org/2002/07/owl#> .
@prefix rdf:      <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:     <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd:      <http://www.w3.org/2001/XMLSchema#> .
@prefix skos:     <http://www.w3.org/2004/02/skos/core#> .
@prefix dcterms:  <http://purl.org/dc/terms/> .
@prefix arch:     <https://meta.linked.archi/core#> .
@prefix arch-vis: <https://meta.linked.archi/core-vis#> .
@prefix am:       <https://meta.linked.archi/archimate3/onto#> .
@prefix :         <https://meta.linked.archi/examples/diagram/> .

#################################################################
# Core-vis reference example — the diagram layer, done correctly
#
# Small enough to read in one screen, complete enough to exercise every
# shape in core-vis-shapes: an ArchNode that names its element, a
# ContainerNode that names nothing, a labelled edge (the case the
# arch-vis:label domain used to forbid), a routed edge with waypoints,
# and a type-level VisualNotation.
#
# Used as the data graph of the `core-vis` validation profile in
# .scripts/validate.sh. If you change core-vis-shapes, change this too.
#################################################################

:DiagramExampleModel
    a                             arch:Model ;
    skos:prefLabel                "Core-vis Diagram Reference Example"@en ;
    dcterms:description           '''Reference instance data for the Linked.Archi diagram
interchange layer. Two application components connected by a named flow, laid out on one
view, with the edge label attached through arch-vis:label — which is only expressible
because arch-vis:label has rdfs:domain arch-vis:DiagElement rather than
arch-vis:Node.'''@en ;
    arch:modelConformsToMetamodel <https://meta.linked.archi/archimate3/metamodel#ArchiMate3.2> ;
    dcterms:created               "2026-08-13"^^xsd:date ;
    dcterms:creator               "Kalin Maldzhanski"^^xsd:string ;
.


#################################################################
# Model layer — what the diagram is about
#################################################################

:OrderService
    a              am:ApplicationComponent ;
    skos:prefLabel "Order Service"@en ;
.

:PaymentService
    a              am:ApplicationComponent ;
    skos:prefLabel "Payment Service"@en ;
.

:OrderServiceServesPaymentService
    a              am:Serving ;
    arch:source    :OrderService ;
    arch:target    :PaymentService ;
    skos:prefLabel "Order Service serves Payment Service"@en ;
    arch-vis:lineStyle   arch-vis:SolidLine ;
    arch-vis:targetDecor arch-vis:OpenArrowhead ;
.


#################################################################
# View
#################################################################

:PaymentFlowView
    a              arch:View ;
    skos:prefLabel "Payment Flow"@en ;
.


#################################################################
# Diagram layer — shapes
#
# The ContainerNode carries no archElement on purpose: a grouping box is
# a diagram construct with no model element behind it, which is exactly
# why the archElement rule targets ArchNode and not Node.
#################################################################

:AppLayerGroup
    a                    arch-vis:ContainerNode ;
    arch-vis:view        :PaymentFlowView ;
    arch-vis:bounds-x    "20.0"^^xsd:double ;
    arch-vis:bounds-y    "20.0"^^xsd:double ;
    arch-vis:bounds-w    "440.0"^^xsd:double ;
    arch-vis:bounds-h    "180.0"^^xsd:double ;
    arch-vis:style       :GroupStyle ;
.

:OrderServiceShape
    a                    arch-vis:ArchNode ;
    arch-vis:view        :PaymentFlowView ;
    arch-vis:archElement :OrderService ;
    arch-vis:bounds-x    "48.0"^^xsd:double ;
    arch-vis:bounds-y    "72.0"^^xsd:double ;
    arch-vis:bounds-w    "140.0"^^xsd:double ;
    arch-vis:bounds-h    "60.0"^^xsd:double ;
    arch-vis:style       :ComponentStyle ;
.

:PaymentServiceShape
    a                    arch-vis:ArchNode ;
    arch-vis:view        :PaymentFlowView ;
    arch-vis:archElement :PaymentService ;
    arch-vis:bounds-x    "292.0"^^xsd:double ;
    arch-vis:bounds-y    "72.0"^^xsd:double ;
    arch-vis:bounds-w    "140.0"^^xsd:double ;
    arch-vis:bounds-h    "60.0"^^xsd:double ;
    arch-vis:style       :ComponentStyle ;
.


#################################################################
# Diagram layer — the labelled, routed edge
#
# arch-vis:label on a Link is the ordinary case, not an edge case: a
# named sequence flow in BPMN, a named serving relationship here. Before
# core-vis 0.3 the domain of arch-vis:label was arch-vis:Node, so this
# assertion entailed that :ServingLink was a Node — now contradicted by
# arch-vis:NodeLinkPointDisjoint.
#################################################################

:ServingLink
    a                         arch-vis:Link ;
    arch-vis:view             :PaymentFlowView ;
    arch-vis:archRelationship :OrderServiceServesPaymentService ;
    arch-vis:source           :OrderServiceShape ;
    arch-vis:target           :PaymentServiceShape ;
    arch-vis:points           :ServingLinkRoute ;
    arch-vis:label            :ServingLinkLabel ;
.

:ServingLinkLabel
    a                 arch-vis:LabelNode ;
    arch-vis:view     :PaymentFlowView ;
    skos:prefLabel    "serves"@en ;
    arch-vis:bounds-x "204.0"^^xsd:double ;
    arch-vis:bounds-y "86.0"^^xsd:double ;
    arch-vis:bounds-w "72.0"^^xsd:double ;
    arch-vis:bounds-h "18.0"^^xsd:double ;
.

## Route: an rdf:List of Points, typed arch-vis:PointList. Written out cell by cell
## rather than with Turtle's ( ) shorthand so every cell carries its type — the
## PointList axiom constrains rdf:first to Point and rdf:rest to PointList, and a
## shorthand list would leave the tail cells untyped.
:ServingLinkRoute
    a         arch-vis:PointList ;
    rdf:first :RouteStart ;
    rdf:rest  :ServingLinkRouteTail ;
.

:ServingLinkRouteTail
    a         arch-vis:PointList ;
    rdf:first :RouteEnd ;
    rdf:rest  rdf:nil ;
.

:RouteStart
    a                  arch-vis:Point ;
    arch-vis:point-x   "188.0"^^xsd:double ;
    arch-vis:point-y   "102.0"^^xsd:double ;
.

:RouteEnd
    a                  arch-vis:Point ;
    arch-vis:point-x   "292.0"^^xsd:double ;
    arch-vis:point-y   "102.0"^^xsd:double ;
.


#################################################################
# Styles
#################################################################

:ComponentStyle
    a                       arch-vis:Style ;
    arch-vis:fillColor      "rgba(181,201,255,100)" ;
    arch-vis:lineColor      "rgba(0,0,0,100)" ;
    arch-vis:fontColor      "rgba(0,0,0,100)" ;
    arch-vis:fontName       "Sans" ;
    arch-vis:fontSize       9 ;
    arch-vis:shapeType      arch-vis:RoundedRectangle ;
    arch-vis:iconPlacement  arch-vis:TopRight ;
    arch-vis:renderingMode  arch-vis:ShapeWithBadge ;
    arch-vis:defaultWidth   "140.0"^^xsd:double ;
    arch-vis:defaultHeight  "60.0"^^xsd:double ;
.

:GroupStyle
    a                       arch-vis:Style ;
    arch-vis:fillColor      "rgba(245,245,245,100)" ;
    arch-vis:lineColor      "rgba(128,128,128,100)" ;
    arch-vis:shapeType      arch-vis:Rectangle ;
    arch-vis:renderingMode  arch-vis:ShapeOnly ;
.


#################################################################
# Type-level notation — a minimal NotationSet
#################################################################

:ExampleNotationSet
    a              arch-vis:NotationSet ;
    skos:prefLabel "Core-vis Example Notation"@en ;
.

:ApplicationComponentNotation
    a                        arch-vis:VisualNotation ;
    arch-vis:notationFor     am:ApplicationComponent ;
    arch-vis:inNotationSet   :ExampleNotationSet ;
    arch-vis:defaultStyle    :ComponentStyle ;
.
