You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (Jira)" <ji...@apache.org> on 2022/02/22 13:46:00 UTC

[jira] [Comment Edited] (JENA-2290) GraphRDFS doesn't implement contains

    [ https://issues.apache.org/jira/browse/JENA-2290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17496000#comment-17496000 ] 

Andy Seaborne edited comment on JENA-2290 at 2/22/22, 1:45 PM:
---------------------------------------------------------------

Short of writing a parallel "contains" implementation for all {{MatchRDFS.find_*}}, {{find().hasNext}} is about as good as it gets.

 Mostly, but not all, {{find_*}} are on-demand streams using {{flatMap}} so the saving is in stream setup, rather than computation.

The code has some notes of possible places for improvements to use more streams.


was (Author: andy.seaborne):
Short of writing a parallel "contains" implementation for all {{MatchRDFS.find_*}}, {{find().hasNext}} is about as good as it gets.

 Mostly {{find_*}} are on-demand streams using {{flatMap}} so the saving is in stream setup, rather than computation.

The code has some notes of possible places for improvements to use more streams.

> GraphRDFS doesn't implement contains
> ------------------------------------
>
>                 Key: JENA-2290
>                 URL: https://issues.apache.org/jira/browse/JENA-2290
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: Jena 4.4.0
>            Reporter: Lorenz Bühmann
>            Assignee: Andy Seaborne
>            Priority: Major
>
> While trying to use the RDFS dataset to use light-weight reasoning I recognized that the contains method isn't implemented properly?
> I can't say if this holds for all contains calls as there is some contains method directly in the dataset.
> But the following path is what I got trouble with:
> Given {{D}} being a {{DatasetGraphRDFS}} and then getting the named model {{M}} for a particular graph which in fact is then backed by a {{GraphRDFS}} instance {{G}} this {{G}} doesn't seem to make use of the inferred triples when we call {{{}contains{}}}. This method is still only implemented in the {{GraphWrapper}} superclass and doesn't make use of the overridden {{find}} method.
> Don't what would be best place to implement it. Sure, we could make use of {{find}} directly in the {{GraphRDFS}} class, e.g.
> {code:java}
> @Override
> public boolean contains(Node s, Node p, Node o) {
>     return find(s, p, o).hasNext();
> }
> @Override
> public boolean contains(Triple t) {
>     return contains(t.getSubject(), t.getPredicate(), t.getObject());
> } {code}
> But I'm wondering about efficiency as I don't know how efficient the inference streams are built. I mean we could maybe terminate way earlier in the {{MatchRDFS}} but it would of course lead to some more lines of code.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)