Ontological Ship Behavior Modeling Based on COLREGs for Knowledge Reasoning

: Formal expression of ship behavior is the basis for developing autonomous navigation systems, which supports the scene recognition, the intention inference, and the rule-compliant actions of the systems. The Convention on the International Regulations for Preventing Collisions at Sea (COLREGs) offers experience-based expressions of ship behavior for human beings, helping the humans recognize the scene, infer the intention, and choose rule-compliant actions. However, it is still a challenge to teach a machine to interpret the COLREGs. This paper proposed an ontological ship behavior model based on the COLREGs using knowledge graph techniques, which aims at helping the machine interpret the COLREGs rules. In this paper, the ship is seen as a temporal-spatial object and its behavior is described as the change of object elements in time spatial scales by using Resource Description Framework (RDF), function mapping, and set expression methods. To demonstrate the proposed method, the Narrow Channel article (Rule 9) from COLREGs is introduced, and the ship objects and the ship behavior expression based on Rule 9 are shown. In brief, this paper lays a theoretical foundation for further constructing the ship behavior knowledge graph from COLREGs, which is helpful for the complete machine reasoning of ship behavior knowledge in the future.


Introduction
Ship behavior refers to the movement of the ship in response to the traffic situation, which usually reflects the intention of the officer on watch (OOW) at present and influences the trajectory of the ship in the future.Hence, the recognition of ship behavior is the key to judging the intention of the OOW and predicting the movement of ships in dangerous encounters, which benefits the safety and efficiency of autonomous navigation and traffic management [1].From the perspective of traffic management, the vessel traffic service operators (VTSO) need to judge the development of the situation based on the analysis of the ship behavior and identify the near-miss as early as possible; from the perspective of ship navigation, the OOW or intelligent systems need to infer the intention of other ships and predict their trajectories based on the observed ship behavior before taking evasive actions [2].In brief, to improve the intelligence level of VTS and ships, the study of ship behavior has become an essential topic.
In order to help the machine understands the behavior of the ship based on COLREGs, the techniques from the knowledge graph are introduced and the methodology of ontological ship behavior modeling is developed by using Resource Description Framework (RDF), function mapping, and set expression methods.The concept of ship object and ship behavior described in COLREGs rules are incorporated in the proposed method.The ship is seen as a temporal-spatial object containing attribute elements and relational elements; the behavior, then, is described as the changes of the elements in timespatial scales.Based on these techniques, the proposed method can be used to identify the intentions of the ships and their violation behavior, which has the potential of improving the autonomy level of the ships and decision support system in VTS.
In summary, the main contribution of this paper is developing a knowledge model of ship behavior according to the rules from COLREGs, which could be used to realize ship behavior knowledge expression in the machine.The rest of this paper is organized as follows: the studies on ship behavior modeling are overviewed in Section 2; Section 3 introduces the definitions of ship objects, attribute elements, and relational elements, followed by a conceptual model of ship behavior and the formal expression of ship behaviors according to the COLREGs in Section 4; case studies, discussion, and conclusions are addressed in Sections 5-7, respectively.

Literature Review
Studies on ship behavior modeling fall into the following two categories: data-driven behavior modeling and knowledge-driven behavior modeling.In addition, due to the recent focus on rule-compliant collision avoidance, many researchers studied ship behavior in encounters, which are also overviewed.

Data-Driven Behavior Modelling
Data-driven behavior modeling usually utilizes ship trajectory data to learn the ship's behavior.A group of researchers proposed to learn the characteristics of ship behavior from traffic data from a certain region and use the characteristics to predict the trajectory of the ship in the future [3].Specifically, researchers obtained ship motion trajectories from AIS data [4], analyzed characteristics of trajectory [5], and concluded the distribution of ship state in history that reflects the characteristics of ship behavior [6].The characteristics of ship behavior, then, are used to predict the trajectories of the ships.Some typical methods to predict the trajectory are Kalman filter [7], Long Short-Term Memory Neural Network (LSTM) [8], Bayesian networks [9], backpropagation neural network (BP) [10], etc.Some researchers focus on the identification of abnormal behavior of ships by learning historical trajectory data.Patroumpas et al. [11] designed a method to identify the flow of ship events through AIS data, and on this basis, performed cognitive inferences on abnormal behavior of ships.Zouaoui et al. [12] introduced the Hidden Markov model and formal language for analyzing the ship movement data in the harbor to get the normal ship behavior and abnormal ship behavior.Lei et al. [13] proposed the MT-MAD framework, which can automatically detect abnormal behavior based on the evaluation of the ship's historical sub-trajectory data, and defines the ship's activity space, behavior sequence, and behavior characteristics.
Another group of researchers concentrates on ship behavior prediction.Zissis et al. [14] used machine learning, especially artificial neural networks, as a tool to increase the predictive ability of ship behavior.The developed systems can learn and accurately predict in real-time the future behavior of any ship, in a relatively low computing time, which can be used as the basis of prediction for various intelligent systems, e.g., ship collision prevention, ship route planning, ship operation, etc. Perera et al. [15] proposed a ship behavior recognition module in autonomous ships using historical ship trajectory data, which is also used to predict ship trajectory in the future.
In short, the data-driven ship behavior model is usually based on the observed traffic data, e.g., AIS data, etc., which are used to predict the trajectories of ships based on the characteristics of the majority and identify "abnormal behaviors" that are different from the majority.However, it is not easy for these models to infer the behavior of the ship that is rule-compliant or not (i.e., reasoning the knowledge of ship behavior).In particular, the machine lacks knowledge about rule-compliant behavior.

