
## The Project


- **Collaboration Partners**: The project is developed in partnership with Windesheim University of Applied Sciences and the Supply Chain Finance research group.

- **Value Chain Hackers**: A dynamic living lab that serves as a platform for both schools and companies.

- **Innovation & Experimentation**: The lab facilitates experimentation with innovative supply chain solutions and realistic sustainability strategies.

- **Open Source**: The project, including all models and datasets, is open source and freely available.

- **More Information**: Additional details can be found on the website [https://valuechainhackers.xyz/](https://valuechainhackers.xyz/).

- **Open Invitation**: Encourages participation from individuals with ideas for improving the world and those interested in contributing to sustainable change.

### Key Takeaways:

- The project is a collaborative effort aimed at optimizing financial flows within supply chains.
- It emphasizes the importance of innovation and sustainability in supply chain management.
- Value Chain Hackers provides a practical environment for experimentation and collaboration.
- The project's models and datasets are open-sourced, encouraging transparency and wider participation.
- There is an open call for participation, inviting individuals and organizations to contribute to the development of sustainable supply chains.
- For more information, interested parties can visit [https://valuechainhackers.xyz/](https://valuechainhackers.xyz/){:target="_blank"}.

### About the project

[https://valuechainhackers.xyz/](https://valuechainhackers.xyz/){:target="_blank"}

GitHub repo
[https://github.com/Value-Chain-Hackers/KnopenKoning](https://github.com/Value-Chain-Hackers/KnopenKoning){:target="_blank"}

Models: 
[https://huggingface.co/sebdg?search_models=scm](https://huggingface.co/sebdg?search_models=scm){:target="_blank"}

Dataset: 
[https://huggingface.co/datasets/sebdg/ontologies_train_dataset](https://huggingface.co/datasets/sebdg/ontologies_train_dataset){:target="_blank"}

Prompts: 
[https://github.com/Value-Chain-Hackers/KnopenKoning/tree/main/prompts](https://github.com/Value-Chain-Hackers/KnopenKoning/tree/main/prompts){:target="_blank"}


![](graph_app.png)

### Who is What ?

**Knowledge Graphs** are structured representations of information that connect data points through relationships, enabling machines to understand and reason about the relationships between different concepts. They are used to integrate, organize, and retrieve information in a way that reflects the real-world interconnections of entities.

**Ontologies**, on the other hand, are formal frameworks that define the relationships and categories within a particular domain. They provide a shared vocabulary and a set of rules for how concepts are related, which is essential for ensuring that knowledge graphs accurately represent the domain they cover. Together, knowledge graphs and ontologies enable more effective data integration, retrieval, and reasoning.

**First-Order Logic**, also known as Predicate Logic, is a formal system used in mathematics, philosophy, computer science, and artificial intelligence to express statements and reason about them. It extends propositional logic by allowing the use of **quantifiers** and **predicates** to make more complex and expressive statements about objects and their relationships.

#### Key Components of First-Order Logic:

1. **Constants**: These represent specific objects in the domain of discourse. For example, in a domain of people, `John` and `Mary` could be constants.

2. **Variables**: These are symbols that can represent any object in the domain. For example, `x`, `y`, and `z` are variables that could represent any person in a domain.

3. **Predicates**: Predicates are functions that return true or false, depending on the values of the arguments they are applied to. They describe properties of objects or relationships between objects. For example, `Loves(John, Mary)` might mean "John loves Mary."

4. **Quantifiers**: 
   - **Universal Quantifier (`∀`)**: This denotes that a statement is true for all elements in the domain. For example, `∀x Loves(x, Mary)` means "Everyone loves Mary."
   - **Existential Quantifier (`∃`)**: This denotes that there is at least one element in the domain for which the statement is true. 
   
    For example, `∃x Loves(John, x)` means "There is someone whom John loves."

5. **Functions**: These are mappings from one or more elements of the domain to another element. 

    For example, `MotherOf(x)` could be a function that returns the mother of `x`.

6. **Logical Connectives**: 
These include `∧` (and), `∨` (or), `¬` (not), `→` (implies), and `↔` (if and only if), which are used to build more complex statements.

7. **Equality (`=`)**: This is a special predicate that asserts that two terms refer to the same object. For example, `John = Mary` would mean that John and Mary are the same person.

### Axioms

Axioms are statements or propositions in a logical system that are assumed to be true without proof. 
They serve as the foundational building blocks from which other statements, called **theorems**, can be logically derived.

#### Types of Axioms:

1. **Logical Axioms**: These are tautologies, statements that are always true regardless of the interpretation of their components. For example, in propositional logic, a statement like `P ∨ ¬P` (the law of excluded middle) is a logical axiom.

2. **Non-Logical Axioms**: These are specific to the domain of discourse. In mathematics, these might be statements like "For any number x, x + 0 = x," which are not universally true but are true within the context of arithmetic.

3. **Axiomatic Systems**: A formal system can be built by defining a set of axioms along with inference rules. Theorems are then derived from these axioms using the rules of inference.

#### Role of Axioms in FOL:
In First-Order Logic, axioms are used to define the properties of the objects and relationships in the domain. For example, in a theory of arithmetic, axioms might define the properties of addition and multiplication. From these axioms, other properties can be derived.

Certainly! Let's create an example using the Harry Potter universe, applying First-Order Logic (FOL) with some axioms and statements about the characters and relationships in that world.

### Example Ontology in Harry Potter:
- **Domain**: The set of all people and magical creatures in the Harry Potter universe.
- **Constants**: `Harry`, `Voldemort`, `Dumbledore`, `Hogwarts`, `Hedwig`.
- **Variables**: `x`, `y`, `z`.

### Predicates:
- **Wizard(x)**: x is a wizard.
- **Witch(x)**: x is a witch.
- **Muggle(x)**: x is a muggle.
- **LoyalTo(x, y)**: x is loyal to y.
- **TeachesAt(x, y)**: x teaches at y (where y is a school).
- **EnemyOf(x, y)**: x is an enemy of y.
- **HasPet(x, y)**: x has a pet y.
- **Kills(x, y)**: x kills y.

### Functions:
- **MasterOf(x)**: Returns the person who is the master of x.

### Axioms:
Let's define some axioms that describe the relationships and rules in the Harry Potter universe.

**Axiom 1**: Every wizard is not a muggle.
   $$\forall x (Wizard(x) \rightarrow \neg Muggle(x))$$
   Example: "If Harry is a wizard, then Harry is not a muggle."

**Axiom 2**: Dumbledore is a wizard.
   $$Wizard(Dumbledore)$$
   This is a simple fact about Dumbledore.

**Axiom 3**: If someone teaches at Hogwarts, they must be a wizard or a witch.
   $$\forall x \forall y (TeachesAt(x, Hogwarts) \rightarrow (Wizard(x) \vee Witch(x)))$$
   Example: "If Dumbledore teaches at Hogwarts, then Dumbledore is either a wizard or a witch."

**Axiom 4**: Voldemort is an enemy of Harry.
   $$EnemyOf(Voldemort, Harry)$$

**Axiom 5**: Harry is loyal to Dumbledore.
   $$LoyalTo(Harry, Dumbledore)$$

**Axiom 6**: If someone is loyal to Dumbledore, they are not loyal to Voldemort.
   $$\forall x (LoyalTo(x, Dumbledore) \rightarrow \neg LoyalTo(x, Voldemort))$$
   Example: "If Harry is loyal to Dumbledore, then Harry is not loyal to Voldemort."

**Axiom 7**: If someone kills another, they are enemies.
   $$\forall x \forall y (Kills(x, y) \rightarrow EnemyOf(x, y))$$
   Example: "If Voldemort kills Harry's parents, then Voldemort is an enemy of Harry's parents."

**Axiom 8**: If someone is the master of a creature, that creature is loyal to them.
   $$\forall x \forall y (y = MasterOf(x) \rightarrow LoyalTo(x, y))$$
   Example: "If Voldemort is the master of Nagini, then Nagini is loyal to Voldemort."

**Axiom 9**: Harry has a pet, Hedwig.
   $$HasPet(Harry, Hedwig)$$

**Axiom 10**: If a wizard has a pet, that pet is not a muggle.
    $$\forall x \forall y (Wizard(x) \wedge HasPet(x, y) \rightarrow \neg Muggle(y))$$
    Example: "If Harry is a wizard and has a pet Hedwig, then Hedwig is not a muggle."

### Example Statements and Inferences:

Using these axioms, we can make various statements and derive inferences:

1. **Statement**: `Wizard(Harry)`
   - Harry is a wizard.

    **Inference**: From Axiom 1 and the statement `Wizard(Harry)`, we can infer:
    - `not Muggle(Harry)` (Harry is not a muggle).

3. **Statement**: `TeachesAt(Dumbledore, Hogwarts)`
   - Dumbledore teaches at Hogwarts.

    **Inference**: From Axiom 3 and the statement `TeachesAt(Dumbledore, Hogwarts)`, we can infer:
    - `Wizard(Dumbledore) ∨ Witch(Dumbledore)` (Dumbledore is either a wizard or a witch).

5. **Statement**: `Kills(Voldemort, LilyPotter)`
   - Voldemort kills Lily Potter.

    **Inference**: From Axiom 7 and the statement `Kills(Voldemort, LilyPotter)`, we can infer:
    - `EnemyOf(Voldemort, LilyPotter)` (Voldemort is an enemy of Lily Potter).

    **Inference**: If `MasterOf(Nagini) = Voldemort`, then from Axiom 8:
    - `LoyalTo(Nagini, Voldemort)` (Nagini is loyal to Voldemort).

    **Inference**: From Axiom 5, `LoyalTo(Harry, Dumbledore)`, and Axiom 6, we infer:
    - `not LoyalTo(Harry, Voldemort)` (Harry is not loyal to Voldemort).

### Summary

In this example, First-Order Logic is used to define relationships between characters, their roles, and events in the Harry Potter universe. Axioms establish basic truths, and logical reasoning allows us to derive new information based on these truths. This system is highly expressive and can be extended to include more characters, relationships, and events in the domain.

### Bullet Points:

- **Knowledge Graphs**: Structured representations that connect data points through relationships, helping machines understand and reason about these connections.
- **Ontologies**: Formal frameworks defining relationships and categories within a domain, providing a shared vocabulary for knowledge representation.
- **First-Order Logic (FOL)**: A formal system using constants, variables, predicates, quantifiers, functions, and logical connectives to express and reason about statements.
- **Key Components of FOL**: Includes constants, variables, predicates, quantifiers, functions, logical connectives, and equality.
- **Axioms**: Fundamental statements assumed to be true, used as building blocks for deriving theorems in logical systems.
- **Types of Axioms**: Logical axioms (always true) and non-logical axioms (domain-specific).

### Key Takeaways:

- Knowledge Graphs and Ontologies work together to organize and represent information in a structured way.
- First-Order Logic allows for complex reasoning about objects and their relationships.
- Axioms are essential for defining properties within a domain, enabling logical derivation of theorems.
- The Harry Potter example illustrates how FOL can be applied to create logical statements and make inferences within a fictional domain.