eclipse / lyo

Eclipse Lyo, a Java SDK for OSLC-based tool integration
https://oslc.github.io/developing-oslc-applications/eclipse_lyo/eclipse-lyo.html
Eclipse Public License 2.0
13 stars 16 forks source link

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

Open jadelkhoury opened 2 years ago

jadelkhoury commented 2 years ago

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?

jadelkhoury commented 2 years ago

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

berezovskyi commented 2 years ago

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.

berezovskyi commented 2 years ago

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.

berezovskyi commented 2 years ago

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.

berezovskyi commented 2 years ago

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.