Knowledge-Driven Behavior Modeling
Knowledge-driven behavior modeling accepts that the ship cannot move freely but follows certain regulations/rules (i.e., prior knowledge).Thus, researchers intend to gain knowledge of ship behavior from semantic knowledge.Expert systems [16], expression logic [17], semantic network [18], the Resource Description Framework (RDF) [19], ontology [20], etc. are popular methods to construct knowledge and realize knowledge reasoning.
The semantic network is a popular tool to describe ship behavior in recent years.The information loss is inevitable when the researchers use trajectory data only for recognizing ship behavior [21]; thus, some researchers tried to enrich the semantic information of the trajectory.Parent et al. [22] proposed the semantic modeling method and defined the semantic model of the ship trajectory.
In addition, the ontology model of ship behavior becomes popular, which can realize knowledge expression for machines.Nogueira et al. [23] used ontology tools to combine the ship's trajectory motion characteristics, such as velocity and acceleration, to express the ship's trajectory.Lamprecht et al. [24] used the ontology's knowledge organization ability and reasoning function to realize the cognition of the conceptual modeling of ship behavior.Wen et al. [25] introduced a dynamic Bayesian network, combined with a semantic network to carry out dynamic uncertainty reasoning and knowledge expression of ship behavior in port waters.Huang et al. [26] combined machine learning and semantic behavior for pattern recognition.Adibi et al. [27] predicted ship behavior, analyzed and discovered ship behavior at the semantic level, and improved maritime supervisors' understanding of water traffic.However, these semantic models lack consideration of the influence of environmental disturbance and do not fully consider the constraints of COLREGs on ship behavior.
The knowledge-driven approach presents tools to model behaviors for behavior inference.The reasoning process uses techniques such as rule-based systems, case-based reasoning, and ontological reasoning to produce activity models.Knowledge-driven approaches can represent the context of the environments at multiple levels of abstraction to create generalized and personalized behavior modeling.In particular, ontologies have been widely used to represent semantic concepts and their relationships in a structural manner.Advantages of ontologies include the ability to express knowledge in a clearly organized and structured manner, machine-readable expression, and the expressive power to support the reasoning process.

Behavior Modeling of COLREGs
To our best knowledge, traditional methods basically considered some key rules from COLREGs and designed the rule-based expert system that helps the machine to recognize the traffic scene and apply certain reaction rules [28].
Some researchers use a question-and-answer method to construct an expert system of ship collision avoidance and give an avoidance plan in the form of question and answer.Others focus on quantifying the COLREGs rules.Many descriptions from COLREGs are ambiguous, vague, and unquantified, which made them difficult for the machine to use in practice.Thus, many researchers proposed quantification methods that quantified the conditions for each encounter [29] (e.g., heading, crossing, and overtaking) and addressed the link between encounters conditions and reaction rules with the help of captains and fuzzy theory [30].Xu et al. [31] clarified the concepts of "head-on ship", "give-way ship", "overtaking", "crossing" and "heading" according to COLREGs, set up a corresponding reward function for each concept and designed the reward function.In the deep learning algorithm, the optimal collision-avoidance strategy is finally obtained.He et al. [32] put forward the COLREGs quantitative model by combining the ship domain model and the ship heading control system based on the four-stage theory of the ship encounter process.Eriksen H et al. [33] introduced a three-layer hybrid collision-avoidance (COLAV) system for surface unmanned boats, which complies with Articles 8 and 13 to 17 of the COLREGs.The performance of the COLAV system is tested by numerical simulations of three different challenge scenarios (i.e., heading, crossing, and overtaking).
These studies can be used to develop the MASS that follows the rules inputted by developers, but it is challenging to enumerate all the possible scenarios and reaction rules.To develop a practical rule-compliant ship, the developers need to enumerate the scenes that one ship might encounter and design the reaction rules.However, it is almost impossible to address all the scenes one ship might encounter.Thus, adding additional reaction rules become necessary.For example, in a crossing encounter, one ship that is on the portside of another ship is usually seen as a "give-way" ship, whereas if the first ship is a fishing ship, the ship becomes the "stand-on" ship.To handle this exception, additional reaction rules would be needed, which address the special arrangements when the ship encounters fishing ships.However, it is hard to list the endless exceptions.
In this paper, we propose another way to handle this issue.Instead of humans adding patches for exceptions, we proposed the ontological knowledge model helping the machine to deconstruct the conditions and reactions, extract the common concepts, and define the relationships among concepts.With the help of the ontological model, the machine not only can perform the reactions based on the explicit rules but also can infer the implicit rules, i.e., interpretation of rules from COLREGs.It offers a new line of thought to develop a rule-complaint MASS.

