Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :- dynamic found_data/4.
- fresh_bnode(Bnode) :-
- gensym(bn, Bnode).
- solve([]).
- solve([Goal | Rest]) :-
- (
- Goal = concept_data(_,_,_,_)
- ->
- query(Goal)
- ;
- call(Goal)
- ),
- solve(Rest).
- solve2([]).
- solve2([Goal | Rest]) :-
- (
- Goal = concept_data(C,S,P,O)
- ->
- found_data(C,S,P,O)
- ;
- call(Goal)
- ),
- solve2(Rest).
- query(concept_data(C, S, P, O)) :-
- (
- found_data(C, S, P, O)
- ->
- true
- ;
- (
- query2(concept_data(C, S, P, O), Head),
- findall(
- _,
- (
- member(concept_data(C1, S1, P1, O1), Head),
- assertz(found_data(C1, S1, P1, O1))
- ),
- _
- )
- )
- ).
- query2(concept_data(C, S, P, O), Head) :-
- (
- (
- implication(Head, Body),
- member(concept_data(C, S, P, O), Head)
- )
- ->
- solve2(Body)
- ).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement