# AUTO-GENERATED by scripts/prepare-ttl.sh — DO NOT EDIT MANUALLY

@prefix era-sh-evr: <http://data.europa.eu/949/evr/shapes/> .
@prefix era-sh: <http://data.europa.eu/949/shapes/> .
@prefix era: <http://data.europa.eu/949/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vpa: <https://w3id.org/vpa#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .


#############################
# Rules for NationalRegistrationProperty
#############################

#
# NationalRegistrationProperty — NodeShape
#
era-sh:NationalRegistrationPropertyShape
	a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
	sh:targetClass era:NationalRegistrationProperty .


####################################################################
# Layer 1: Structural PropertyShapes
####################################################################

# nationalPropertyIdentifier (12.1) — must point to a SKOS Concept
era-sh:NationalRegistrationPropertyShape sh:property era-sh:NationalPropertyIdentifier .
era-sh:NationalPropertyIdentifier
	a sh:PropertyShape ;
	era:affectedClass era:NationalRegistrationProperty ;
	era:affectedProperty era:nationalPropertyIdentifier ;
	era:scope "local" ;
	rdfs:comment "Identifies the national registration property by pointing to a SKOS Concept from the NationalRegistrationProperties concept scheme."@en ;
	era:evrIndex "12.1" ;
	sh:path era:nationalPropertyIdentifier ;
	sh:minCount 1 ;
	sh:maxCount 1 ;
	sh:nodeKind sh:IRI ;
	sh:class skos:Concept ;
	sh:severity sh:Violation ;
	sh:message "nationalPropertyIdentifier (12.1): Each NationalRegistrationProperty must reference exactly one SKOS Concept identifying the national field."@en .

# nationalPropertyValue (12.3)
era-sh:NationalRegistrationPropertyShape sh:property era-sh:NationalPropertyValue .
era-sh:NationalPropertyValue
	a sh:PropertyShape ;
	era:affectedClass era:NationalRegistrationProperty ;
	era:affectedProperty era:nationalPropertyValue ;
	era:scope "local" ;
	rdfs:comment "The actual value of this national registration property."@en ;
	era:evrIndex "12.3" ;
	sh:path era:nationalPropertyValue ;
	sh:minCount 1 ;
	sh:severity sh:Violation ;
	sh:message "nationalPropertyValue (12.3): Each NationalRegistrationProperty must have at least one value."@en .


####################################################################
# Linking shape: hasNationalRegistrationProperty on VehicleRegistrationCase
####################################################################

era-sh:VehicleRegistrationCaseShape sh:property era-sh:HasNationalRegistrationProperty .
era-sh:VehicleRegistrationCheckShape sh:property era-sh:HasNationalRegistrationProperty .
era-sh:HasNationalRegistrationProperty
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationCase , era:VehicleRegistrationCheck ;
	era:affectedProperty era:hasNationalRegistrationProperty ;
	era:scope "local" ;
	rdfs:comment "Links a vehicle registration case to national-level registration properties defined by a member state."@en ;
	era:evrIndex "12" ;
	sh:path era:hasNationalRegistrationProperty ;
	sh:nodeKind sh:BlankNodeOrIRI ;
	sh:class era:NationalRegistrationProperty ;
	sh:severity sh:Violation ;
	sh:message "hasNationalRegistrationProperty (12): The value must be an instance of era:NationalRegistrationProperty."@en .


####################################################################
# Layer 2a: SKOS concept validation (SPARQL)
# Checks that the nationalPropertyIdentifier value is a concept
# from the NationalRegistrationProperties concept scheme.
####################################################################

era-sh:NationalRegistrationPropertyShape sh:sparql era-sh:NationalPropertyIdentifierSKOS .
era-sh:NationalPropertyIdentifierSKOS
	a sh:SPARQLConstraint ;
	era:affectedClass era:NationalRegistrationProperty ;
	era:affectedProperty era:nationalPropertyIdentifier ;
	era:scope "local" ;
	rdfs:comment "Validates that the national property identifier is a SKOS concept from the NationalRegistrationProperties concept scheme."@en ;
	sh:severity sh:Violation ;
	sh:message "nationalPropertyIdentifier (12.1): The NationalRegistrationProperty {$this} has identifier {?concept} which is not a concept in the NationalRegistrationProperties scheme."@en ;
	sh:prefixes era: ;
	sh:select """
		PREFIX era: <http://data.europa.eu/949/>
		PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
		SELECT $this ?concept
		WHERE {
			$this era:nationalPropertyIdentifier ?concept .
			era:nationalPropertyIdentifier era:inSkosConceptScheme ?conceptScheme .
			FILTER NOT EXISTS { ?concept skos:inScheme ?conceptScheme }
		}
	""" .


####################################################################
# Layer 2b: Dynamic datatype validation (SPARQL)
# Reads the expected datatype from the SKOS Concept (via
# era:nationalPropertyExpectedDatatype on the concept) and checks
# that datatype(?val) matches.
####################################################################

era-sh:NationalRegistrationPropertyShape sh:sparql era-sh:NationalPropertyValueDatatypeCheck .
era-sh:NationalPropertyValueDatatypeCheck
	a sh:SPARQLConstraint ;
	era:affectedClass era:NationalRegistrationProperty ;
	era:affectedProperty era:nationalPropertyValue ;
	era:scope "local" ;
	rdfs:comment "Validates that the actual datatype of the national property value matches the expected datatype declared on the SKOS concept."@en ;
	sh:severity sh:Violation ;
	sh:message "nationalPropertyValue (12.3): The NationalRegistrationProperty {$this} (concept {?conceptLabel}) declares expected datatype {?expectedDT} but the actual value has datatype {?actualDT}."@en ;
	sh:prefixes era: ;
	sh:select """
		PREFIX era: <http://data.europa.eu/949/>
		PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
		PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
		SELECT $this ?conceptLabel ?val ?expectedDT ?actualDT
		WHERE {
			$this era:nationalPropertyIdentifier ?concept .
			?concept era:nationalPropertyExpectedDatatype ?expectedDT .
			OPTIONAL { ?concept skos:prefLabel ?conceptLabel }
			BIND(COALESCE(?conceptLabel0, "unknown concept") AS ?conceptLabel)
			$this era:nationalPropertyValue ?val .
			BIND(datatype(?val) AS ?actualDT)
			FILTER (?actualDT != IRI(?expectedDT))
		}
	""" .


####################################################################
# Layer 2c: String max length validation (SPARQL)
# Validates that string values do not exceed the max length
# declared on the SKOS concept via era:nationalPropertyMaxLength.
####################################################################