Conceptual Modeling of Ship Object from COLREGs
The COLREGs, formulated by the International Maritime Organization (IMO), define different types of ships, different scenes one ship might encounter, and obligations of the ship in these scenes [34].The ship is the core concept, and the formal expression (i.e., formulaic and structured expression) of the ship object introduced in this section is a prerequisite for the machine to understand the ship behavior described by COLREGs.

Conceptual Modeling of Ship Object
Ships usually have many spatiotemporal characteristics, e.g., velocity, course, position, etc., which implies that the ship is a spatiotemporal object.Thus, in this paper, the ship object is defined as Definition 1: Definition 1. Ship object is a spatiotemporal object with the characteristics in time and space scales, which can be expressed in the form of data, models, rules, logic, or knowledge by computers in cyberspace.
In general, one ship has many characteristics helping us to distinguish one ship from another ship, and these characteristics are usually named as an "attribute" of the ship.By the type and values of the attributes, one can distinguish the ship from different objects.
Among these attributes, the attributes that describe the characteristics of the ship independent from the surrounding objects, e.g., the ship name, position, velocity, types, etc., are named as "attribute elements" in this paper, whereas other attributes rely on surrounding objects to express its characteristics, e.g., the bearing of objects, relative distance between objects and the relative speed, etc., are named as "relational elements".The formal definitions of attribute elements and relational elements are shown as Definition 2 and Definition 3: Definition 2. The ship's attribute elements are the expression of the specific characteristics of the ship object that are independent of other objects., e.g., ship name, velocity, course, flag state, etc. Definition 3. Ship's relational elements are to describe the association relationship between objects (e.g., ship objects and environment objects), e.g., relative velocity, relative heading, relative location between the ship and the environment or between one ship and another ship, etc.
In order to facilitate the understanding of the definitions in the paper, we have made Figure 1 to show that the entities (e.g., ships, channels, etc.) in the physical space are extracted and modeled in cyberspace, named as objects.Each object has attribute elements and relational elements that help us distinguish one from another.These elements might vary as time moves on, such as the course, the velocity of ship A, the relative distance, and relative bearing from ti−1 to ti+1.According to Definitions 1-3, the ship object has attribute elements and relational elements that might vary as time moves on or with the changes of positions.For instance, in an encounter scenario, relational elements (e.g., relative distance) of the ship would change as time moves on; in a curved channel, attribute elements (e.g., course) of the ship will be diverse according to the curvature of the channel.In brief, the values of attribute elements and relational elements have a time or spatial "stamp".Thus, each ship object can be expressed in the form of a triple-element model: where shipObject represents the ship object, Attribute elements represents the attribute elements of objects, Relational elements represent the relational elements of objects, and Time_Space represents the time and space scales.
Each element of the ship object can be formally expressed by a cell containing "Type", "Value", and "t", named as "Object.parameter"and defined as: . ( , , ) , ( ) where Object.parameterrepresents the smallest unit describing the elements of the specific ship object (say "Object"), "Type" represents the type of attribute elements or relational elements of the specific ship object; "Value" represents the value of the "Type", and t represents the moment when the"Type"has the "Value".
Based on these definitions, all characteristics of one object (with attribute elements and relational elements) can be collected in a set of the Object.Parameter, i.e., Example 1.Take the scene in Figure 1. as an example.The Parameter of ship A can be expressed as formula as:

Attribute Elements
According to COLREGs, the ship object has various attribute elements, and these attribute elements might influence the role of the ship and its obligations in a certain traffic scene.According to the feature of these elements, attribute elements can be categorized into two types, namely static attribute elements and dynamic attribute elements, see Figure 2.
The static attribute elements describe the attributes that are usually relatively invariant, such as ship name, ship type, ship size, etc., while the dynamic attribute elements are the attributes that might change over time, such as the ship's position, heading, velocity, ship's draft, etc.

