diff --git a/missions/avcl/SailorOverboard3.1.xml b/missions/avcl/SailorOverboard3.1.xml new file mode 100644 index 0000000000000000000000000000000000000000..646314f8bbaedad129edabcc1dbb3c27ee86e0e4 --- /dev/null +++ b/missions/avcl/SailorOverboard3.1.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<AVCL version="3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../schemas/AVCL.3.1.xsd"> + <head> + <meta name="title" content="SailorOverboard3.1.xml"/> + <meta name="description" content="AVCL mission to perform SAILOR OVERBOARD operations, carried out in concert with shipboard emergency procedures. Test mission for AVCL revision version 3.1."/> + <meta name="created" content="19 November 2019"/> + <meta name="modified" content="16 July 2022"/> + <meta name="creator" content="Don Brutzman"/> + <meta name="reference" content="https://wiki.nps.edu/display/NOW/Ethical+Control+of+Unmanned+Systems"/> + <meta name="Image" content="https://gitlab.nps.edu/Savage/EthicalControl/raw/master/missions/SailorOverboard8PhaseMission.png"/> + <meta name="generator" content="Altova XMLSpy, https://www.altova.com"/> + <meta name="generator" content="Apache NetBeans, https://netbeans.apache.org"/> + <meta name="generator" content="NPS Autonomous Unmanned Vehicle (AUV) Workbench, https://savage.nps.edu/AuvWorkbench"/> + <meta name="identifier" content="https://gitlab.nps.edu/Savage/EthicalControl/tree/master/missions/avcl/SailorOverboard3.1.xml"/> + <meta name="license" content="../license.html"/> + </head> + <body> + <UnitsOfMeasure distance="meters" angle="degrees" mass="kilograms" time="seconds"/> + <!-- TODO Vehicle vehicleName="RescueDrone" vehicleType="UAV" --> + <MissionAgenda description="Single unmanned air/surface vehicle actions to complement human response when performing “SAILOR OVERBOARD†operations, carried out in concert with shipboard emergency procedures. Multiple UAVs/USVs can be employed in parallel with ships/aircraft, each following mission orders."> + <LaunchPosition id="LaunchPosition" description="Ship position when robot is launched"> + <LatitudeLongitude latitude="0" longitude="0"/> + </LaunchPosition> + <RecoveryPosition id="RecoveryPosition" description="Ship position when ready to recover robot"> + <LatitudeLongitude latitude="0" longitude="0"/> + </RecoveryPosition> + <GoalList> + <Goal id="Goal1" title="Deploy, Launch" description="Sailor Overboard Immediate Action" phase="Launch" nextOnSuccess="Goal2" nextOnFailure="Goal7" nextOnException="Goal8"> + <Rendezvous description=""> + <TargetVehicleID value="101" description="Sailor in water"/> + </Rendezvous> + <Risk riskName="RE11.4.1_UnderstandingReasoningMethodsLimitations" mitigation="watchstander training" mandatory="true"/> + <OperatingArea> + <Point> + <LatitudeLongitude latitude="36.62" longitude="121.506"/> + <!--36°36′11″N 121°53′37″W--> + </Point> + </OperatingArea> + <Duration value="300"/> + <ReportingCriteria value="onCommence"/> + <ReportingCriteria value="periodic"/> + <ReportingCriteria value="statusChanged"/> + <ReportingCriteria value="onComplete"/> + </Goal> + <Goal id="Goal2" title="Rendezvous with Sailor" description="Go directly to best known location" phase="Locate" nextOnSuccess="Goal4" nextOnFailure="Goal3" nextOnException="Goal5"> + <Search datumType="point" requiredPD="0.5"> + <Target name="Sailor in water" id="SailorInWater"/> + </Search> + <Risk riskName="RE11.4.1_UnderstandingReasoningMethodsLimitations" mitigation="watchstander training" mandatory="true"/> + <OperatingArea> + <Point> + <LatitudeLongitude latitude="0" longitude="0"/> + </Point> + </OperatingArea> + <Duration value="6000"/> + </Goal> + <Goal id="Goal3" title="Search for Sailor " description="Sailor position not known, intermittent" phase="Locate" nextOnSuccess="Goal4" nextOnFailure="Goal5" nextOnException="Goal5"> + <MarkTarget description="TODO ensure beacon/pinger in water"> + <Marker type="dyeMarker"/> + <Target name="Sailor in water" id="SailorInWater2" description="TODO need refid to avoid duplicatess and have single reference"/> + </MarkTarget> + <Risk riskName="RE11.4.1_UnderstandingReasoningMethodsLimitations" mitigation="watchstander training" mandatory="true"/> + <OperatingArea> + <Point> + <LatitudeLongitude latitude="0" longitude="0"/> + </Point> + </OperatingArea> + <Duration value="6000"/> + </Goal> + <Goal id="Goal4" title="Track Sailor afloat until safe" description="Watch closely, not to interfere with rescue operations" phase="Track" nextOnSuccess="Goal5" nextOnFailure="Goal5" nextOnException="Goal5"> + <MonitorTransmissions xsi:type="monitorTransmissionsElementType" description="Track sailor in water"/> + <Risk riskName="RE11.4.1_UnderstandingReasoningMethodsLimitations" mitigation="watchstander training" mandatory="true"/> + <OperatingArea> + <Point> + <LatitudeLongitude latitude="0" longitude="0"/> + </Point> + </OperatingArea> + <Duration value="6000"/> + </Goal> + <Goal id="Goal5" title="Proceed to Recovery" description="Mission complete, prepare for pickup" phase="Mission Finish" nextOnSuccess="Goal6" nextOnFailure="Goal7" nextOnException="Goal8"> + <Reposition description="Return to ship or other recovery point"/> + <Risk riskName="RE11.4.1_UnderstandingReasoningMethodsLimitations" mitigation="watchstander training" mandatory="true"/> + <OperatingArea> + <Point> + <LatitudeLongitude latitude="0" longitude="0"/> + </Point> + </OperatingArea> + <Duration value="6000"/> + </Goal> + <Goal id="Goal6" title="Halt and prepare for recovery" phase="Recover Robot" description="Operations complete, final success state"> + <Rendezvous description=""> + <TargetVehicleID value="102" description="Recovery ship"/> + </Rendezvous> + <Risk riskName="RE11.4.1_UnderstandingReasoningMethodsLimitations" mitigation="watchstander training" mandatory="true"/> + <OperatingArea> + <Point> + <LatitudeLongitude latitude="0" longitude="0"/> + </Point> + </OperatingArea> + <Duration value="6000"/> + </Goal> + <Goal id="Goal7" title="Halt and deploy recovery beacon" phase="Recover Robot" description="Unable to continue, final failure state"> + <Rendezvous description=""> + <TargetVehicleID value="102" description="Recovery ship"/> + </Rendezvous> + <Risk riskName="RE11.4.1_UnderstandingReasoningMethodsLimitations" mitigation="watchstander training" mandatory="true"/> + <OperatingArea> + <Point> + <LatitudeLongitude latitude="0" longitude="0"/> + </Point> + </OperatingArea> + <Duration value="6000"/> + </Goal> + <Goal id="Goal8" title="Halt and await further orders" phase="Recover Robot" description="Unexpected problem, final exception state"> + <Rendezvous description=""> + <TargetVehicleID value="102" description="Recovery ship"/> + </Rendezvous> + <Risk riskName="RE11.4.1_UnderstandingReasoningMethodsLimitations" mitigation="watchstander training" mandatory="true"/> + <OperatingArea> + <Point> + <LatitudeLongitude latitude="0" longitude="0"/> + </Point> + </OperatingArea> + <Duration value="6000"/> + </Goal> + </GoalList> + </MissionAgenda> + </body> +</AVCL> \ No newline at end of file diff --git a/nbproject/project.xml b/nbproject/project.xml index 574d8e2cee8df8ff2c80174e332607117dcb3a13..39a57b80384a259505fe4eb7a47fc5580d38509c 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -47,6 +47,7 @@ auxiliary.show.customizer.message=<message> <word>SPARQL</word> <word>stylesheet</word> <word>stylesheets</word> + <word>TODO</word> <word>validatable</word> <word>warfighters</word> <word>XSLT</word> diff --git a/ontologies/DimensionsAutonomousDecisionMaking/DimensionsAutonomousDecisionMakingOntologyDesign.docx b/ontologies/DimensionsAutonomousDecisionMaking/DimensionsAutonomousDecisionMakingOntologyDesign.docx index 871cf74052c58654fe294cbf8ea82c540ffad036..30ee87b010beef635071299e077ded34d24f05cd 100644 Binary files a/ontologies/DimensionsAutonomousDecisionMaking/DimensionsAutonomousDecisionMakingOntologyDesign.docx and b/ontologies/DimensionsAutonomousDecisionMaking/DimensionsAutonomousDecisionMakingOntologyDesign.docx differ diff --git a/schemas/AVCL.3.1.changes.txt b/schemas/AVCL.3.1.changes.txt index c458942c980e10e9066a2f88b5361996d1b3e2de..6b32e137544bb79dd6a8201b0de13a9cbdcebf28 100644 --- a/schemas/AVCL.3.1.changes.txt +++ b/schemas/AVCL.3.1.changes.txt @@ -1,12 +1,29 @@ -AVCL Schema +AVCL Schema 3.1 Added Risk Elements as options for each Goal and GoalList Deprecations -- change AvoidArea to AvoidanceArea -- change MissionPreparation to MissionDefinition +- rename AvoidArea to AvoidanceArea +- rename MissionPreparation to MissionCommands -prior: +Changes to body +- moved: GeoOrigin from head to body +- rename AgendaMission to MissionAgenda +- rename MissionResults to MissionTelemetryLog +- rename GuidedMunitionMission to MissionGuidedMunition +- modified content model to include Location and Vehicle, TODO add them + +Can a Vehicle refer to a Mission and a Location (probably), or does a Mission refer to a Vehicle and a Location (probably not)? + +Does a Location solely contain GeoOrigin, or can GeoOrigin appear with a Mission? + +TODO Location can be point, line, area, or volume + +TODO MissionTelemetryLog contain optional TimeOffset, DisPduStream + +TODO MissionArchive can contain Vehicle+ Mission+ + +prior: AVCL Schema 3.0 TODO - AVCL/@vehicleName should not be required diff --git a/schemas/AVCL.3.1.xsd b/schemas/AVCL.3.1.xsd index a925a0a6f3e72dc7f5caa66cac9013c646dc2eef..1a437ec523746644230a0dc236cde64d4907fa1e 100644 --- a/schemas/AVCL.3.1.xsd +++ b/schemas/AVCL.3.1.xsd @@ -184,31 +184,10 @@ Change log, version 2.0: <xsd:documentation>AVCL language version</xsd:documentation> </xsd:annotation> </xsd:attribute> - <xsd:attribute name="vehicleName" type="xsd:string" use="optional"> - <xsd:annotation> - <xsd:documentation>Name of this vehicle model, e.g. Aries</xsd:documentation> - </xsd:annotation> - </xsd:attribute> - <xsd:attribute name="vehicleType" type="vehicleType" use="optional"> - <xsd:annotation> - <xsd:documentation>UAV, UGV, USV, or UUV, ROV, AGENDA, MUNITION, SSGN and UNKNOWN are supported vehicleType values.</xsd:documentation> - </xsd:annotation> - </xsd:attribute> - <xsd:attribute name="vehicleID" type="xsd:unsignedShort" use="optional" default="0"> - <xsd:annotation> - <xsd:documentation>integer ID number of vehicle, commonly used for DIS or virtual environment indexing</xsd:documentation> - </xsd:annotation> - </xsd:attribute> - <xsd:attribute name="date" type="xsd:date" use="optional"> - <xsd:annotation> - <xsd:documentation>Date of mission conduct</xsd:documentation> - </xsd:annotation> - </xsd:attribute> - <xsd:attributeGroup ref="CommonAttributes"/> </xsd:complexType> </xsd:element> <xsd:element name="Acknowledge" type="acknowledgeElementType"/> - <xsd:element name="AgendaMission" type="agendaMissionElementType"> + <xsd:element name="MissionAgenda" type="agendaMissionElementType"> <xsd:annotation> <xsd:documentation>Declarative strategic-level mission goals and constraints, suitable for robot mision planning to generate Waypoint lists and other executable script commands</xsd:documentation> </xsd:annotation> @@ -269,7 +248,58 @@ Change log, version 2.0: </xsd:annotation> </xsd:element> <xsd:element name="Beacon" type="stringElementType"/> - <xsd:element name="body" type="avclBodyType"/> + <xsd:element name="body"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="avclBodyType"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:sequence minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Mission</xsd:documentation> + </xsd:annotation> + <xsd:element ref="MissionAgenda" minOccurs="0"/> + <xsd:element ref="MissionCommands" minOccurs="0"/> + <xsd:element ref="MissionTelemetry" minOccurs="0"/> + <xsd:element ref="MissionArchive" minOccurs="0"/> + </xsd:sequence> + <xsd:element ref="GeoOrigin" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Defines a geographic origin for cartesian relative positions in this mission document.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element ref="OperatingArea" minOccurs="0"/> + <xsd:element name="TimeOffset" minOccurs="0"> + <xsd:complexType> + <xsd:attribute name="date" type="xsd:date" use="optional"> + <xsd:annotation> + <xsd:documentation>Date of mission conduct</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + <xsd:element ref="UnitsOfMeasure" minOccurs="0"/> + <xsd:element name="Vehicle" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>robot UAV UUV USV UGV</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:attribute name="vehicleType" type="vehicleType" use="optional"> + <xsd:annotation> + <xsd:documentation>UAV, UGV, USV, or UUV, ROV, AGENDA, MUNITION, SSGN and UNKNOWN are supported vehicleType values.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="vehicleID" type="xsd:unsignedShort" use="optional" default="0"> + <xsd:annotation> + <xsd:documentation>integer ID number of vehicle, commonly used for DIS or virtual environment indexing</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> <xsd:element name="BodyCoordinateVelocity" type="bodyCoordinateVelocityElementType"/> <xsd:element name="BodyThrusters" type="uuvBodyThrustersOrderElementType"/> <xsd:element name="BowLateralThruster" type="signedPercentElementType"/> @@ -427,7 +457,7 @@ Change log, version 2.0: </xsd:element> <xsd:element name="GpsFixes" type="positiveIntegerElementType"/> <xsd:element name="GroupAction" type="groupActionElementType"/> - <xsd:element name="GuidedMunitionMission" type="guidedMunitionMissionElementType"> + <xsd:element name="MissionGuidedMunition" type="guidedMunitionMissionElementType"> <xsd:annotation> <xsd:documentation>Imperative execution-level mission command script</xsd:documentation> </xsd:annotation> @@ -582,17 +612,22 @@ Change log, version 2.0: </xsd:annotation> </xsd:element> <xsd:element name="MissionAbort" type="noValueElementType"/> - <xsd:element name="MissionDefinition" type="missionPreparationElementType"> + <xsd:element name="MissionArchive"> <xsd:annotation> - <xsd:documentation>Mission definition in full detail</xsd:documentation> + <xsd:documentation>TODO complete package for a completed mission</xsd:documentation> </xsd:annotation> </xsd:element> - <xsd:element name="MissionPreparation" type="missionPreparationElementType"> + <xsd:element name="MissionCommands" type="missionCommandsElementType"> <xsd:annotation> - <xsd:documentation>Deprecated, replaced by MissionDefinition</xsd:documentation> + <xsd:documentation>Mission commands, meaning imperative orders</xsd:documentation> </xsd:annotation> </xsd:element> - <xsd:element name="MissionResults" type="missionResultsElementType"> + <xsd:element name="MissionPreparation" type="missionCommandsElementType"> + <xsd:annotation> + <xsd:documentation>Deprecated, replaced by MissionCommands</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="MissionTelemetry" type="MissionTelemetryElementType"> <xsd:annotation> <xsd:documentation>Mission telemetry data recorded in full detail</xsd:documentation> </xsd:annotation> @@ -644,6 +679,7 @@ Change log, version 2.0: <xsd:element name="OperatingArea" type="areaElementType"> <xsd:annotation> <xsd:documentation>Horizontal area for conducting mission-goal operations, with optional vertical constraints</xsd:documentation> + <!-- TODO review representations for point, line, area, or volume --> </xsd:annotation> </xsd:element> <xsd:element name="OperatingLimits" type="operatingLimitsElementType"/> @@ -1230,19 +1266,25 @@ Change log, version 2.0: <xsd:annotation> <xsd:documentation>Latitude values are represented by double precision values in the range [-90, 90] (positives are northern hemisphere).</xsd:documentation> </xsd:annotation> + <xsd:restriction base="xsd:string"/> + <!-- TODO regex validation <xsd:restriction base="xsd:double"> <xsd:minInclusive value="-90"/> <xsd:maxInclusive value="90"/> </xsd:restriction> + --> </xsd:simpleType> <xsd:simpleType name="longitudeType"> <xsd:annotation> <xsd:documentation>Longitude values are represented by double precision values in the range [-180, 180] (positives are eastern hemisphere).</xsd:documentation> </xsd:annotation> + <xsd:restriction base="xsd:string"/> + <!-- TODO regex validation <xsd:restriction base="xsd:double"> <xsd:minInclusive value="-180"/> <xsd:maxInclusive value="180"/> </xsd:restriction> + --> </xsd:simpleType> <xsd:simpleType name="markerType"> <xsd:annotation> @@ -1599,6 +1641,11 @@ Change log, version 2.0: <xsd:annotation> <xsd:documentation>Must have id attribute and contained elements, otherwise must have refid attribute</xsd:documentation> </xsd:annotation> + <xsd:element name="urlMap" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>url to relevant map, ampersands escaped as & in XML source files</xsd:documentation> + </xsd:annotation> + </xsd:element> <xsd:group ref="AreaElements"/> <xsd:group ref="VerticalBlockElements" minOccurs="0"/> </xsd:sequence> @@ -1624,14 +1671,6 @@ Change log, version 2.0: <xsd:annotation> <xsd:documentation>Container element for mission, state, communications, or planning data elements</xsd:documentation> </xsd:annotation> - <xsd:sequence> - <xsd:choice> - <xsd:element ref="MissionDefinition"/> - <xsd:element ref="MissionPreparation"/> - </xsd:choice> - <xsd:element ref="EventLog" minOccurs="0"/> - <xsd:element ref="MissionResults" minOccurs="0"/> - </xsd:sequence> </xsd:complexType> <xsd:complexType name="avclHeadType"> <xsd:annotation> @@ -1639,7 +1678,6 @@ Change log, version 2.0: </xsd:annotation> <xsd:sequence> <xsd:element ref="meta" minOccurs="0" maxOccurs="unbounded"/> - <xsd:element ref="GeoOrigin" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="avclMessageBodyType"> @@ -1876,9 +1914,13 @@ Change log, version 2.0: </xsd:annotation> <xsd:attribute name="name" type="xsd:string" use="required"/> <xsd:attribute name="content" type="xsd:string" use="optional"/> - <xsd:attribute name="description" type="xsd:string" use="optional"/> + <xsd:attribute name="description" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation>TODO reference?</xsd:documentation> + </xsd:annotation> + </xsd:attribute> </xsd:complexType> - <xsd:complexType name="missionPreparationElementType"> + <xsd:complexType name="missionCommandsElementType"> <xsd:annotation> <xsd:documentation>Contains mission configuration elements such as tasking, control coefficients, and units of measure.</xsd:documentation> </xsd:annotation> @@ -1890,7 +1932,7 @@ Change log, version 2.0: </xsd:sequence> <xsd:attributeGroup ref="CommonAttributes"/> </xsd:complexType> - <xsd:complexType name="missionResultsElementType"> + <xsd:complexType name="MissionTelemetryElementType"> <xsd:annotation> <xsd:documentation>Contains mission results elements such as telemetry, control orders, and weapon and sensor data.</xsd:documentation> </xsd:annotation> @@ -2211,7 +2253,7 @@ Change log, version 2.0: <xsd:annotation> <xsd:documentation>Defines units of measure used.</xsd:documentation> </xsd:annotation> - <xsd:attribute name="distance" use="required" fixed="meters"> + <xsd:attribute name="distance" type="distanceTypes" use="required"> <xsd:annotation> <xsd:documentation>Straight-line distance, default units are meters.</xsd:documentation> </xsd:annotation> @@ -2231,7 +2273,6 @@ Change log, version 2.0: <xsd:documentation>Time values, default units are seconds.</xsd:documentation> </xsd:annotation> </xsd:attribute> - <xsd:attributeGroup ref="CommonAttributes"/> </xsd:complexType> <xsd:complexType name="usvCharacteristicsElementType"> <xsd:annotation> @@ -2706,7 +2747,7 @@ Change log, version 2.0: <xsd:annotation> <xsd:documentation>Type for an element that will represent a geographic position as a latitude and longitude.</xsd:documentation> </xsd:annotation> - <xsd:attribute name="latitude" type="latitudeType" use="required"/> + <xsd:attribute name="latitude" type="longitudeType" use="required"/> <xsd:attribute name="longitude" type="longitudeType" use="required"/> <xsd:attributeGroup ref="CommonAttributes"/> </xsd:complexType> @@ -3954,8 +3995,8 @@ Change log, version 2.0: <xsd:element ref="UGVCommandScript"/> <xsd:element ref="USVCommandScript"/> <xsd:element ref="UUVCommandScript"/> - <xsd:element ref="AgendaMission"/> - <xsd:element ref="GuidedMunitionMission"/> + <xsd:element ref="MissionAgenda"/> + <xsd:element ref="MissionGuidedMunition"/> </xsd:choice> </xsd:group> <xsd:group name="RotaryWingUAVControlOrders"> @@ -4016,13 +4057,22 @@ Change log, version 2.0: <xsd:documentation>Considerations made and actions taken by mission commander to mitigate risk</xsd:documentation> </xsd:annotation> </xsd:attribute> - <xsd:attribute name="mandatory" default="false" type="xsd:boolean" use="optional"> + <xsd:attribute name="mandatory" type="xsd:boolean" use="optional" default="false"> <xsd:annotation> <xsd:documentation>whether mitgation is mandatory. TODO superfluous?</xsd:documentation> </xsd:annotation> </xsd:attribute> <xsd:attributeGroup ref="CommonAttributes"/> </xsd:complexType> + <xsd:simpleType name="distanceTypes"> + <xsd:annotation> + <xsd:documentation>DADM Risk Elements</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="meters"/> + <xsd:enumeration value="yards"/> + </xsd:restriction> + </xsd:simpleType> <!-- autogenerated dadmRiskElementType enumeration --> <xsd:simpleType name="dadmRiskElementNames"> <xsd:annotation> diff --git a/stylesheets/MeoDadmRiskElementsToHtmlTable.xslt b/stylesheets/MeoDadmRiskElementsToHtmlTable.xslt new file mode 100644 index 0000000000000000000000000000000000000000..9ba92ed542643f699f822f1719f6edbd89993385 --- /dev/null +++ b/stylesheets/MeoDadmRiskElementsToHtmlTable.xslt @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + <head> + <meta name="filename" content="MeoDadmNamingVerification.xslt" /> + <meta name="author" content="Don Brutzman" /> + <meta name="created" content="8 May 2022" /> + <meta name="description" content="XSLT stylesheet to check naming constraints of Dimensions Autonomous Decision Making (DADM) triples." /> + <meta name="url" content="EthicalControl/stylesheets/MeoDadmNamingVerification.xslt" /> + <meta name="invocation" content="EthicalControl> ant MeoDadmNamingVerification" /> + </head> +--> +<xsl:stylesheet version="2.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:owl="http://www.w3.org/2002/07/owl#"> + + <xsl:output method="text" encoding="UTF-8" indent="yes" media-type="text/plain" omit-xml-declaration="yes"/> + <xsl:strip-space elements="*"/> + + <xsl:variable name='indent'> <xsl:text> </xsl:text></xsl:variable> + <xsl:variable name='missing'><xsl:text>(missing)</xsl:text></xsl:variable> + + <xsl:template match="/"> + <!-- begin processing at root of OWL document containing Dimensions of Autonomous Decision Making (DADM) + constructs, currently as part of Mission Execution Ontology (MEO) --> + + <xsl:message> + <xsl:text>MeoDadmNamingVerification.xslt checks for MEO DADM .owl ontology:</xsl:text> + <xsl:text> </xsl:text> + <xsl:text>- naming conventions for DADM and Risk Element (RE) classes</xsl:text> + <xsl:text> </xsl:text> + <xsl:text>- rdfs:label short names match, corresponding to truncation prefix of longer name</xsl:text> + <xsl:text> </xsl:text> + <xsl:text>- owl:versionInfo includes relevant page number(s) in master DADM document</xsl:text> + <xsl:text> </xsl:text> + <xsl:text>- rdfs:comment includes description of categories and risk elements</xsl:text> + <xsl:text> </xsl:text> + <xsl:text>- TODO check and avoid duplication errors</xsl:text> + <xsl:text> </xsl:text> + </xsl:message> + + <xsl:apply-templates select="//*[contains(local-name(),'Class')][starts-with(@IRI,'#DimensionsAutonomousDecisionMaking')]"/> + + <xsl:apply-templates select="//*[contains(local-name(),'Class')][starts-with(@IRI,'#DADM') or starts-with(@IRI,'#RE')]"><!-- depth-first search recurse downward --> + <xsl:sort select="translate(@IRI,'.','')"/> + </xsl:apply-templates> + + </xsl:template> + + <xsl:template match="owl:Class"> + + <!-- <xsl:if test="not(position()=1)"> + <xsl:text> </xsl:text> + <xsl:text>; </xsl:text> + </xsl:if> --> + <xsl:variable name='className' select='local-name()'/> + <xsl:variable name='IRI' select='@IRI'/> + + <xsl:if test="not(preceding::*/@IRI = $IRI)"> + <xsl:value-of select="local-name()"/> + <xsl:text> IRI='</xsl:text> + <xsl:value-of select="@IRI"/> + <xsl:text>'</xsl:text> + <xsl:text> </xsl:text> + + <xsl:variable name="subClassOf"> + <xsl:choose> + <xsl:when test="(@IRI = '#DimensionsAutonomousDecisionMaking')"> + <xsl:text>(DADM is a top-level class, not a subclass)</xsl:text> + </xsl:when> + <xsl:when test="//owl:SubClassOf[owl:Class[1][@IRI = $IRI]]"> + <xsl:value-of select="//owl:SubClassOf[owl:Class[1][@IRI = $IRI]]/owl:Class[2][not(@IRI = $IRI)]/@IRI"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select='$missing'/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="not($className = '#DADM_DimensionsAutonomousDecisionMaking')"> + <xsl:value-of select='$indent'/> + <xsl:text> owl:subClassOf </xsl:text> + <xsl:value-of select='$subClassOf'/> + <xsl:text> </xsl:text> + </xsl:if> + + <xsl:variable name="annotationRdfsLabel"> + <xsl:choose> + <xsl:when test="( count(//owl:AnnotationAssertion[owl:AnnotationProperty[@abbreviatedIRI = 'rdfs:label']][owl:IRI/. = $IRI]/owl:Literal) > 0)"> + <xsl:value-of select="//owl:AnnotationAssertion[owl:AnnotationProperty[@abbreviatedIRI = 'rdfs:label']][owl:IRI/. = $IRI]/owl:Literal"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select='$missing'/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select='$indent'/> + <xsl:text> rdfs:label </xsl:text> + <xsl:value-of select='$annotationRdfsLabel'/> + <xsl:choose> + <xsl:when test="not($annotationRdfsLabel = $missing) and ($IRI = concat('#',$annotationRdfsLabel))"> + <xsl:text> *** error, IRI </xsl:text> + <xsl:value-of select="$IRI"/> + <xsl:text> identical to rdfs:label </xsl:text> + <xsl:value-of select="$annotationRdfsLabel"/> + <xsl:text>, expected more-descriptive label</xsl:text> + <xsl:text> ***</xsl:text> + </xsl:when> + <xsl:when test="not($annotationRdfsLabel = $missing) and (string-length($IRI) > string-length($annotationRdfsLabel) + 1)"> + <xsl:text> *** error, IRI </xsl:text> + <xsl:value-of select="$IRI"/> + <xsl:text> is longer than rdfs:label </xsl:text> + <xsl:value-of select="$annotationRdfsLabel"/> + <xsl:text>, instead expected more-descriptive label</xsl:text> + <xsl:text> ***</xsl:text> + </xsl:when> + <xsl:when test="not($annotationRdfsLabel = $missing) and not($IRI = '#DADM') and not(starts-with(concat('#',$annotationRdfsLabel),$IRI))"> + <xsl:text> *** error, mismatch with IRI</xsl:text> + <xsl:if test="starts-with($IRI,'#') and contains($IRI,'_')"> + <xsl:text>, expected </xsl:text> + <xsl:value-of select="substring-before(substring-after($IRI,'#'),'_')"/> + </xsl:if> + <xsl:text> ***</xsl:text> + </xsl:when> + <xsl:when test="($annotationRdfsLabel = $missing)"> + <xsl:if test="starts-with($IRI,'#') and contains($IRI,'_')"> + <xsl:text>, expected </xsl:text> + <xsl:value-of select="substring-before(substring-after($IRI,'#'),'_')"/> + </xsl:if> + </xsl:when> + </xsl:choose> + + <xsl:text> </xsl:text> + + <xsl:variable name="annotationVersionInfo"> + <xsl:choose> + <xsl:when test="( count(//owl:AnnotationAssertion[owl:AnnotationProperty[@abbreviatedIRI = 'owl:versionInfo']][owl:IRI/. = $IRI]/owl:Literal) = 1)"> + <xsl:value-of select="//owl:AnnotationAssertion[owl:AnnotationProperty[@abbreviatedIRI = 'owl:versionInfo']][owl:IRI/. = $IRI]/owl:Literal"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select='$missing'/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select='$indent'/> + <xsl:text> owl:versionInfo </xsl:text> + <xsl:value-of select='$annotationVersionInfo'/> + <xsl:if test="not($annotationVersionInfo = $missing) and not(@IRI = '#DimensionsAutonomousDecisionMaking') and + not(starts-with($annotationVersionInfo,'page ') or starts-with($annotationVersionInfo,'pages '))"> + <xsl:text> *** error, incorrect page number(s) ***</xsl:text> + </xsl:if> + <xsl:text> </xsl:text> + + <xsl:variable name="annotationDescription"> + <xsl:choose> + <xsl:when test="( count(//owl:AnnotationAssertion[owl:AnnotationProperty[@abbreviatedIRI = 'rdfs:comment']][owl:IRI/. = $IRI]/owl:Literal) = 1)"> + <xsl:value-of select="//owl:AnnotationAssertion[owl:AnnotationProperty[@abbreviatedIRI = 'rdfs:comment']][owl:IRI/. = $IRI]/owl:Literal"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select='$missing'/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select='$indent'/> + <xsl:text> rdfs:comment "</xsl:text> + <xsl:value-of select='$annotationDescription'/> + <xsl:text>"</xsl:text> + <xsl:if test="($annotationDescription = $missing) or (string-length($annotationDescription) = 0)"> + <xsl:text> </xsl:text> + <xsl:text> *** error, missing rdfs:comment description ***</xsl:text> + </xsl:if> + <xsl:if test="contains($annotationDescription ,'`')"> + <xsl:text> </xsl:text> + <xsl:text> *** error, replace back-apostrophe ` with apostrophe ' ***</xsl:text> + </xsl:if> + <xsl:if test="contains($annotationDescription ,'“')"> + <xsl:text> </xsl:text> + <xsl:text> *** error, replace left-quote “ with quotation mark " ***</xsl:text> + </xsl:if> + <xsl:if test="contains($annotationDescription ,'â€')"> + <xsl:text> </xsl:text> + <xsl:text> *** error, replace right-quote †with quotation mark " ***</xsl:text> + </xsl:if> + <xsl:if test="contains($annotationDescription ,'—')"> + <xsl:text> </xsl:text> + <xsl:text> *** error, replace m-dash — with hyphen - ***</xsl:text> + </xsl:if> + <xsl:if test="contains($annotationDescription ,'�?')"> + <xsl:text> </xsl:text> + <xsl:text> *** error, replace special character �? ***</xsl:text> + </xsl:if> + + <xsl:text> </xsl:text> + <xsl:text> </xsl:text> + </xsl:if> + + </xsl:template> + +</xsl:stylesheet> +