era-sh:NationalRegistrationPropertyShape sh:sparql era-sh:NationalPropertyValueMaxLengthCheck .
era-sh:NationalPropertyValueMaxLengthCheck
	a sh:SPARQLConstraint ;
	era:affectedClass era:NationalRegistrationProperty ;
	era:affectedProperty era:nationalPropertyValue ;
	era:scope "local" ;
	rdfs:comment "Validates that string values do not exceed the maximum length declared on the concept."@en ;
	sh:severity sh:Violation ;
	sh:message "nationalPropertyValue (12.3): The NationalRegistrationProperty {$this} (concept {?conceptLabel}) has a string value exceeding max length {?maxLen} (actual length: {?actualLen})."@en ;
	sh:prefixes era: ;
	sh:select """
		PREFIX era: <http://data.europa.eu/949/>
		PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
		PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
		SELECT $this ?conceptLabel ?val ?maxLen ?actualLen
		WHERE {
			$this era:nationalPropertyIdentifier ?concept .
			?concept era:nationalPropertyMaxLength ?maxLen .
			OPTIONAL { ?concept skos:prefLabel ?conceptLabel }
			BIND(COALESCE(?conceptLabel0, "unknown concept") AS ?conceptLabel)
			$this era:nationalPropertyValue ?val .
			FILTER(datatype(?val) = xsd:string)
			BIND(STRLEN(STR(?val)) AS ?actualLen)
			FILTER (?actualLen > ?maxLen)
		}
	""" .

####################################################################
# Layer 2 metadata: National registration property concept metadata
# Validates metadata declared on SKOS Concepts from the
# NationalRegistrationProperties concept scheme.
####################################################################

era-sh:NationalRegistrationPropertyConceptShape
    a sh:NodeShape ;
    sh:targetClass skos:Concept ;
    sh:nodeKind sh:IRI ;
    rdfs:comment "Shape for national registration property concepts."@en ;
    sh:property era-sh:NationalPropertyExpectedDatatype ,
                era-sh:NationalPropertyMandatory ,
                era-sh:NationalPropertyMaxLength .

era-sh:NationalPropertyExpectedDatatype
    a sh:PropertyShape ;
    era:affectedClass skos:Concept ;
    era:affectedProperty era:nationalPropertyExpectedDatatype ;
    era:scope "local" ;
    rdfs:comment "Expected XSD datatype URI for the national registration property value."@en ;
    era:evrIndex "12.2" ;
    sh:path era:nationalPropertyExpectedDatatype ;
    sh:maxCount 1 ;
    sh:datatype xsd:anyURI ;
    sh:severity sh:Violation ;
    sh:message "nationalPropertyExpectedDatatype (12.2): The value must be an xsd:anyURI."@en .

era-sh:NationalPropertyMandatory
    a sh:PropertyShape ;
    era:affectedClass skos:Concept ;
    era:affectedProperty era:nationalPropertyMandatory ;
    era:scope "local" ;
    rdfs:comment "Indicates whether the national registration property is mandatory."@en ;
    era:evrIndex "12.4" ;
    sh:path era:nationalPropertyMandatory ;
    sh:maxCount 1 ;
    sh:datatype xsd:boolean ;
    sh:severity sh:Violation ;
    sh:message "nationalPropertyMandatory (12.4): The value must be a boolean."@en .

era-sh:NationalPropertyMaxLength
    a sh:PropertyShape ;
    era:affectedClass skos:Concept ;
    era:affectedProperty era:nationalPropertyMaxLength ;
    era:scope "local" ;
    rdfs:comment "Maximum allowed string length for the national registration property value."@en ;
    era:evrIndex "12.5" ;
    sh:path era:nationalPropertyMaxLength ;
    sh:maxCount 1 ;
    sh:datatype xsd:integer ;
    sh:minInclusive 0 ;
    sh:severity sh:Violation ;
    sh:message "nationalPropertyMaxLength (12.5): The value must be a non-negative integer."@en .

####################################################################
# Layer 3: Cross-case consistency (SPARQL)
# Warns when a NationalRegistrationProperty references a concept
# that does not belong to the member state's collection matching
# the registeringMemberState of the parent VehicleRegistrationCase.
####################################################################

era-sh:NationalRegistrationPropertyShape sh:sparql era-sh:NationalPropertyCountryConsistencyCheck .
era-sh:NationalPropertyCountryConsistencyCheck
	a sh:SPARQLConstraint ;
	era:affectedClass era:NationalRegistrationProperty ;
	era:affectedProperty era:nationalPropertyIdentifier ;
	era:scope "local" ;
	rdfs:comment "Checks that the referenced national property concept belongs to a SKOS Collection whose skos:notation matches the ISO country code of the registeringMemberState of the parent VehicleRegistrationCase."@en ;
	sh:severity sh:Warning ;
	sh:message "nationalPropertyIdentifier (12.1): The NationalRegistrationProperty {$this} references concept {?concept} but it is not a member of the collection for member state {?msNotation} (derived from registeringMemberState of the parent case)."@en ;
	sh:prefixes era: ;
	sh:select """
		PREFIX era: <http://data.europa.eu/949/>
		PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
		SELECT $this ?concept ?msNotation
		WHERE {
			?case era:hasNationalRegistrationProperty $this .
			?case era:registeringMemberState ?ms .
			$this era:nationalPropertyIdentifier ?concept .
			?collection a skos:Collection ;
			            skos:notation ?msNotation .
			?ms skos:notation ?msNotation .
			FILTER NOT EXISTS { ?collection skos:member ?concept }
		}
	""" .


####################################################################
# Layer 4: Mandatory fields validation (SPARQL)
# Validates that all mandatory national properties (where
# era:nationalPropertyMandatory = true on the concept) are present
# on the VehicleRegistrationCase for the relevant member state.
####################################################################

era-sh:VehicleRegistrationCaseShape sh:sparql era-sh:MandatoryNationalPropertiesCheck .
era-sh:MandatoryNationalPropertiesCheck
	a sh:SPARQLConstraint ;
	era:affectedClass era:VehicleRegistrationCase ;
	era:affectedProperty era:hasNationalRegistrationProperty ;
	era:scope "local" ;
	rdfs:comment "Validates that all mandatory national registration properties for the registering member state are present on the case."@en ;
	sh:severity sh:Violation ;
	sh:message "hasNationalRegistrationProperty (12): The VehicleRegistrationCase {$this} for member state {?msNotation} is missing mandatory national property {?missingConcept} ({?missingLabel})."@en ;
	sh:prefixes era: ;
	sh:select """
		PREFIX era: <http://data.europa.eu/949/>
		PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
		SELECT $this ?msNotation ?missingConcept ?missingLabel
		WHERE {
			$this era:registeringMemberState ?ms .
			?ms skos:notation ?msNotation .
			?collection a skos:Collection ;
			            skos:notation ?msNotation ;
			            skos:member ?missingConcept .
			?missingConcept era:nationalPropertyMandatory true .
			OPTIONAL { ?missingConcept skos:prefLabel ?missingLabel }
			BIND(COALESCE(?missingLabel0, "unknown national property") AS ?missingLabel)
			FILTER NOT EXISTS {
				$this era:hasNationalRegistrationProperty ?nrp .
				?nrp era:nationalPropertyIdentifier ?missingConcept .
			}
		}
	""" .


#############################
# Rules for Vehicle
#############################

#
# Vehicle
#
era-sh:VehicleShape
	a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
	sh:targetClass era:Vehicle .

# vehicleNumber: # 1.1
era-sh:VehicleShape sh:property era-sh-evr:VehicleNumber .
era-sh-evr:VehicleNumber
	a sh:PropertyShape ;
	era:affectedClass era:Vehicle ;
	era:affectedProperty era:vehicleNumber ;
	era:scope "local" ;
	rdfs:comment "European Vehicle Number."@en ;
	era:evrIndex "1.1" ;
	sh:path era:vehicleNumber ;
	sh:maxCount 1 ;
	sh:datatype xsd:string ;
	sh:pattern "^[0-9]{8}$|^[0-9]{12}$" ;
	sh:severity sh:Violation ;
	sh:message "vehicleNumber (1.1): The value must be exactly one string with exactly 8 or 12 digits."@en .