Relational Elements
According to COLREGs and Definition 2, the ship also has many relational elements; some relational elements, such as the position and relative distance between two ships, can be used to determine the encounter scene of the two ships (overtaking, crossing, and heading scenes).Additionally, the obligation of one ship might change as the relational element changes.For example, when two ships are in a crossing scene, one of the ships has the obligation to give way to the other ship.When the two ships pass by, this obligation is relieved.
The relational elements between objects are categorized into three types, namely, spatial relations, temporal relations, and semantic relations.
(1) Spatial relational elements The spatial relations among the objects in COLREGs include topological, bearing, and distance relations.The regional link calculus model [35] has been introduced to describe the topological relation between objects, e.g., ship object-ship object, ship objectarea object, and area object-area object.The topological relation includes separation, inclusion, intersection, coincidence, inscribed, and circumscribed, which are shown in Figure 3a-f.
According to the statement from the COLREGs, the topological relation between two ship objects includes separation and circumscribe.The topological relation between one ship object and one area object includes the following four types: separation, inclusion, inscribed, circumscribe, and intersection.The topological relation between two area objects includes the following six types: separation, inclusion, inscribed, circumscribed, intersection and coincidence.The bearing relation mainly describes the relative bearing between two ships.This paper constructs the ship coordinate system, which forms four directional regions by the intersection of the ship's headline and the ship's transverse line.For example, the coordinate system of ship A and ship B is shown in Figure 4. Ship B is in front of the starboard transverse 45° of ship A, while ship A is in front of the port side transverse 30° of ship B. The distance relation describes the distance between two ship objects, including quantitative expression and qualitative expression.
The quantitative expression refers to the Euclidean distance between two ship objects, as shown in Equation ( 6).

(( ) (
) ) where D represents the distance between ship A and ship B, (xA,yA), (xB,yB) represents the position coordinates of ship A and ship B.
According to COLREGs (Rule 7, Rule 8, Rule 13, Rule 15), the relative distance is divided into the following four stages: safety distance, urgent situation, risk of collision, and collision.The criteria for dividing these stages are depending on the encounter scenes.For the readers interested in the studies on the quantitative analysis of these criteria, the readers are encouraged to see the paper [36].Although the quantitative analysis of the scenes is not the focus, the qualitative result, i.e., the stage of the encounter, is crucial for the subsequent deduction.Thus, a qualitative expression of the relative distance is introduced: where D represents the distance between ship objects, Dt is a qualitative expression of "D", and Dn, Dn, Dl are the threshold that defines the distance between ship objects.
(2) Time relational elements The time relation is the expression of the ship's behavior and events in the time scales, which usually contain two forms, namely points and periods.The time point describes a specific moment.For instance, the time point when the ship performs a left turn, the time when two ships collide, etc.The time period is a range of time.For instance, when the ship is anchored at the anchorage, the ship passes through the narrow space, the time of the ship in the waterway, etc.
In Rule 13 of COLREGs, the definition of the two ships overtaking scene is given as follows: "A vessel shall be deemed to be overtaking when coming up with another vessel from a direction more than 22.5 degrees abaft her beam, that is, in such a position with reference to the vessel she is overtaking, that at night she would be able to see only the stern light of that vessel but neither of her sidelights."In this rule, there is actually a time relationship.For instance, the overtaking "begins at" the moment of catching up with the previous ship and "ends at" the time when the two ships pass by.In COLREGs, we can conclude the time-related concepts into five types, namely "earlier than", "later than", "between", "beginning at", and "ending at", which can be described by time points or time periods.The details see Table 1.Semantic relational elements are used to describe the semantic relational elements between ship objects.For example, for the message that the name ship A is "007", there is a relationship ("hasName") between ship A and"007".We call "hasName" is a semantic relational element, ship A is the domain of the semantic relational element, and "007" is the value range of semantic relational elements.The semantic relationship is described as a triple structure <domain, relation, range> using the Resource Description Framework (RDF).
The COLREGs contain many semantic relations, and some typical semantic relations from COLREGs are concluded in Table 2.

Conceptual Modeling of Ship Behavior and Its Expression
Ship behavior is another important concept from the COLREGs.Specifically, COLREGs address the promoted and non-promoted behavior in different traffic scenes with different ship objects.According to Section 3, the ship entity in COLREGs is expressed as a ship object, and its element composition is expressed as attribute elements and relational elements for the machine.Based on that, ship behavior can be defined as the changes of elements in time and space scales, and the formal expression of ship behavior is presented in this section.

Conceptual Modeling of Ship Behavior
In general, "behavior" refers to the activities of spatiotemporal objects caused by external influences or internal action.In order to clearly classify and model the behavior of ship objects, and further express and reason about ship behavior, the definition of the ship behavior is introduced as Definition 4: Definition 4. Ship behavior refers to the change of the ship object's attribute elements and relational elements in time and space scales.
Based on Definition 4, the ship behavior can be defined as ship behavior can be divided into attribute behavior and relational behavior, the definitions are introduced as Definition 5 and Definition 6 The ship behavior is formulated as: Similarly to Equation (2), each characteristic of ship behavior (either attribute behavior or relational behavior) can be expressed by a cell, named as "Behavior.parameter": . ( , , ) Behavior parameter dType dValue T = where "dType" represents types of changes in specific object elements, "dValue" is the amount of change in the value of the same element at different times, the value of "dValue" can be calculated by Valueti-Valueti−1, T represents the period when the "dType" has the "dValue", T can be represented by where g(•) is the function that input the "dType" that has non-empty "dValue" and output the semantical meaning of the behavior (BehaviorSemantic), see Table 3.
The object.Parameter can be expressed as example 2: Example 2. Take the scene in Figure 1 as an example.The shipA.Parameter is expressed: according to Equation (11), the behavior of ship A can be expressed as: Equation ( 13) means that the ship A is accelerated from the time ti−1 to ti.

