openworm / owmeta-core

Core library for owmeta
MIT License
3 stars 2 forks source link

Report imports for contexts that aren't included in the current RDFLib store #37

Open mwatts15 opened 2 years ago

mwatts15 commented 2 years ago

When saving statements to a Context, it is often the case that we add imports that are defined in another Bundle. When we then try to query against the importing context, then we can, rather confusingly, fail to get expected triples (e.g., lacking rdfs:subClassOf statements -> can't query by super-class). To avoid this problem we should do two things:

  1. When saving a context's imports, check that all imported contexts are either defined in the current RDFLib store or that they import (transitively) a context that is stored in the current RDFLib store.
  2. When creating an owmeta_core.context_store.RDFContextStore, check that any imported contexts are either defined in the current RDFLib store or they import (transitively) a context that is stored in the current RDFLib store.

In either case, a warning should be reported to the developer or user (depending on context and configuration) by using the warnings module indicating which context is missing and which context(s) are declared to import it.