# previousVehicleNumber: # 1.2
era-sh:VehicleShape sh:property era-sh:PreviousVehicleNumber .
era-sh:PreviousVehicleNumber
	a sh:PropertyShape ;
	era:affectedClass era:Vehicle ;
	era:affectedProperty era:previousVehicleNumber ;
	era:scope "local" ;
	rdfs:comment "Previous Vehicle Number."@en ;
	era:evrIndex "1.2" ;
	sh:path era:previousVehicleNumber ;
	sh:maxCount 1 ;
	sh:datatype xsd:string ;
	sh:pattern "^[0-9]{8}$|^[0-9]{12}$" ;
	sh:severity sh:Violation ;
	sh:message "previousVehicleNumber (1.2): The value must be exactly one string with exactly 8 or 12 digits ."@en .

# manufacturingYear: # 5.1
era-sh:VehicleShape sh:property era-sh:ManufacturingYear .
era-sh:ManufacturingYear
	a sh:PropertyShape ;
	era:affectedClass era:Vehicle ;
	era:affectedProperty era:manufacturingYear ;
	era:scope "local" ;
	rdfs:comment "Manufacturing year of the vehicle."@en ;
	era:evrIndex "5.1" ;
	sh:path era:manufacturingYear ;
	sh:maxCount 1 ;
	sh:datatype xsd:gYear ;
	sh:pattern "^[0-9]{4}$" ;
	sh:severity sh:Violation ;
	sh:message "manufacturingYear (5.1): The value must be a 4-digit year (gYear)."@en .

# manufacturingSerialNumber: # 5.2
era-sh:VehicleShape sh:property era-sh:ManufacturingSerialNumber .
era-sh:ManufacturingSerialNumber
	a sh:PropertyShape ;
	era:affectedClass era:Vehicle ;
	era:affectedProperty era:manufacturingSerialNumber ;
	era:scope "local" ;
	rdfs:comment "Manufacturing serial number of the vehicle."@en ;
	era:evrIndex "5.2" ;
	sh:path era:manufacturingSerialNumber ;
	sh:maxCount 1 ;
	sh:datatype xsd:string ;
	sh:severity sh:Warning ;
	sh:message "manufacturingSerialNumber (5.2): The value must be exactly one string."@en .

# vehicleType: # 5.3
era-sh:VehicleShape sh:property era-sh:VehicleTypeProperty .
era-sh:VehicleTypeProperty
	a sh:PropertyShape ;
	era:affectedClass era:Vehicle ;
	era:affectedProperty era:vehicleType ;
	era:scope "local" ;
	rdfs:comment "Reference to the vehicle type."@en ;
	era:evrIndex "5.3" ;
	sh:path era:vehicleType ;
	sh:nodeKind sh:IRI ;
	sh:class era:VehicleType ;
	sh:pattern "^http://data\\.europa\\.eu/949/" ;
	sh:severity sh:Violation ;
	sh:message "vehicleType (5.3): The value must be an IRI pointing to a VehicleType within http://data.europa.eu/949/."@en .


# inVehicleSeries: # 5.4
era-sh:VehicleShape sh:property era-sh:VehicleSeriesEVR .
era-sh:VehicleSeriesEVR
	a sh:PropertyShape ;
	era:affectedClass era:Vehicle ;
	era:affectedProperty era:inVehicleSeries ;
	era:scope "local" ;
	rdfs:comment "Manufacturing series of a vehicle."@en ;
	era:evrIndex "5.4" ;
	sh:path era:inVehicleSeries ;
	sh:nodeKind sh:IRI ;
	sh:class era:VehicleSeries ;
	sh:severity sh:Violation ;
	sh:message "inVehicleSeries (5.4): The value must be an IRI pointing to a VehicleSeries."@en .


#############################
# Rules for VehicleRegistrationCase
#############################

#
# VehicleRegistrationCase
#
era-sh:VehicleRegistrationCaseShape
    a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
	sh:targetClass era:VehicleRegistrationCase .

# registeringMemberState: # 2.1
era-sh:VehicleRegistrationCaseShape sh:property era-sh:RegisteringMemberState .
era-sh:RegisteringMemberState
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationCase ;
	era:affectedProperty era:registeringMemberState ;
	era:scope "local" ;
	rdfs:comment "Registering Member State."@en ;
	era:evrIndex "2.1" ;
	sh:path era:registeringMemberState ;
	sh:nodeKind sh:IRI ;
    sh:pattern "^http://publications\\.europa\\.eu/resource/authority/country/" ;
	sh:severity sh:Violation ;
	sh:message "registeringMemberState (2.1): The value must be an IRI pointing to a country concept."@en .

# registrationCaseType
era-sh:VehicleRegistrationCaseShape sh:property era-sh:RegistrationCaseType .
era-sh:RegistrationCaseType
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationCase ;
	era:affectedProperty era:registrationCaseType ;
	era:scope "local" ;
	rdfs:comment "Type of registration case (e.g., new registration, modification, change of ECM)."@en ;
	sh:path era:registrationCaseType ;
	sh:nodeKind sh:IRI ;
    sh:pattern "^http://data\\.europa\\.eu/949/concepts/vr-regcases/" ;
	sh:severity sh:Violation ;
	sh:message "registrationCaseType: The value must be an IRI pointing to a concept from VehicleRegistrationCase concept scheme."@en .

# registrationCaseType SKOS validation
era-sh:VehicleRegistrationCaseShape sh:sparql era-sh:RegistrationCaseTypeSKOS .
era-sh:RegistrationCaseTypeSKOS
	a sh:SPARQLConstraint ;
	era:affectedProperty era:registrationCaseType ;
	era:affectedClass era:VehicleRegistrationCase ;
	era:scope "local" ;
	rdfs:comment "Type of registration case according to Annex 2 - 3.2.2 Registration Cases."@en ;
	sh:severity sh:Violation ;
	sh:message "registrationCaseType: The VehicleRegistrationCase {$this} (label {?vrcLabel}) has a value {?concept} that is not one of the predefined values and cannot be converted into a SKOS concept on this list: http://data.europa.eu/949/concepts/vr-regcases/VehicleRegistrationCase."@en ;
	sh:prefixes era: ;
	sh:select """
		PREFIX era: <http://data.europa.eu/949/>
		PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
		PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
		SELECT $this ?concept ?vrcLabel
		WHERE {
			OPTIONAL {$this rdfs:label ?vrcLabel} .
			BIND(COALESCE(?vrcLabel0, "unknown label") AS ?vrcLabel)
			$this era:registrationCaseType ?concept .
			era:registrationCaseType era:inSkosConceptScheme ?conceptScheme .
			FILTER NOT EXISTS {?concept skos:inScheme ?conceptScheme}
		}
	""" .

