This study focused on the construction of a spatiotemporal knowledge graph for ship activities. First, a ship activity ontology model was proposed to describe the entities and relations of ship activities. Then, maritime event text data were utilized as the ship activity dataset, where entities and relations were extracted to form triplets. Thus, the data layer was populated, completing the construction of the ship activity spatiotemporal knowledge graph. The process of extracting triplets involved initially inputting the text sentences into the Bidirectional Encoder Representations from Transformers (BERT) model for pretraining to obtain vector representations of characters. These representations were then fed into a lattice long short-term memory network (Lattice-LSTM) for further processing. The resulting hidden vectors h1,h2,⋯,hn were input into the conditional random field (CRF) to perform named entity recognition. The recognized entities were then labeled in the original sentences and input into another BERT-Lattice-LSTM network. The resulting hidden vectors h′1,h′2,⋯,h′n were fed into a relation classifier, which output the relation between the two labeled entities, completing the extraction of entity–relation triplets. In experiments, the proposed method achieved triplet extraction performance exceeding 90% for three different evaluation metrics: Precision, Recall, and F1-measure.