\section{Methodology}\label{sec:methodology}
\begin{comment}
- Describe the process of designing the benchmark dataset, including noise injection techniques.
\end{comment}

This section outlines the mechanisms used in NSORN (Neurosymbolic Ontology Reasoning with Noise) to introduce noise into ontologies, specifically targeting the ABox, which contains instance-level information. We devised three distinct techniques to introduce noise into an ontology: logical (see \secref{subsec:logic}), statistical (see \secref{subsec:stat}) and random noise (see \secref{subsec:random}). Each method was designed to simulate a unique form of inconsistency or error, enabling us to assess the performance and robustness of ontology reasoning under various noisy conditions.

These techniques were specifically chosen to challenge the neurosymbolic reasoner's reasoning capabilities and to evaluate its resilience against varying levels and types of noise. By analyzing reasoning performance under such conditions, we can better understand the robustness and limitations of ontology-based systems.

\begin{figure}[!ht]
    \centering
\includegraphics[width=\textwidth]{figures/NSORN- Figure.png}
    \caption{A toy example of a family ontology with possible inferences and different types of noise generation. The figure illustrates a sample ABox from the family ontology used in the benchmark. For this ABox, the possible type and property inferences are also provided. To observe the effect of different kinds of noise on these inferences, several noise types were introduced. For logical noise, since the assertion \texttt{Person1 hasFather Person2} exists in the ABox, an additional assertion \texttt{Person1 isSisterOf Person2} was added to invalidate it. The reason for adding this assertion is that there is a disjointness constraint between these two properties, which means that both these relations cannot simultaneously hold between the same pair of individuals. Similarly, for the assertion \texttt{Person3 type Woman}, the assertion \texttt{Person3 type Man} was added. This leads \texttt{Person3} to be both a \texttt{Woman} and a \texttt{Man}, resulting in a contradiction. As the last example of logical noise, a property is assigned to an individual that does not satisfy the property's domain or range restrictions. For instance, although the domain of \texttt{hasPartner} is \texttt{Marriage}, it was assigned with \texttt{Person1} as its subject, which leads to a domain/range violation. As an example of statistical noise, the least likely link between two entities is added—typically a relation between entities that normally have no connection at all. Finally, random noise is generated by creating an arbitrary relation between two randomly selected entities.}
    \label{fig:nsorn_noise_example}
\end{figure}

\subsection{Logical Noise}
\label{subsec:logic}

\subsubsection{Contradictions based on Disjoint Axioms}

This noise injection technique tests the robustness of reasoning engines by deliberately introducing contradictions into the ontology, evaluating their ability to handle inconsistencies. To introduce ABox noise within disjoint axioms (i.e., disjoint classes and disjoint object properties), we used the following approach:

\begin{enumerate}

    \item \textbf{Extracting Disjoint Class Axioms:} We first identify all disjoint class axioms, denoted as $DisjointClasses(CE_1 ... CE_n)$, specifying that all class expressions $CE_i$ ($1 \leq i \leq n$) are pairwise disjoint\footnote{\url{https://www.w3.org/TR/owl2-syntax/\#Disjoint_Classes}}. These axioms are used to generate noise that challenges the ontology's consistency.
    
    \item \textbf{Introducing Noise:} To create inconsistencies, we assign $k$ individuals to multiple disjoint classes $CE_i$ and $CE_j$ ($i \neq j$). We first select existing individuals in the ontology; if additional examples are needed to reach the desired noise level, we introduce new, fictional individuals. For example, in Figure \ref{fig:nsorn_noise_example}, if \texttt{Man} and \texttt{Woman} are disjoint, we assign \texttt{Person3} to both classes (\texttt{Person3 rdf:type Man} and \texttt{Person3 rdf:type Woman)}. The parameter $k$ controls the intensity of noise.

\end{enumerate}

Similarly, we extract all disjoint object properties, denoted as $DisjointObjectProperties(OPE_1 ... OPE_n)$\footnote{\url{https://www.w3.org/TR/owl2-syntax/\#Disjoint_Object_Properties}}. To introduce inconsistencies, we assign individuals to multiple disjoint properties $OPE_i$ and $OPE_j$. Again, existing individuals are used first, and new individuals are added if necessary. For instance, if \texttt{hasFather} and \texttt{isSisterOf} are disjoint, an individual \texttt{Person1} is assigned both to \texttt{hasFather Person2} and \texttt{isSisterOf Person2}. By varying $k$, we can observe how different levels of noise affect reasoning performance, providing insights into system resilience and accuracy.

\subsubsection{Contradictions based on Range/Domain}

Object properties in ontologies can have explicitly defined domains and ranges, which establish the types of individuals that are allowed to participate in a relationship. The domain specifies the class of individuals that can serve as the subject of the object property, while the range specifies the class of individuals that can serve as the object. Violations of these constraints lead to inconsistencies in the ontology, as they contradict the semantic rules established by the domain and range definitions. 

For example, consider an object property \texttt{hasPartner} with a domain of \texttt{Marriage} and a range of \texttt{Person}. This means:
\begin{enumerate}
    \item The subject of the \texttt{hasPartner} relationship must be a \texttt{Marriage}.
    \item The object of the \texttt{hasPartner} relationship must be a \texttt{Person}.
\end{enumerate}

If an assertion like \texttt{Person1 hasPartner Person2} is made, it would violate the domain constraint because \texttt{Person1} is not an instance of the class \texttt{Marriage}.

Such violations undermine the logical consistency of the ontology, making reasoning unreliable. Clearly defining and enforcing domain and range constraints ensures that the relationships in the ontology align with its intended semantics, enabling accurate reasoning and error detection.

\subsection{Statistical Contradictions}
\label{subsec:stat}

We utilized Relational Graph Convolutional Networks (R-GCN)~\citep{rgcn} in our approach to model the complex relationships present in ontologies. R-GCN is particularly advantageous in handling multi-relational data as it extends the standard Graph Convolutional Network (GCN)~\citep{gcn} by incorporating relation-specific transformations for edges. This allows the model to capture the semantics of different types of relationships in the graph.

We trained the R-GCN on a link prediction task, where the model predicts missing links based on existing data. After training, we identified the top $k$ triples with lowest prediction scores, which were then added as noise to the ontology. Specifically, we altered existing triples—adding the modified versions as new triples—by replacing either the subject or the object with the entity that the R-GCN predicted to have the lowest probability. This method assesses the impact of noise generated through a statistical model and provides insights into the reasoner's handling of statistically improbable but plausible assertions.

Although statistical noise is generated probabilistically using a GNN, it is not explicitly constrained to satisfy ontology-level semantics, and may therefore occasionally introduce logical inconsistencies as an indirect effect.

\subsection{Random Contradictions}
\label{subsec:random}

We introduced $k$ random triples into the ontology by corrupting either the subject or the object of existing triples and adding the resulting modified triples as new entries. This method simulates random noise and evaluates the reasoner's resilience to arbitrary disruptions in the data. Unlike previous noise injection techniques, this random approach contrasts the effects of systematic versus random noise on ontology reasoning. By corrupting existing triples, this method helps to understand how well the reasoner manages unexpected and non-systematic errors, crucial for assessing its robustness in real-world scenarios with unpredictable data inconsistencies.