# additionalVehicleConditions: # 4.1
era-sh:VehicleRegistrationCaseShape sh:property era-sh:AdditionalVehicleConditions .
era-sh:AdditionalVehicleConditions
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationCase ;
	era:affectedProperty era:additionalVehicleConditions ;
	era:scope "local" ;
	rdfs:comment "Additional vehicle conditions."@en ;
	era:evrIndex "4.1" ;
	sh:path era:additionalVehicleConditions ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "additionalVehicleConditions (4.1): The value must be an IRI pointing to a concept from EVRApplicableAgreements."@en .

# additionalOtherVehicleConditions: # 4.1
era-sh:VehicleRegistrationCheckShape sh:property era-sh:AdditionalOtherVehicleConditions .
era-sh:AdditionalOtherVehicleConditions
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationCheck ;
	era:affectedProperty era:additionalOtherVehicleConditions ;
	era:scope "local" ;
	rdfs:comment "Additional other vehicle conditions."@en ;
	era:evrIndex "4.1" ;
	sh:path era:additionalOtherVehicleConditions ;
	sh:datatype xsd:string ;
	sh:severity sh:Violation ;
	sh:message "additionalOtherVehicleConditions (4.1): The value must be a string."@en .

# verificationCCS: # 6.2
era-sh:VehicleRegistrationCaseShape sh:property era-sh:VerificationCCSEVR .
era-sh:VerificationCCSEVR
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationCase ;
	era:affectedProperty era:verificationCCS ;
	era:scope "local" ;
	rdfs:comment "Verification CCS."@en ;
	era:evrIndex "6.2" ;
	sh:path era:verificationCCS ;
	sh:datatype xsd:string ;
	sh:severity sh:Violation ;
	sh:message "verificationCCS (6.2): The value must be a string in format CC/RRRRRRRRRRRRRR/YYYY/NNNNNN."@en .

# verificationRSTWAG: # 6.2
era-sh:VehicleRegistrationCaseShape sh:property era-sh:VerificationRSTWAG .
era-sh:VerificationRSTWAG
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationCase ;
	era:affectedProperty era:verificationRSTWAG ;
	era:scope "local" ;
	rdfs:comment "Verification RST/WAG."@en ;
	era:evrIndex "6.2" ;
	sh:path era:verificationRSTWAG ;
	sh:datatype xsd:string ;
	sh:severity sh:Violation ;
	sh:message "verificationRSTWAG (6.2): The value must be a string in format CC/RRRRRRRRRRRRRR/YYYY/NNNNNN."@en .

# vehicleDependentCondition: # 11.9
era-sh:VehicleRegistrationCaseShape sh:property era-sh:VehicleDependentCondition .
era-sh:VehicleDependentCondition
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationCase ;
	era:affectedProperty era:vehicleDependentCondition ;
	era:scope "local" ;
	rdfs:comment "Vehicle dependent condition."@en ;
	era:evrIndex "11.9" ;
	sh:path era:vehicleDependentCondition ;
	sh:nodeKind sh:IRI ;
	sh:class era:VehicleRegistrationCheck ;
	sh:severity sh:Violation ;
	sh:message "vehicleDependentCondition (11.9): The value must be a VehicleRegistrationCheck."@en .


#############################
# Rules for VehicleTypeAuthorisationCase
#############################

#
# VehicleTypeAuthorisationCase
#
era-sh:VehicleTypeAuthorisationCaseShape
	a sh:NodeShape ;
	sh:targetClass era:VehicleTypeAuthorisationCase ;
    sh:nodeKind sh:IRI .

# areaOfUse: # 3.1
era-sh:VehicleTypeAuthorisationCaseShape sh:property era-sh-evr:AreaOfUse .
era-sh-evr:AreaOfUse
	a sh:PropertyShape ;
	era:affectedClass era:VehicleTypeAuthorisationCase ;
	era:affectedProperty era:areaOfUse ;
	era:scope "local" ;
	rdfs:comment "Area of use."@en ;
	era:evrIndex "3.1" ;
	sh:path era:areaOfUse ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "areaOfUse (3.1): The value must be an IRI pointing to a country concept."@en .


#############################
# Rules for VehicleRegistrationRestriction
#############################

#
# VehicleRegistrationRestriction
#
era-sh:VehicleRegistrationRestrictionShape
	a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
	sh:targetClass era:VehicleRegistrationRestriction .

era-sh:RestrictionShape
	a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
	sh:targetClass era:Restriction .

# etcsEquipmentOnBoardLevel: # 11.9.1
era-sh:RestrictionShape sh:property era-sh:EtcsEquipmentOnBoardLevelEVR .
era-sh:EtcsEquipmentOnBoardLevelEVR
	a sh:PropertyShape ;
	era:affectedClass era:Restriction ;
	era:affectedProperty era:etcsEquipmentOnBoardLevel ;
	era:scope "local" ;
	rdfs:comment "ETCS equipment on board level."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:etcsEquipmentOnBoardLevel ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "etcsEquipmentOnBoardLevel (11.9.1): The value must be an IRI pointing to a concept from ETCSEquipmentLevels."@en .

# gaugingProfile: # 11.9.1
era-sh:VehicleRegistrationRestrictionShape sh:property era-sh:GaugingProfileEVR .
era-sh:GaugingProfileEVR
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationRestriction ;
	era:affectedProperty era:gaugingProfile ;
	era:scope "local" ;
	rdfs:comment "Gauging profile."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:gaugingProfile ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "gaugingProfile (11.9.1): The value must be an IRI pointing to a concept from GaugingProfiles."@en .

# legacyRadioSystem: # 11.9.1
era-sh:VehicleRegistrationRestrictionShape sh:property era-sh:LegacyRadioSystemEVR .
era-sh:LegacyRadioSystemEVR
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationRestriction ;
	era:affectedProperty era:legacyRadioSystem ;
	era:scope "local" ;
	rdfs:comment "Legacy radio system."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:legacyRadioSystem ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "legacyRadioSystem (11.9.1): The value must be an IRI pointing to a concept from LegacyRadioSystems."@en .

# protectionLegacySystem: # 11.9.1
era-sh:VehicleRegistrationRestrictionShape sh:property era-sh:ProtectionLegacySystemEVR .
era-sh:ProtectionLegacySystemEVR
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationRestriction ;
	era:affectedProperty era:protectionLegacySystem ;
	era:scope "local" ;
	rdfs:comment "Protection legacy system."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:protectionLegacySystem ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "protectionLegacySystem (11.9.1): The value must be an IRI pointing to a concept from OtherProtectionControlWarnings."@en .

# quieterRoutesExemptedCountry: # 11.9.1
era-sh:RestrictionShape sh:property era-sh:QuieterRoutesExemptedCountryEVR .
era-sh:QuieterRoutesExemptedCountryEVR
	a sh:PropertyShape ;
	era:affectedClass era:Restriction ;
	era:affectedProperty era:quieterRoutesExemptedCountry ;
	era:scope "local" ;
	rdfs:comment "Quieter routes exempted country."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:quieterRoutesExemptedCountry ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "quieterRoutesExemptedCountry (11.9.1): The value must be an IRI pointing to a country concept."@en .

