Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spurious choice-points in frame.pl ? #50

Closed
pmoura opened this issue Dec 4, 2019 · 2 comments
Closed

Spurious choice-points in frame.pl ? #50

pmoura opened this issue Dec 4, 2019 · 2 comments

Comments

@pmoura
Copy link
Contributor

pmoura commented Dec 4, 2019

Are the implicit choice-points created by the following member/2 and select/3 calls required?

https://github.com/terminusdb/terminus-server/blob/df1ba67477fd0d32f9f4062eb18e62e2982b2117/library/frame.pl#L818-L819

The call to the realise_triples/4 predicate from the object_edges/3 predicate suggests that those calls could be replaced with memberchk/2 and selectchk/3. As the realise_triples/4 predicate is recursive, these choice-points accumulate.

P.S. Given sort/2 semantics, the object_edges/3 predicate can also be rewritten as:

object_edges(URI,Database,Edges) :-
    (   most_specific_type(URI,Class,Database),
        class_frame(Class,Database,Frame),
        realise_triples(URI,Frame,Database,Unsorted)
    ->  sort(Unsorted,Edges)
    % There is no type in the database, so it doesn't exist...
    ;   Edges=[]).
@GavinMendelGleason
Copy link
Member

The choice points are indeed spurious. This entire section should be rewriten and the object_edges version looks better as well.

@matko matko added the core label Mar 5, 2021
@matko matko added this to actual-triage in Core dev (old) Mar 5, 2021
@matko matko moved this from triage to Later in Core dev (old) Mar 8, 2021
@GavinMendelGleason
Copy link
Member

Fixed in e28b1f4

Core dev (old) automation moved this from Later to Done Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants