How to reproduce an ontology query?

Hi,

Let’s say if I have query filters based on ObjectSet properties of MyObjectType (e.g. MyObjectSet.propertyA>10, MyObjectSet.propertyB == "this value"). New instances of MyObjectType are frequently added to the Ontology and I wish to be able to reproduce identical results from a saved query. How will I achieve this?

For instance, is there a system level Ontology edit version/date that I can restrict my queries to? The Object themseleves are backed a by dataset and do not have a date like column that can be used in this context.

Hi,

The query first starts with all objects of the object type you specify and you then filter by properties as you said. There is no system level date for an object and you would need to add this metadata yourself. Depending on how you add new objects you could maybe try doing this in Pipeline Builder or as a parameter on an action which edits the objects.

Hi @mwalther Thanks for the response. The objects are backed by a dataset. New objects are created as dataset is updated as part of the default Object Storage V2 backend service. In my use case, no new objects will ever be created through direct ontology edits but through dataset updates. Looks like the only way might be to use Pipeline Builder to create a pipeline that adds on a column “addedOn” (for data/time/transactionID when the row was added). Then add a property in object mapping to this “addedOn” column? No way to truely make use of the dataset transactionID/OntologyVersion tracking in filtering Objects via ontology SDK to reproduce a query otherwise?

If you are using OSDK for these queries you could always store the results of the query and then query exactly those objects again? You could write the primary keys of the returned objects to storage (either your own or in the ontology) and then query them again.

Thanks @mwalther . Yup that’s definitely an option. In my case I also want to preseve how the object set was created (i.e. the property filters that were applied originally to reach that ObjectSet). If I save the primary keys/ObjectSet, it doesn’t actually preserve what crieteria was used to create this set. So my thought was to save the query/filters and rerun/recreate the set when needed. However this runs into the whole reproducibility issue for which it seems like there is no built in way to restrict to version/date/transaction. So overall, below seem the two possible way forward:

  1. Preserve the json query (rerunning may not give exact results). Also preserve the resulting ObjectSet/primarykeys.
  2. Use Pipeline Builder to materialize a column suitable for tracking (creation date, transactionid etc) so that it can be explictly initialized as Object property. Save the JSON query and rerun as needed with/without date/transaction filter.

Does that seem right understanding? Thank you for your help.

Yes, that sounds right.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.