## 3 Materials and Methods
### Trajectory Semantic Annotation  
After the execution of the reconstruction and the enrichment modules, the resulting trajectory integrates external heterogenous information beyond latitude, longitude, and timestamp. Thus, the need arises for a high-level abstract formalism that will semantically annotate the seamlessly integrated data and expose it as linked data (for third-party services' consumption). Having said that, the use of the developed ontology is proposed for the actual semantic data integration, i.e., for seamlessly mapping the heterogeneous internal and external data to shared, explicit, and formal semantics.  
Towards this aim, ReconTraj4 Drones integrates a drone-related ontology, namely, Onto4 drone, which was recently developed in our laboratory in the context of related research. Figure 7 depicts a high-level design of the core semantics of the developed ontology. Currently, the ontology version is 1.0.2, and it is available online in OWL ([[https://github.com/KotisK/onto4](https://github.com/KotisK/onto4) drone]([https://github.com/KotisK/onto4](https://github.com/KotisK/onto4) drone), accessed on 30 December 2022). The Onto4 drone ontology is based directly on datAcron [25] ontology and indirectly on DUL [26], SKOS [27], SOSA/SSN [28], SF [29], GML [30], and GeoSparql [31] ontologies. The ontological approach ensures the utilization of a high-level abstract formalism for the representation of semantic trajectories, as various disparate and heterogenous data are seamlessly integrated to semantically enrich the reconstructed trajectory. A detailed description of the ontology is out of the scope of this paper.  
To incorporate ontologies and work with RDF models [32] in MovingPandas, the Owl-ready2 library [33] was used to allow for transparent access to OWL ontologies. Owlready2 is a software package for ontology-oriented programming in Python. It allows for the use of ontologies as Python objects, modifying and saving them, performing reasoning via the HermiT reasoner [34], and executing queries in the SPARQL language [35]. In the semantic annotation phase, the aim is to use the ontology for the semantic annotation of the heterogenous data that the trajectory integrates, allowing (eventually) for the analysis of the reconstructed semantic trajectories via reasoning and queries in SPARQL. Finally, Owlready2 is used to export semantically annotated data in RDF  
Figure 6: Trajectory interactive visualization. (**a**) Visualization of the total number of points that make up the trajectory; (**b**) visualization of a percentage of points set by the user.  
ysis in third-party semantic applications that are able to consume semantically annotated spatiotemporal movement data.  
The first step is to load the Onto4 drone ontology into the ReconTraj4 Drones. The framework is expected to import all the referenced ontologies. The current version of Owlready2 can load ontologies in RDF/XML, OWL/XML, and N-triples syntax/encoding. After importing Onto4 drone and the associated ontologies (e.g., datAcron), the individual entities (instances of ontological classes) are created from the data that represent the trajectory. As already stated, such data are either obtained from the external Web services, such as the weather conditions and POIs; or they are extracted from the geo-tagged photos, such as the camera model and maker; or they are inserted by the user, such as the drone type, mission, and/or flight details; or they are even created during the segmentation process (different segments). For each entity, the corresponding individual is created by specifying its label, its resource identifier (IRI), and a set of data/object properties, according to the data collected and the available ontology. The user can then proceed to the semantic analysis of the semantically enriched trajectory. Finally, the data of the semantically annotated trajectory can be exported either in RDF/XML or in N-triples encoding.