Formal Expression of Ship Behavior
Since the machines can only understand characterized, formulaic, and structured knowledge, it is necessary to express the knowledge of ship behavior in the way machines can "read", and such process is named as "formal expression".Thus, the definition of formal expression of ship behavior is shown as Definition 7.
Definition 7. Formal expression of ship behavior is a formulaic and structured expression of ship behavior using methods, such as functions and sets.

Attribute Behavior
According to Definition 5, attribute behavior is the change of the attribute elements, which include the changes of ship's position, velocity, course, and signal, etc.Some typical attribute behaviors are shown as follows: - The change of velocity attribute implies the acceleration or deceleration attribute behavior; - The change of course attribute can be divided into turning left and right steering attribute behavior; - The change of signal attribute behavior refers to the signal number, color, and shape that will be changed in time scales Based on Equation ( 11), the attribute behavior can be formulated as: . ( where Object.Parameter attribute represents the smallest unit describing the attribute elements of the specific ship object, "Type" represents the type of attribute elements or relational elements of the specific ship object; "Value" represents the value of the "Type",  represents the moment when the "Type" has the "Value".

Relational Behavior
In COLREGs, the relational behavior (e.g., variable relative distance and bearing) of ship objects are mainly used to determine the criteria of certain scenes and ships obligations.Some typical relational behaviors are shown as follows: 1.The change of relative distance relation implies the "near" or "far away" relation behavior; 2. The change of relative bearing relation can be divided into the angle of bearing turning smaller and the angle of bearing turning bigger; Based on Equation ( 12), the relational behavior can be formulated as: where [Object1, Object2] Parameter Relation represents the smallest unit describing the relational elements of the specific ship object, "Type" represents the type of relational elements of the specific ship object; "Value" represents the value of the "Type",  represents the moment when the "Type" has the "Value".

Case Analysis
In order to demonstrate the proposed models, Rule 9 (the Narrow Channel clause) from COLREGs is introduced (the content of Rule 9 is shown in the Table A1), and the ontological behavior model based on Rule 9 is used.The Narrow Channel clause (Rule 9) addresses the promoting or non-promoting behavior when the ship object (e.g., _ ) enters, leaves, and navigates in a narrow channel.

Ontological Expression of Ship Object Based on Rule 9
By analyzing the text information from Rule 9, there are two types of objects, namely the ship object and the waterway object, specifically, sailboats, ships less than 20 m in length, vessels engaged in fishing, narrow channel, etc., that are shown in Table 4.For the ship object, the attribute elements contain static attributes and dynamic attributes, which are listed in Table 5.
1.The static attributes include ship's type, call sign, size, etc. 2. The dynamic attributes include some time-varying attributes, such as position, velocity, course, draft, sound signal, etc.
For the waterway object, the attribute elements also include static attributes and dynamic attributes, which are shown in Table 5.
1.The static attributes of narrow water channels are the name of the narrow water channel, the center position of each water depth; the width of the navigable water area; the boundary information of the narrow water channel.2. The dynamic attributes of narrow water channels are the flow velocity, flow direction, and visibility of narrow water channels.
Table 5. Attribute elements between water traffic objects in the Narrow Channel clause.

