In a project I am working on Constraints about the architecture are defined locally as an OWL-file and loaded into the Stardog database via calling addConstraints().format(RDFFormats.RDFXML).stream(reader);
on an ICVConnection. However, in this process the mapping of the local constraint to the constraint in the Stardog database is lost. When then calculating the violations of these constraints in the Stardog database these violations cannot be linked back to the local constraints they originated from, which I would like to have.
Is this the wrong approach to load the constraints into the database or is there any mechanism/method that would help in retaining the mapping between local and Stardog constraints?
I am not entirely sure I understand the issue. Typically retaining a mapping between some objects requires that the objects have some sort of identifier, like an IRI or something. An ICV constraint is in general a bunch of RDF triples (at least when stored in Stardog) and the standard way to identify it would be to store in a named graph with some IRI. So you can create a named graph for your constraints (or SHACL shapes), load them there, and associate that IRI with the local file name.
It's a bit unusual to store each constraint in its own NG but maybe it's sufficient to associate your local file with the NG which stores all constraints in Stardog.