eclipse / lyo

Eclipse Lyo, a Java SDK for OSLC-based tool integration

Home Page:https://oslc.github.io/developing-oslc-applications/eclipse_lyo/eclipse-lyo.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Store - Call to the simplest method getResources(namedGraph, clazz) gets a whole graph first

jadelkhoury opened this issue · comments

getResources(final URI namedGraph, final Class clazz) calls modelFromQueryFlat(namedGraph), which ultimatly calls the following SPARQL query. This query simply gets the whole graph, only to filter the classes in code.
DESCRIBE ?s WHERE { GRAPH <http://...> { ?s ?p ?o } }

Replace the call to use same methods as all other getResources() methods?

@berezovskyi ! I can do the fix, but want to hear your thoughts first (Since you wrote this stuff originally).

I think that method was to get all resources specifically without doing any paging. Sadly, I wrote it before we added querying to the Store, so that part is missing. But I don't think that paging makes sense here.

The reason the whole graph is fetched is because we may want to get all instances of a klass and its subclasses. We can of course try to traverse the class hierarchy first and get the union of all rdf type annotations to scope the rdf type of the subjects in the query.

And as Eike mentioned on the forum, the patch from Koneksys to JMH now may have changed the semantics, potentially returning resource instances that are not related to the klass at all, which we should certainly investigate.

To add, the JMH change may require us to add a method like

Collection<IExtendedResource> unmarshallModel(Model m)

And maybe revert the semantics on the old methods, never returning instances of any class that is not assignable to a klass.