# quieterRoutesNoiseCategory: # 11.9.1
era-sh:RestrictionShape sh:property era-sh:QuieterRoutesNoiseCategoryEVR .
era-sh:QuieterRoutesNoiseCategoryEVR
	a sh:PropertyShape ;
	era:affectedClass era:Restriction ;
	era:affectedProperty era:quieterRoutesNoiseCategory ;
	era:scope "local" ;
	rdfs:comment "Quieter routes noise category."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:quieterRoutesNoiseCategory ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "quieterRoutesNoiseCategory (11.9.1): The value must be an IRI pointing to a noise category concept."@en .

# temperatureRange: # 11.9.1
era-sh:RestrictionShape sh:property era-sh:TemperatureRangeEVR .
era-sh:TemperatureRangeEVR
	a sh:PropertyShape ;
	era:affectedClass era:Restriction ;
	era:affectedProperty era:temperatureRange ;
	era:scope "local" ;
	rdfs:comment "Temperature range."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:temperatureRange ;
	sh:maxCount 1 ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "temperatureRange (11.9.1): The value must be an IRI pointing to a concept from TemperatureRanges."@en .

# trainDetectionSystemType: # 11.9.1
era-sh:VehicleRegistrationRestrictionShape sh:property era-sh:TrainDetectionSystemTypeEVR .
era-sh:TrainDetectionSystemTypeEVR
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationRestriction ;
	era:affectedProperty era:trainDetectionSystemType ;
	era:scope "local" ;
	rdfs:comment "Train detection system type."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:trainDetectionSystemType ;
	sh:maxCount 1 ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "trainDetectionSystemType (11.9.1): The value must be an IRI pointing to a concept from TrainDetectionSystems."@en .

# wheelSetGauge: # 11.9.1
era-sh:VehicleRegistrationRestrictionShape sh:property era-sh:WheelSetGaugeEVR .
era-sh:WheelSetGaugeEVR
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationRestriction ;
	era:affectedProperty era:wheelSetGauge ;
	era:scope "local" ;
	rdfs:comment "Wheel set gauge."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:wheelSetGauge ;
	sh:maxCount 1 ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "wheelSetGauge (11.9.1): The value must be an IRI pointing to a concept from NominalTrackGauges."@en .

# hasStrictLocalHistoricalTouristUse: # 11.9.1
era-sh:RestrictionShape sh:property era-sh:HasStrictLocalHistoricalTouristUseEVR .
era-sh:HasStrictLocalHistoricalTouristUseEVR
	a sh:PropertyShape ;
	era:affectedClass era:Restriction ;
	era:affectedProperty era:hasStrictLocalHistoricalTouristUse ;
	era:scope "local" ;
	rdfs:comment "Has strict local historical tourist use."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:hasStrictLocalHistoricalTouristUse ;
	sh:datatype xsd:boolean ;
	sh:severity sh:Violation ;
	sh:message "hasStrictLocalHistoricalTouristUse (11.9.1): The value must be a boolean."@en .

# isConditionBasedRestriction: # 11.9.1
era-sh:VehicleRegistrationRestrictionShape sh:property era-sh:IsConditionBasedRestrictionEVR .
era-sh:IsConditionBasedRestrictionEVR
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationRestriction ;
	era:affectedProperty era:isConditionBasedRestriction ;
	era:scope "local" ;
	rdfs:comment "Is condition based restriction."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:isConditionBasedRestriction ;
	sh:datatype xsd:boolean ;
	sh:severity sh:Violation ;
	sh:message "isConditionBasedRestriction (11.9.1): The value must be a boolean."@en .

# isTimeBasedRestriction: # 11.9.1
era-sh:VehicleRegistrationRestrictionShape sh:property era-sh:IsTimeBasedRestrictionEVR .
era-sh:IsTimeBasedRestrictionEVR
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationRestriction ;
	era:affectedProperty era:isTimeBasedRestriction ;
	era:scope "local" ;
	rdfs:comment "Is time based restriction."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:isTimeBasedRestriction ;
	sh:datatype xsd:boolean ;
	sh:severity sh:Violation ;
	sh:message "isTimeBasedRestriction (11.9.1): The value must be a boolean."@en .

# maximumDesignSpeed: # 11.9.1
era-sh:RestrictionShape sh:property era-sh:MaximumDesignSpeedEVR .
era-sh:MaximumDesignSpeedEVR
	a sh:PropertyShape ;
	era:affectedClass era:Restriction ;
	era:affectedProperty era:maximumDesignSpeed ;
	era:scope "local" ;
	rdfs:comment "Maximum design speed."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:maximumDesignSpeed ;
	sh:datatype xsd:decimal ;
	sh:severity sh:Violation ;
	sh:message "maximumDesignSpeed (11.9.1): The value must be a decimal (km/h)."@en .

# maximumLocomotivesCoupled: # 11.9.1
era-sh:RestrictionShape sh:property era-sh:MaximumLocomotivesCoupledEVR .
era-sh:MaximumLocomotivesCoupledEVR
	a sh:PropertyShape ;
	era:affectedClass era:Restriction ;
	era:affectedProperty era:maximumLocomotivesCoupled ;
	era:scope "local" ;
	rdfs:comment "Maximum locomotives coupled."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:maximumLocomotivesCoupled ;
	sh:datatype xsd:integer ;
	sh:severity sh:Violation ;
	sh:message "maximumLocomotivesCoupled (11.9.1): The value must be an integer."@en .

# minimumHorizontalRadius: # 11.9.1
era-sh:RestrictionShape sh:property era-sh:MinimumHorizontalRadiusEVR .
era-sh:MinimumHorizontalRadiusEVR
	a sh:PropertyShape ;
	era:affectedClass era:Restriction ;
	era:affectedProperty era:minimumHorizontalRadius ;
	era:scope "local" ;
	rdfs:comment "Minimum horizontal radius."@en ;
	era:evrIndex "11.9.1" ;
	sh:path era:minimumHorizontalRadius ;
	sh:maxCount 1 ;
	sh:or (
		[ sh:datatype xsd:decimal ]
		[ sh:datatype xsd:integer ]
	) ;
	sh:severity sh:Violation ;
	sh:message "minimumHorizontalRadius (11.9.1): The value must be a decimal or integer (meters)."@en .

# nonCodedRestrictions: # 11.9.2
era-sh:VehicleRegistrationRestrictionShape sh:property era-sh:NonCodedRestrictionsEVR .
era-sh:NonCodedRestrictionsEVR
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationRestriction ;
	era:affectedProperty era:nonCodedRestrictions ;
	era:scope "local" ;
	rdfs:comment "Non coded restrictions."@en ;
	era:evrIndex "11.9.2" ;
	sh:path era:nonCodedRestrictions ;
	sh:datatype xsd:string ;
	sh:severity sh:Violation ;
	sh:message "nonCodedRestrictions (11.9.2): The value must be a string."@en .


#############################
# Rules for VehicleSeries
#############################

#
# VehicleSeries
#
era-sh:VehicleSeriesShape
	a sh:NodeShape ;
	sh:targetClass era:VehicleSeries ;
    sh:nodeKind sh:IRI ;
	rdfs:comment "Shape for VehicleSeries class."@en ;
	era:evrIndex "5.4" ;
    sh:property era-sh:VehicleSeriesLabel .