Ship
Static attribute (ame_Ship,h,ti) "Ship's name is "h" at ti" (MMSI,i,ti) "Ship call sign is "i" at ti" (Size,j,ti) "The value of ship size is "j" at ti" (Type_ship,k,ti) "The value of ship type is "k" at ti" Dynamic attribute (Location,a,ti) "Ship's location is "a" at ti" (Velocity,b,ti) "Ship's velocity is "b" at ti" (Course,c,ti) "Ship's course is "c" at ti" (Draft,d,ti) "Ship's draft is "d" at ti" (Sound,e,ti) "Ship's sound is "e" at ti" Narrow Channel (NC) Static attribute (Name_NC,l,ti) "The value of Narrow channel name is "l" at ti" (Boundry_NC,m,ti) "The value of boundary position of the narrow channel is "m" at ti" (Width_NC,n,ti) "The value of navigable water width of the narrow channel is "n" at ti" (Location_NC,o,ti) "The value of the center position of each water depth area of the narrow channel is "o" at ti" Dynamic attribute (Visibility,f,ti) "Visibility in narrow channel is "f" at ti" (Flow velocity,g,ti) "Flow velocity in narrow channel is "g" at ti" According to Section 3.2.2, the relational elements among these objects (ships and the waterway) can be analyzed from the following three aspects: time, space, and semantic.Table 6 lists different objects, the relationships between objects, and the semantic expressions of the relationships.
1.The time relations between the ship and the narrow water channel include the time before the ship enters the narrow water channel, after entering the narrow water channel, and when the ship moves in the narrow water channel.
2. The spatial topological relationship includes the ship outside the narrow water channel and the ship in the narrow water channel.Ships are in narrow channel elbow waters or boundary waters, etc. 3. The semantic relations include ships avoiding anchoring and crossing in narrow channels.Specific numerical values express the spatial position relationship and spatial distance relationship between ships and ships; semantic relations include the ship attempting to overtake another ship, the other ship agrees or suspects overtaking, and sailboats and ships less than 20 m in length should not interfere with ships that can only navigate safely in narrow channels.Vessels engaged in fishing shall not hinder any ships that navigate safely in narrow channels, etc.  (Semantic.Avoid_impede,1,ti) "Ships less than 20 m in length should not impede ships that can only navigate safely in narrow channels" [Shipfishing, Shipin] (Semantic.Avoid_impede,1,ti) "Vessels engaged in fishing shall not impede any vessel navigating safely in the narrow channel"

Formal Expression of Ship Behavior Based on Rule 9
The text information of Rule 9 addresses the attribute and relational elements of objects.Table 7 lists the attribute elements of one ship at different moments in time.By comparing the attribute elements at different moments, the ship's attribute behavior is inferred, and the attribute behavior is concluded in the last column of the table.Based on Table 7, the machine can reason about the behavior of the ship by analyzing or comparing the values of position, velocity, heading, and other ship attributes in a narrow channel at different moments.Specifically, the machine can judge whether the ship has moved, accelerated, decelerated, and turned in the period between the two moments., the ship and the waterway).By comparing the relational elements at different moments, the ship's relational behavior is inferred, and the relational behavior is expressed semantically.Based on Table 8, the machine can reason about the behavior of the ship by analyzing the topological relationship, and the spatial topological behaviors including sailing in, sailing out, and crossing can be inferred.By analyzing the spatial bearing relationship and spatial distance relationship between ships, the pursuit and crossing behavior between ships in the narrow channel can be inferred.

Objects
Relational Elements Relation Behavior

Reasoning Based on the Proposed Method
Based on the above formal expression of the behavior of ships in the narrow channel terms of COLREGs, a formal expression of ship behavior can be applied in conjunction with AIS data and nautical chart data.
In Figure 5, we introduce a scene where two ships encountered in a narrow channel.Ship B is navigating in the starboard channel and move towards the north; Ship A is navigating in the port channel and move towards the south.
By analyzing the changes of the attribute elements and relational elements of ship A and ship B at the moments of time t1,t2, and t3, and expressing the attribute behavior and relational behavior of the ships formally in this way, the machine can finally judge whether the ship behavior complies with the COLREGs.According to the above research on the expression of ship objects and ship behavior, the attribute elements, relational elements of ship objects, and the ship's attribute behavior and relational behavior can be expressed as follows: (a) The expression of the attribute elements of the ship A (b) The expression of the attribute elements of the ship B  . ( According to the changes of the velocity and course of ship A, the semantics of the ship behaviors are expressed as "accelerate" and "keep course" from the time t1 to t2, "decelerate" and "turn starboard" from the time t2 to t3.From time t2 to t3, the course of ship A is perpendicular to the total flow direction of the narrow channel, which means a spatial topological behavior of "crossing" between ship A and the narrow channel.Therefore, it violates the COLREGs rule that "Ships should avoid crossing narrow channel". (g) The expression of the attribute behavior of ship B . ( According to the changes of the velocity and course of ship B, the semantics of the ship behaviors are expressed as "decelerate" and "keep course" from the time t1 to t2, "keep velocity" and "keep course" from the time t2 to t3.Ship B is "anchored" in the narrow channel from the time t2 to t3.Therefore, it violated the COLREGs stipulation that "ships should avoid anchoring in the narrow channel". (h) The expression of the relational behavior of ship A and ship B According to the changes of the relative distance and relative bearing between ship A and ship B, the semantics of the ship behaviors are expressed as "near" and "move to bow" from the time t1 to t2, "far away" and "move to stern" from the time t2 to t3.

