Class S127MarineServicesRules
- Namespace
- EncDotNet.S100.Datasets.S127.Validation
- Assembly
- EncDotNet.S100.Datasets.S127.dll
The default ValidationRuleSet<TModel> of normative rules
for an S-127 S127MarineServicesDataset. Rule identifiers
follow the convention S127-R-{clause}, where {clause}
traces to the relevant section of the S-127 Edition 2.0.0 Product
Specification.
public static class S127MarineServicesRules
- Inheritance
-
S127MarineServicesRules
- Inherited Members
Remarks
The pilot rule set focuses on Tier-1 (schema-shape) and Tier-2
(spec-semantic) rules that can be evaluated against a single typed
S127MarineServicesDataset in isolation. Tier-3
cross-dataset rules (for example, validating that a
VesselTrafficService-area report point falls within charted
waters in a loaded S-101 dataset) will be added in a follow-up once
the cross-dataset validation surface is wired up — they need access
to sibling datasets via Services.
Two candidates from the initial design pass were intentionally
dropped, mirroring the deferred-rule reasoning in
EncDotNet.S100.Datasets.S421.Validation.S421RoutePlanRules:
-
VTS report-point geometry —
VesselTrafficServiceAreafeatures may reference report points viaxlink:hrefto other features. The typed projection only resolves thetheAuthoritybinding today; the other xlinks remain onSource.FeatureReferencesand would need a cross-feature resolution pass to validate, so this rule is deferred. -
Closed enumeration validity for attributes such as
categoryOfService— most S-127 category codes are carried inExtraAttributesas opaque strings rather than being broken out as typed enums on the projection. Validating a closed enumeration off such a loose surface would be brittle (false positives on values the FC permits but the rule has not been updated for), so this is deferred pending a typed enum surface for the relevant attributes.
Properties
AuthorityNamePresent
S127-R-12.8 — S127Authority features should
carry a non-empty authorityName.
public static IValidationRule<S127MarineServicesDataset> AuthorityNamePresent { get; }
Property Value
Remarks
Spec reference: S-127 Edition 2.0.0 §12 — an Authority
without a name has no human-readable identity and is of little
use when bound from a service via the theAuthority
xlink. Emitted as a warning (not an error) because the FC does
not strictly require the attribute; the projection tolerates
its absence.
CurveMinimumVertices
S127-R-12.4 — Curve geometries must have at least two
vertices.
public static IValidationRule<S127MarineServicesDataset> CurveMinimumVertices { get; }
Property Value
Remarks
Spec reference: S-100 Part 10b §6 — a GML curve is encoded as a
LineString with at least two pos elements. A
single-point "curve" has no defined direction and cannot be
portrayed as a line.
Default
The canonical default rule set for S-127 marine resources and services datasets.
public static ValidationRuleSet<S127MarineServicesDataset> Default { get; }
Property Value
PilotBoardingPlaceHasGeometry
S127-R-12.2 — Every S127PilotBoardingPlace
feature must carry a non-empty point or surface geometry.
public static IValidationRule<S127MarineServicesDataset> PilotBoardingPlaceHasGeometry { get; }
Property Value
Remarks
Spec reference: S-127 Edition 2.0.0 §12 — PilotBoardingPlace
is a geographic feature whose spatial association is
mandatory; a pilot boarding place without coordinates has no
charted location and cannot be portrayed. Container-style
features (such as S127Authority) deliberately
carry no geometry and are out of scope for this rule.
ServiceHoursValidity
S127-R-12.6 — Service-hours availability ranges must be
monotonic: when a complex attribute exposes a time-of-day pair
(timeOfDayStart / timeOfDayEnd) or a date pair
(dateStart / dateEnd), the start must not be
strictly after the end.
public static IValidationRule<S127MarineServicesDataset> ServiceHoursValidity { get; }
Property Value
Remarks
Spec reference: S-127 Edition 2.0.0 §12 — the availability
(and related scheduling) complex attribute carries the periods
during which a service is offered. An inverted range cannot be
interpreted unambiguously and is almost always an authoring
mistake. Values that are absent or unparseable are skipped
silently; the rule only fires when both endpoints parse and the
start is strictly after the end. Times are compared on
TimeSpan; dates on DateOnly.
SurfacePolygonClosure
S127-R-12.3 — Surface geometries must form a closed
polygon: at least four vertices, with the first and last
coincident.
public static IValidationRule<S127MarineServicesDataset> SurfacePolygonClosure { get; }
Property Value
Remarks
Spec reference: S-100 Part 10b §6 — surface exterior rings are
GML LinearRings and must be topologically closed. The
minimum-of-four-vertices rule is the canonical GML linear-ring
cardinality (three distinct corners plus a repeat of the start).
Closure is tested with a tight tolerance (1e-9 degrees, about
0.1 mm at the equator) so ordinary floating-point round-trip
does not trigger the rule.
UniqueFeatureIds
S127-R-12.7 — Feature identifiers must be unique within
a dataset.
public static IValidationRule<S127MarineServicesDataset> UniqueFeatureIds { get; }
Property Value
Remarks
Spec reference: S-100 Part 10b §6 (GML encoding) — gml:id
is an XML ID and must be unique within the GML document. The
typed projection groups duplicates during a case-insensitive
pass; this rule surfaces them to callers (and protects against
upstream producers that emit non-unique IDs).
VesselSizeLimitsMonotonic
S127-R-12.5 — When a feature carries both a minimum and
maximum vessel size limit (length / draught / beam), the
minimum must not exceed the maximum.
public static IValidationRule<S127MarineServicesDataset> VesselSizeLimitsMonotonic { get; }
Property Value
Remarks
Spec reference: S-127 Edition 2.0.0 §12 — the vessel-dimension
envelope attributes (minimumVesselsLength /
maximumVesselsLength, and the corresponding draught and
beam pairs) describe the range of vessels eligible for, or
regulated by, a service area. A min greater than max inverts
the envelope. Attributes that are absent or unparseable are
skipped silently; this rule only fires on a sane-but-inverted
pairing.
WgsLatLonInRange
S127-R-12.1 — Every feature's geometry coordinates must
lie within the WGS-84 ranges: latitude in [-90, +90] and
longitude in [-180, +180].
public static IValidationRule<S127MarineServicesDataset> WgsLatLonInRange { get; }
Property Value
Remarks
Spec reference: S-100 Part 10b §6.2 — geographic coordinates for
EPSG:4326 are bounded; S-127 Edition 2.0.0 inherits this
CRS. Container-style features without geometry (for example
S127Authority) carry an empty
Coordinates array and therefore
trivially pass this rule.
Methods
Validate(S127MarineServicesDataset, ValidationContext?)
Convenience wrapper around Run(TModel, ValidationContext?) using the Default rule set.
public static ValidationReport Validate(S127MarineServicesDataset dataset, ValidationContext? context = null)
Parameters
datasetS127MarineServicesDatasetcontextValidationContext