era-sh:VehicleSeriesLabel
    a sh:PropertyShape ;
    era:affectedClass era:VehicleSeries ;
    era:affectedProperty rdfs:label ;
    era:scope "local" ;
    rdfs:comment "Label of the vehicle series."@en ;
    sh:path rdfs:label ;
    sh:minCount 1 ;
    sh:severity sh:Violation ;
    sh:message "VehicleSeries: Each VehicleSeries resource must have at least one rdfs:label."@en .

##########################################################
# Rules for VehicleRegistrationApplication (VPA properties)
###########################################################

#
# VehicleRegistrationApplication
#
era-sh:VehicleRegistrationApplicationShape
	a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
	sh:targetClass era:VehicleRegistrationApplication .

# vpa:constitutedBy
era-sh:VehicleRegistrationApplicationShape sh:property era-sh:ConstitutedBy .
era-sh:ConstitutedBy
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationApplication ;
	era:affectedProperty vpa:constitutedBy ;
	era:scope "local" ;
	rdfs:comment "Links a registration application to its constituting cases."@en ;
	sh:path vpa:constitutedBy ;
	sh:nodeKind sh:IRI ;
	sh:class era:VehicleRegistrationCase ;
	sh:pattern "^http://data\\.europa\\.eu/949/" ;
	sh:severity sh:Violation ;
	sh:message "vpa:constitutedBy: The value must be an IRI pointing to a VehicleRegistrationCase within http://data.europa.eu/949/."@en .


#############################
# Rules for VehicleRegistration (VPA properties)
#############################

#
# VehicleRegistration
#
era-sh:VehicleRegistrationShape
	a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
	sh:targetClass era:VehicleRegistration .

# vpa:requestedIn
era-sh:VehicleRegistrationShape sh:property era-sh:RequestedIn .
era-sh:RequestedIn
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistration ;
	era:affectedProperty vpa:requestedIn ;
	era:scope "local" ;
	rdfs:comment "Links a registration to the application it was requested in."@en ;
	sh:path vpa:requestedIn ;
	sh:nodeKind sh:IRI ;
	sh:class era:VehicleRegistrationApplication ;
	sh:pattern "^http://data\\.europa\\.eu/949/" ;
	sh:severity sh:Violation ;
	sh:message "vpa:requestedIn: The value must be an IRI pointing to a VehicleRegistrationApplication within http://data.europa.eu/949/."@en .

# vpa:concerns (adding to VehicleRegistrationCaseShape)
era-sh:VehicleRegistrationCaseShape sh:property era-sh:Concerns .
era-sh:Concerns
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationCase ;
	era:affectedProperty vpa:concerns ;
	era:scope "local" ;
	rdfs:comment "Links a registration case to the vehicle set it concerns."@en ;
	sh:path vpa:concerns ;
	sh:nodeKind sh:IRI ;
	sh:class era:VehicleSet ;
	#sh:pattern "^http://data\\.europa\\.eu/949/" ;
	sh:severity sh:Violation ;
	sh:message "vpa:concerns: The value must be an IRI pointing to a VehicleSet within http://data.europa.eu/949/."@en .


#############################
# Rules for FreightWagon - Axle Spacing Constraint
#############################

#
# FreightWagon
#
era-sh:FreightWagonAxleSpacingConstraint
	a sh:NodeShape ;
	sh:targetClass era:FreightWagon ;
    sh:nodeKind sh:IRI ;
	rdfs:comment "Constraint to ensure FreightWagon vehicles are not associated with axle spacing properties (axleDistanceA, axleDistanceB, axleDistanceC)."@en .

# FreightWagon must not be linked to VehicleTypes that use AxleSpacing properties
era-sh:FreightWagonAxleSpacingConstraint sh:sparql era-sh:FreightWagonAxleSpacingSPARQL .
era-sh:FreightWagonAxleSpacingSPARQL
	a sh:SPARQLConstraint ;
	era:affectedClass era:FreightWagon ;
	era:scope "local" ;
	rdfs:comment "FreightWagon vehicles should not be linked to VehicleTypes that use AxleSpacing properties."@en ;
	sh:severity sh:Violation ;
	sh:message "FreightWagon: The FreightWagon {$this} must not be linked to a VehicleType that uses axle spacing properties (axleDistanceA, axleDistanceB, axleDistanceC)."@en ;
	sh:prefixes era: ;
	sh:select """
		PREFIX era: <http://data.europa.eu/949/>
		PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
		SELECT $this
		WHERE {
			$this rdf:type era:FreightWagon .
			$this era:vehicleType ?vt .
			?vt era:axleSpacingDistance ?axleSpacing .
			{ ?axleSpacing era:axleDistanceA ?a } UNION
			{ ?axleSpacing era:axleDistanceB ?b } UNION
			{ ?axleSpacing era:axleDistanceC ?c }
		}
	""" .


#############################
# New Vehicle property: vehicleKeeperMarking (8.9)
#############################

# vehicleKeeperMarking: # 8.9
era-sh:VehicleShape sh:property era-sh:VehicleKeeperMarkingProperty .
era-sh:VehicleKeeperMarkingProperty
	a sh:PropertyShape ;
	era:affectedClass era:Vehicle ;
	era:affectedProperty era:vehicleKeeperMarking ;
	era:scope "local" ;
	rdfs:comment "Indicates the Vehicle Keeper Marking (VKM) associated with a vehicle."@en ;
	era:evrIndex "8.9" ;
	sh:path era:vehicleKeeperMarking ;
	sh:maxCount 1 ;
	sh:nodeKind sh:IRI ;
	sh:class era:VehicleKeeperMarking ;
	sh:severity sh:Violation ;
	sh:message "vehicleKeeperMarking (8.9): The value must be an IRI pointing to a VehicleKeeperMarking."@en .


#############################
# New Vehicle subclass shapes
#############################

#
# TractionVehicle
#
era-sh:TractionVehicleShape
	a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
	sh:targetClass era:TractionVehicle ;
	rdfs:comment "Shape for TractionVehicle class (ERATV category: traction vehicle)."@en .

#
# HauledPassengerVehicle
#
era-sh:HauledPassengerVehicleShape
	a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
	sh:targetClass era:HauledPassengerVehicle ;
	rdfs:comment "Shape for HauledPassengerVehicle class (ERATV category: hauled passenger vehicle)."@en .

#
# SpecialVehicle
#
era-sh:SpecialVehicleShape
	a sh:NodeShape ;
	sh:targetClass era:SpecialVehicle ;
    sh:nodeKind sh:IRI ;
	rdfs:comment "Shape for SpecialVehicle class (ERATV category: special vehicle)."@en .


#############################
# New VehicleRegistration properties
#############################

# vehicleECM: # 9
era-sh:VehicleShape sh:property era-sh:VehicleECM .
era-sh:VehicleECM
	a sh:PropertyShape ;
	era:affectedClass era:Vehicle ;
	era:affectedProperty era:vehicleECM ;
	era:scope "local" ;
	rdfs:comment "Indicates the organization that is in charge of maintenance."@en ;
	era:evrIndex "9" ;
	sh:path era:vehicleECM ;
	sh:nodeKind sh:IRI ;
	sh:class era:OrganisationRole ;
	sh:severity sh:Violation ;
	sh:message "vehicleECM (9): The value must be an IRI pointing to an OrganisationRole."@en .

