gchq / gchq/MagmaCore

Cannot build a top level PossibleWorld

Open
#194 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
30
Forks
8
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Every possible_world inherits from state and, therefore, must be part of a possible_world. To break the recursion, (ie. for a top-level possible_world) a self reference is needed. However, this is not possible using the builder classes supplied in hqdm-canonical. Should there be an extra, `partOfOwnPossibleWorld()` method on the `PossibleWorldBuilder` class that allows you to make this self-referential relationship?

**To Reproduce**
Steps to reproduce the behavior:
Run the following code:
```
final IRI topLevelWorldIri = new IRI(HQDM.HQDM, "Top_Level_World");
final PossibleWorldBuilder topLevelWorldBuilder = new PossibleWorldBuilder(topLevelWorldIri);
final PossibleWorld topLevelWorld = topLevelWorldBuilder.build();
```
It will return the following error:
```
Exception in thread "main" uk.gov.gchq.magmacore.hqdm.exception.HqdmException: Property Not Set: part_of_possible_world
at uk.gov.gchq.magmacore.hqdm.rdfbuilders.PossibleWorldBuilder.build(PossibleWorldBuilder.java:268)
at main.Program.main(Program.java:20)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.