(i) The expression of the relational behavior of ship A and Narrow channel
According to the changes of the topology relation between ship A and the narrow channel, the semantics of the ship behaviors are expressed as "sailing in" from the time t1 to t2, "keep topology" in the narrow channel from the time t2 to t3. ( According to the changes of the topology relation between ship B and the narrow channel, the semantics of the ship behaviors are expressed as "keep topology" in the narrow channel from the time t1 to t2, "keep topology" in the narrow channel from the time t2 to t3.
According to the above-mentioned expression of the attribute behavior of ship A and ship B, and the relational behavior between ship A and ship B, ship A and the narrow channel, and ship B and the narrow channel at the time from t1 to t3.Based on these expressions, we can clearly judge whether the ship behavior complies with COLREGs, see Table 9. "keep topology = 1" Yes

Discussion
With the development of knowledge engineering, knowledge expression has been widely explored and utilized in multiple knowledge-driven tasks, which significantly improves their performance.In this section, we first give a summary of this research then summarize the advantages and disadvantages of the method of this research.

Discussion on Case Study
In this paper, we provide a broad overview of currently available techniques, including RDF, function mapping, and set expression methods.The proposed method imitates human understanding ability, which makes it possible to incorporate prior knowledge to assist machine recognizing.
In Section 3, we abstractly express the ship objects in COLREGs as attribute elements and relationship elements, and in Section 4, we express the dynamic changes of the ship object's attribute elements and relationship elements over time as ship behavior.The expression method through RDF, function and collection is similar to human thinking, which is more in line with our COLREGs ship behavior ontology knowledge modeling.Based on the ship behavior ontology method in Section 3 and 4, we use COLREGs (Rule 9) for example verification in Section 5, and the results show that our method can formally express the ship behavior of COLREGs.
However, this research is only the initial work for realizing ship behavior knowledge reasoning to the machine.Based on this research, in the future, the ship behavior knowledge graph, COLREGs knowledge graph, and the knowledge graph of water traffic scene can be further constructed to realize the autonomous recognition of water traffic scenes, judge water Traffic situation, reason about the violations of COLREGs by ships, and support decision making of MASS.

Advantages and Disadvantages of the Proposed Method
(1) Advantages of this method In this paper, the ship behavior, based on COLREGs, is modeled as the change of entity elements in time and space scales by using RDF, function mapping, and set expression methods.The advantages of this method are as follows: first, it can capture hidden semantic information in COLREGs; second, it can improve the accuracy of knowledge recognizing significantly; finally, it can simulate human recognizing ability, which makes it possible to incorporate prior knowledge to assist in recognizing.
(2) Disadvantages of this method On the basis of Sections 3-5, we realize the formal expression of the ship behavior ontology model in COLREGs, but the ontology model still has some deficiencies.The knowledge model of ship behavior established in this paper is still in the enlightenment stage in the maritime industry, which has not yet formed a unified industry standard.Its disadvantage is that it has not solved a series of problems such as dependence on domain experts and poor generalization ability.On the one hand, this method requires manual modeling of ship behavior knowledge, and its modeling efficiency is low.On the other hand, semantic calculation and reasoning methods are still missing.

Future Work
The formal expression of ship behavior is the basis for developing autonomous navigation systems that support the scene cognition, the intention inference, and the rulecompliant actions of the systems.This paper studies the formal expression of ship behavior based on COLREGs.However, there is still a certain distance for the machine to truly realize the autonomous recognition of the navigation scene, the autonomous reasoning of the ship's intention, and the autonomous judgment of the ship's behavior in compliance with the COLREGs rules.Based on the research in this paper, we give several directions for future research, as follows: (1) Constructing the ontology of ship behavior Ontology plays an important role in enriching the semantic information of things and realizing knowledge sharing.Based on the formal expression of ship objects and ship behavior in this paper, the ship behavior ontology is further constructed to form a knowledge base with semantic information, and the custom SWRL rules are input into the ontology inference engine to realize the machine's autonomous cognition of ship behavior.
(2) Constructing the ontology of traffic scene COLREGs are the norms of ship behavior in different traffic scenarios.According to different traffic scenarios, ships should take corresponding behaviors, the traffic scene ontology is constructed based on COLREGs.The custom SWRL rules are input into the ontology inference engine to realize the machine's autonomous cognition of traffic scenarios.
(3) Constructing the knowledge graph of ship behavior Based on the formal expression of ship behavior in this article, and the ship behavior ontology and traffic scene ontology constructed in future research, the knowledge graph of ship behavior can be further constructed in the future.Then, the machine can be queried, and it can be inferred that the actions whether the acctions are COLREGs-compliant or not in different scenarios.

Conclusions
For developing rule-compliant maritime autonomous surface ships (MASS), understanding the Convention on the International Regulation for the preventing Collision at Sea (COLREGs) is the foundation for the machine.The existing expert systems for MASS did not teach the machine to understand the COLREGs rules but list condition-and-reaction rules for endless exceptions.To handle this issue, this paper proposed an ontological method to model the ship behavior and try to build the first step to help the machine to interpret the COLREGs in a manner of humans.
The attributes of the ship are categorized into "attribute elements" and "relational elements", and the ship behaviors then are defined as the changes on "attribute elements" (i.e., attribute behavior) and "relational elements" (i.e., relational behavior).Based on these definitions, the attribute elements, relational elements, attribute behavior, and relational behavior are formally expressed by using the Resource Description Framework (RDF), function mapping, and set expression methods.By introducing Rule 9 from COLREGs, this paper demonstrates the performance of the proposed method, which has laid a theoretical foundation for structural modeling and semantic understanding of ship behavior.
The proposed method addressed a novel way to develop the rule-compliant machine, which is promising in the development of MASS.This paper is the first step for the rulecompliant MASS, and the proposed model is still at the conceptual and logical levels.Thus, it is necessary to construct the ship behavior ontology further, construct the knowledge model driven by the ship behavior, and use it in actual cases in the future.

Figure 1 .
Figure 1.Abstract schematic diagram of Ship entity.

where
Type represents the type of Object.parameters,such as velocity, course, relative distance, relative bearing, etc.Additionally, the parameters relating to the attribute elements are collected in Object.Parameter attribute , and the parameters relating to the relational elements between Object and Object2 are collected in [Object1,Object2].Parameter relation .Thus, Equation (3) can be expressed as: Parameter of object can be expressed as Example 1: ., name, type, size of ship, etc e.g., position, heading, speed of ship, etc

Figure 2 .
Figure 2. Attribute elements of ship entity.

Figure 4 .
Figure 4. Bearing relational elements of ship objects.

Definition 5 .
Ship's attribute behavior refers to the change of ship object attribute information, e.g., ship's position, course, velocity and light type, denoted as Behavior Attribute .Definition 6. Ship's relational behavior refers to changes in ship relational elements over time, including spatial relationships, temporal relationships, semantic relationships, also including the generation, change, and demise of relationships, denoted as Behavior Relation .

where
[ti−1, ti].Similarly to Equation (3), ObjectBehavior.Parameter is a set of Behavior.parametersthat change their values during Ts, which is formulated as: ObjectBehavior.Parameter represents a set of Behavior.parameters,f(•) is the function that finds the "dType" that "dValue" is non-empty from ti−1 to ti.Then, the Object.Behavior can be expressed by the following formula:

(
Before,1,ti) "Before the ship enters the narrow channel" (Time.After,−1,ti) "After the ship enters the narrow channel" (Time.Between,2, [ti,ti+1]) "The time period during which the ship is sailing in the narrow channel" Spatial topological relation (Topology.Separation,−1,ti) "The ship is outside the narrow channel" (Topology.Inclusion,1,ti) "The ship is in the narrow channel" (Topology.Inclusion_starboard,12,ti) "The ship is in the narrow channel on its starboard side" (Topology.Inclusion_elbow,13,ti) "The ship is driving in the waters of the elbow of the narrow channel" Semantic relation (Semantic.Avoid_anchoring,1,ti) "Ships avoid anchoring in the narrow channel" (Semantic.Avoid_crossring,1,ti) "Ships avoid crossing narrow channel" Relative bearing,a,ti) "The bearing relation between ship A and ship B" (Relative distance,b,ti) "The distance relation between ship A and ship B" Semantic relation (Semantic.Overtaking_Port,1,ti) "Ship A attempts to overtake the port side of Ship B" (Semantic.Overtaking_Starboard,2,ti) "Ship A attempts to overtake from the starboard side of Ship B" (Semantic.Agree_Overtaking,3,ti) "Ship B agrees to ship A overtaking" [Shipsailing, Shipin] Semantic relation (Semantic.Avoid_impede,1,ti) "Sailing boats should not impede ships that can only navigate safely in the narrow channel" [Ship ≤ 20 m, Shipin]

Figure 5 .
Figure 5. Application of formal expression of ship behavior in narrow channel scenarios.

( d )
The expression of the relational elements between ship A and Narrow channel The expression of the relational elements between ship B and Narrow channel The expression of the attribute behavior of ship A (j) The expression of the relational behavior of ship B and Narrow channel )

Table 1 .
Time relational elements of ship objects in COLREGs.
between Between ( ,  ) beginning at Begin with  ending at End with  (3) Semantic relational elements

Table 2 .
Time relational elements of ship objects in COLREGs.

Table 3 .
The semantics of behavior.
Therefore, it is necessary to input multiple attribute element values at different times for the f(•) function, and Object.Parameter attribute can be formally expressed as:

Table 4 .
Objects under the Narrow Channel clause.

Table 6 .
Relational elements of objects in the Narrow Channel clause.

Table 7 .
Relational elements of objects in the Narrow Channel clause.

Parameter Attribute ) Attribute Behavior (Object.Behavior Attribute )
Table 8 lists the relational elements of one ship w.r.t.other objects (i.e.

Table 8 .
Ship relational behaviors in the Narrow Channel clause.

Table 9 .
Behavior of objects in the narrow channel.