# vehicleOwner: # 7
era-sh:VehicleShape sh:property era-sh:VehicleOwnerRegistration .
era-sh:VehicleOwnerRegistration
	a sh:PropertyShape ;
	era:affectedClass era:Vehicle ;
	era:affectedProperty era:vehicleOwner ;
	era:scope "local" ;
	rdfs:comment "Owner of the vehicle as stated in the registration."@en ;
	era:evrIndex "7" ;
	sh:path era:vehicleOwner ;
	sh:nodeKind sh:IRI ;
	sh:class era:OrganisationRole ;
	sh:severity sh:Violation ;
	sh:message "vehicleOwner (7): The value must be an IRI pointing to an OrganisationRole."@en .

# vehicleKeeper: # 8
era-sh:VehicleShape sh:property era-sh:VehicleKeeperRegistration .
era-sh:VehicleKeeperRegistration
	a sh:PropertyShape ;
	era:affectedClass era:Vehicle ;
	era:affectedProperty era:vehicleKeeper ;
	era:scope "local" ;
	rdfs:comment "Keeper of the vehicle as stated in the registration."@en ;
	era:evrIndex "8" ;
	sh:path era:vehicleKeeper ;
	sh:nodeKind sh:IRI ;
	sh:class era:OrganisationRole ;
	sh:severity sh:Violation ;
	sh:message "vehicleKeeper (8): The value must be an IRI pointing to an OrganisationRole."@en .


#############################
# New VehicleRegistrationCase property
#############################

# registeredManufacturingYear: # 5.1
era-sh:VehicleRegistrationCheckShape sh:property era-sh:RegisteredManufacturingYear .
era-sh:RegisteredManufacturingYear
	a sh:PropertyShape ;
	era:affectedClass era:VehicleRegistrationCheck ;
	era:affectedProperty era:registeredManufacturingYear ;
	era:scope "local" ;
	rdfs:comment "The manufacturing year as stated during the Registration. May differ from the manufacturingYear of the Vehicle itself."@en ;
	era:evrIndex "5.1" ;
	sh:path era:registeredManufacturingYear ;
	sh:maxCount 1 ;
	sh:datatype xsd:gYear ;
	sh:pattern "^[0-9]{4}$" ;
	sh:severity sh:Violation ;
	sh:message "registeredManufacturingYear (5.1): The value must be a 4-digit year (gYear)."@en .


#############################
# New VehicleTypeAuthorisationCase properties
#############################

# authorisingMemberState: # 3.1.1
era-sh:VehicleTypeAuthorisationCaseShape sh:property era-sh-evr:AuthorisingMemberState .
era-sh-evr:AuthorisingMemberState
	a sh:PropertyShape ;
	era:affectedClass era:VehicleTypeAuthorisationCase ;
	era:affectedProperty era:authorisingMemberState ;
	era:scope "local" ;
	rdfs:comment "Indicates the member state where a vehicle type has been authorized."@en ;
	sh:path era:authorisingMemberState ;
	sh:nodeKind sh:IRI ;
	sh:pattern "^http://publications\\.europa\\.eu/resource/authority/country/" ;
	sh:severity sh:Violation ;
	sh:message "authorisingMemberState (3.1.1): The value must be an IRI pointing to a country concept."@en .

# authorisingMemberState SKOS validation
era-sh:VehicleTypeAuthorisationCaseShape sh:sparql era-sh-evr:AuthorisingMemberStateSKOS .
era-sh-evr:AuthorisingMemberStateSKOS
	a sh:SPARQLConstraint ;
	era:affectedProperty era:authorisingMemberState ;
	era:affectedClass era:VehicleTypeAuthorisationCase ;
	era:scope "local" ;
	rdfs:comment "Member State of authorisation must be from the EU country authority."@en ;
	sh:severity sh:Violation ;
	sh:message "authorisingMemberState: The VehicleTypeAuthorisationCase {$this} has a value {?concept} that is not one of the predefined values in the concept scheme: http://publications.europa.eu/resource/authority/country."@en ;
	sh:prefixes era: ;
	sh:select """
		PREFIX era: <http://data.europa.eu/949/>
		PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
		SELECT $this ?concept
		WHERE {
			$this era:authorisingMemberState ?concept .
			era:authorisingMemberState era:inSkosConceptScheme ?conceptScheme .
			FILTER NOT EXISTS {?concept skos:inScheme ?conceptScheme}
		}
	""" .

# typeRegistrationMethod
era-sh:VehicleTypeAuthorisationCaseShape sh:property era-sh-evr:TypeRegistrationMethod .
era-sh-evr:TypeRegistrationMethod
	a sh:PropertyShape ;
	era:affectedClass era:VehicleTypeAuthorisationCase ;
	era:affectedProperty era:typeRegistrationMethod ;
	era:scope "local" ;
	rdfs:comment "The registration method used in the vehicle type authorisation process."@en ;
	sh:path era:typeRegistrationMethod ;
	sh:nodeKind sh:IRI ;
	sh:severity sh:Violation ;
	sh:message "typeRegistrationMethod: The value must be an IRI pointing to a concept from VehicleTypeRegistrationMethods."@en .

# typeRegistrationMethod SKOS validation
era-sh:VehicleTypeAuthorisationCaseShape sh:sparql era-sh-evr:TypeRegistrationMethodSKOS .
era-sh-evr:TypeRegistrationMethodSKOS
	a sh:SPARQLConstraint ;
	era:affectedProperty era:typeRegistrationMethod ;
	era:affectedClass era:VehicleTypeAuthorisationCase ;
	era:scope "local" ;
	rdfs:comment "Type registration method must be from VehicleTypeRegistrationMethods concept scheme."@en ;
	sh:severity sh:Violation ;
	sh:message "typeRegistrationMethod: The VehicleTypeAuthorisationCase {$this} has a value {?concept} that is not one of the predefined values in the concept scheme: http://data.europa.eu/949/concepts/vehicle-types/VehicleTypeRegistrationMethods."@en ;
	sh:prefixes era: ;
	sh:select """
		PREFIX era: <http://data.europa.eu/949/>
		PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
		SELECT $this ?concept
		WHERE {
			$this era:typeRegistrationMethod ?concept .
			era:typeRegistrationMethod era:inSkosConceptScheme ?conceptScheme .
			FILTER NOT EXISTS {?concept skos:inScheme ?conceptScheme}
		}
	""" .

# configDependentCondition
era-sh:VehicleTypeAuthorisationCaseShape sh:property era-sh-evr:ConfigDependentCondition .
era-sh-evr:ConfigDependentCondition
    a sh:PropertyShape ;
    era:affectedClass era:VehicleTypeAuthorisationCase ;
    era:affectedProperty era:configDependentCondition ;
    era:scope "local" ;
    rdfs:comment "Links a vehicle type with its restrictions, through the authorisation case(s)."@en ;
    sh:path era:configDependentCondition ;
    sh:nodeKind sh:BlankNodeOrIRI ;
    sh:class era:Compliance ;
    sh:severity sh:Violation ;
    sh:message "configDependentCondition: The value must be a Compliance."@en .

