Hi,My team is using Empire for our ORM layer with a Stardog triple store. We would like to store several related resources for a "document" in a named graph. I've found the following information related to this, but it's quite old:Our use case is very similar to the one described in the group posting: neither the NamedGraphType.Instance nor NamedGraphType.Static do what we need, we want to be able to place several resources into one of many named graphs chosen at runtime. Outside of the @NamedGraph annotation, have any features been added to Empire to support this use case in the last five years or so?
Alternatively, what are your thoughts on how support for this named graph use case could be added to Empire? Depending on how much effort is involved, our team may have the capacity to add the features that we want to Empire.
--Thanks,Jeff
You received this message because you are subscribed to the Google Groups "Empire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to empire-rdf+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Fri, May 13, 2016 at 6:20 PM, <jeffb.thom...@gmail.com> wrote:Hi,My team is using Empire for our ORM layer with a Stardog triple store. We would like to store several related resources for a "document" in a named graph. I've found the following information related to this, but it's quite old:Our use case is very similar to the one described in the group posting: neither the NamedGraphType.Instance nor NamedGraphType.Static do what we need, we want to be able to place several resources into one of many named graphs chosen at runtime. Outside of the @NamedGraph annotation, have any features been added to Empire to support this use case in the last five years or so?No, there's nothing new on this front in Empire since that post.Alternatively, what are your thoughts on how support for this named graph use case could be added to Empire? Depending on how much effort is involved, our team may have the capacity to add the features that we want to Empire.It would be relatively straightforward to add, the only hard part is where the hook comes from that tells Empire what the named graph is to use dynamically.
On Friday, May 13, 2016 at 7:34:06 PM UTC-5, mhgrove wrote:On Fri, May 13, 2016 at 6:20 PM, <jeffb.thom...@gmail.com> wrote:Hi,My team is using Empire for our ORM layer with a Stardog triple store. We would like to store several related resources for a "document" in a named graph. I've found the following information related to this, but it's quite old:Our use case is very similar to the one described in the group posting: neither the NamedGraphType.Instance nor NamedGraphType.Static do what we need, we want to be able to place several resources into one of many named graphs chosen at runtime. Outside of the @NamedGraph annotation, have any features been added to Empire to support this use case in the last five years or so?No, there's nothing new on this front in Empire since that post.Alternatively, what are your thoughts on how support for this named graph use case could be added to Empire? Depending on how much effort is involved, our team may have the capacity to add the features that we want to Empire.It would be relatively straightforward to add, the only hard part is where the hook comes from that tells Empire what the named graph is to use dynamically.Yeah, I see that. Poking around the code, it looks like the main place where the @NamedGraph annotation data is actually consumed is EmpireUtil.getNamedGraph(...). We could probably get dynamic named graphs by adding a new NamedGraphType strategy that uses a strategy class provided on a new annotation property to dynamically derive the name of the graph to use [e.g. @NamedGraph(type = NamedGraph.NamedGraphType.Strategy, strategy = MyCustomNamedGraphStrategy.class)]. EmpireUtil.getNamedGraph(...) would instantiate that class and call it with all the context it has (e.g. resource URI, perhaps the datasource connection).
Hi,On a related note, does NamedGraphType.Static work, or am I doing something wrong? I implemented SupportsNamedGraphs on StardogEmpireDataSource. I can persist my entities to a static name graph fine, however I cannot seem to retrieve them using EntityManagerImpl.find(MyClass.class, "http://my.url"):It looks like:1. EntityManagerImpl.find(...): the string URI gets passed to DataSourceUtil.exists(getDataSource(), EmpireUtil.asPrimaryKey(theObj)) as theObj,2. DataSourceUtil.exists(...): then calls EmpireUtil.hasNamedGraphSpecified(theObj).3. EmpireUtil.hasNamedGraphSpecified(..): since theObj is a SupportsRdfId$URIKey, not an instance of the class, the @NamedGraph annotation will never be found, so the query will never look in the specified graph.It seems to me like the class parameter to EntityManagerImpl.find(...) should be passed down and used to get the named graph info, if no class instance is available
.- Jeff
On Friday, May 13, 2016 at 7:28:31 PM UTC-5, jeffb.thom...@gmail.com wrote:Hi,My team is using Empire for our ORM layer with a Stardog triple store. We would like to store several related resources for a "document" in a named graph. I've found the following information related to this, but it's quite old:Our use case is very similar to the one described in the group posting: neither the NamedGraphType.Instance nor NamedGraphType.Static do what we need, we want to be able to place several resources into one of many named graphs chosen at runtime. Outside of the @NamedGraph annotation, have any features been added to Empire to support this use case in the last five years or so?Alternatively, what are your thoughts on how support for this named graph use case could be added to Empire? Depending on how much effort is involved, our team may have the capacity to add the features that we want to Empire.Thanks,Jeff
--
DataSourceUtil.exists(getDataSource(), theObj)
SupportsRdfId.RdfKey<T> theKey = EmpireUtil.asPrimaryKey(theObj); SupportsRdfId theProbe = EmpireUtil.asSupportsRdfId(theClass.newInstance()); theProbe.setRdfId(theKey); if (DataSourceUtil.exists(getDataSource(), theProbe)) { T aT = RdfGenerator.fromRdf(theClass, theKey, getDataSource());