# configDependentCompliance
era-sh:VehicleTypeAuthorisationCaseShape sh:property era-sh-evr:ConfigDependentCompliance .
era-sh-evr:ConfigDependentCompliance
    a sh:PropertyShape ;
    era:affectedClass era:VehicleTypeAuthorisationCase ;
    era:affectedProperty era:configDependentCompliance ;
    era:scope "local" ;
    rdfs:comment "Links a vehicle type with its conformity checks, through the authorisation case(s)."@en ;
    sh:path era:configDependentCompliance ;
    sh:nodeKind sh:BlankNodeOrIRI ;
    sh:class era:Compliance ;
    sh:severity sh:Violation ;
    sh:message "configDependentCompliance: The value must be a Compliance."@en .

# safetyDeclaration
era-sh:VehicleTypeAuthorisationCaseShape sh:property era-sh:SafetyDeclaration .

#############################
# Rules for VehicleKeeperMarking
#############################

#
# VehicleKeeperMarking
#
era-sh:VehicleKeeperMarkingShape
	a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
	sh:targetClass era:VehicleKeeperMarking ;
	rdfs:comment "Shape for VehicleKeeperMarking class. Vehicle Keeper Markings as per Appendix 6 part 1 of Decision 2007/756/EC."@en .

# vkmCode
era-sh:VehicleKeeperMarkingShape sh:property era-sh:VkmCode .
era-sh:VkmCode
	a sh:PropertyShape ;
	era:affectedClass era:VehicleKeeperMarking ;
	era:affectedProperty era:vkmCode ;
	era:scope "local" ;
	rdfs:comment "VKM code is an alphanumeric code, consisting of 2 to 5 letters."@en ;
	sh:path era:vkmCode ;
	sh:maxCount 1 ;
	sh:datatype xsd:string ;
	sh:pattern "^[A-Z]{2,5}$" ;
	sh:severity sh:Violation ;
	sh:message "vkmCode: The value must be a string of 2 to 5 uppercase letters."@en .

# vkmNational
era-sh:VehicleKeeperMarkingShape sh:property era-sh:VkmNational .
era-sh:VkmNational
	a sh:PropertyShape ;
	era:affectedClass era:VehicleKeeperMarking ;
	era:affectedProperty era:vkmNational ;
	era:scope "local" ;
	rdfs:comment "VKM national code."@en ;
	sh:path era:vkmNational ;
	sh:maxCount 1 ;
	sh:datatype xsd:string ;
	sh:severity sh:Violation ;
	sh:message "vkmNational: The value must be a string."@en .

# vkmStatus
era-sh:VehicleKeeperMarkingShape sh:property era-sh:VkmStatus .
era-sh:VkmStatus
	a sh:PropertyShape ;
	era:affectedClass era:VehicleKeeperMarking ;
	era:affectedProperty era:vkmStatus ;
	era:scope "local" ;
	rdfs:comment "Status of the Vehicle Keeper Marking."@en ;
	sh:path era:vkmStatus ;
	sh:maxCount 1 ;
	sh:nodeKind sh:IRI ;
	sh:class skos:Concept ;
	sh:severity sh:Violation ;
	sh:message "vkmStatus: The value must be an IRI pointing to a SKOS Concept."@en .

# isOTIFMember
era-sh:VehicleKeeperMarkingShape sh:property era-sh:IsOTIFMember .
era-sh:IsOTIFMember
	a sh:PropertyShape ;
	era:affectedClass era:VehicleKeeperMarking ;
	era:affectedProperty era:isOTIFMember ;
	era:scope "local" ;
	rdfs:comment "Identifies if the Body or Organization is from OTIF."@en ;
	sh:path era:isOTIFMember ;
	sh:maxCount 1 ;
	sh:datatype xsd:boolean ;
	sh:severity sh:Violation ;
	sh:message "isOTIFMember: The value must be a boolean."@en .


# VehicleRegistrationCheckShape
era-sh:VehicleRegistrationCheckShape
    a sh:NodeShape ;
    sh:targetClass era:VehicleRegistrationCheck ;
    sh:nodeKind sh:IRI ;
    rdfs:comment "Shape for VehicleRegistrationCheck class."@en ;
    sh:property era-sh:RegisteredCodedConditions ,
                era-sh:RegisteredManufacturingSerialNumber .

# RegisteredCodedConditions
era-sh:RegisteredCodedConditions
    a sh:PropertyShape ;
    era:affectedClass era:VehicleRegistrationCheck ;
    era:affectedProperty era:registeredCodedConditions ;
    era:scope "local" ;
    rdfs:comment "The coded conditions as stated during the registration."@en ;
    era:evrIndex "11.9.1" ;
    sh:path era:registeredCodedConditions ;
    sh:datatype xsd:string ;
    sh:severity sh:Violation ;
    sh:message "registeredCodedConditions (11.9.1): The value must be a string."@en .

# RegisteredManufacturingSerialNumber
era-sh:RegisteredManufacturingSerialNumber
    a sh:PropertyShape ;
    era:affectedClass era:VehicleRegistrationCheck ;
    era:affectedProperty era:registeredManufacturingSerialNumber ;
    era:scope "local" ;
    rdfs:comment "The manufacturing serial or series number as stated during the registration."@en ;
    era:evrIndex "5.2" ;
    sh:path era:registeredManufacturingSerialNumber ;
    sh:datatype xsd:string ;
    sh:severity sh:Violation ;
    sh:message "registeredManufacturingSerialNumber (5.2): The value must be a string."@en .

#########################################################
# VehicleSet
#########################################################

era-sh:VehicleSetShape
    a sh:NodeShape ;
    sh:targetClass era:VehicleSet ;
    sh:nodeKind sh:IRI ;
    sh:property era-sh:VehicleSetMember .

era-sh:VehicleSetMember
    a sh:PropertyShape ;
    era:affectedClass era:VehicleSet ;
    era:affectedProperty rdfs:member ;
    era:scope "local" ;
    rdfs:comment "A VehicleSet must contain at least one Vehicle."@en ;
    sh:path rdfs:member ;
    sh:nodeKind sh:IRI ;
    sh:class era:Vehicle ;
    sh:minCount 1 ;
    sh:severity sh:Violation ;
    sh:message "VehicleSet: The value must contain at least one rdfs:member pointing to a Vehicle."@en .


era-sh:BodyShape a sh:NodeShape ;
    sh:nodeKind sh:IRI ;
    sh:targetClass era:Body .

# faxNumber
era-sh:BodyShape sh:property era-sh-evr:FaxNumber .
era-sh-evr:FaxNumber a sh:PropertyShape ;
    era:affectedClass era:Body ;
    era:affectedProperty era:faxNumber ;
    era:scope "local" ;
    rdfs:comment "Fax number of a body."@en ;
    sh:path era:faxNumber ;
    sh:datatype xsd:string ;
    sh:severity sh:Violation ;
    sh:message "faxNumber: The value must be a string literal."@en .

era-sh:BodyShape sh:property era-sh-evr:FaxNumberCardinality .
era-sh-evr:FaxNumberCardinality a sh:PropertyShape ;
    era:affectedProperty era:faxNumber ;
    sh:path era:faxNumber ;
    sh:maxCount 1 ;
    sh:severity sh:Warning ;
    sh:message "faxNumber: There should be at most one value."@en .

