%-------------------------------------------------------------------------% % % Licensed to the Apache Software Foundation (ASF) under one or more % contributor license agreements. See the NOTICE file distributed with % this work for additional information regarding copyright ownership. % The ASF licenses this file to You under the Apache License, Version 2.0 % (the "License"); you may not use this file except in compliance with % the License. You may obtain a copy of the License at % % http://www.apache.org/licenses/LICENSE-2.0 % % Unless required by applicable law or agreed to in writing, software % distributed under the License is distributed on an "AS IS" BASIS, % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % See the License for the specific language governing permissions and % limitations under the License. % %-------------------------------------------------------------------------% :- module graph. :- interface. :- import_module string. :- import_module list. :- type graph == list({ string, string, string }). :- pred contains(graph, string). :- mode contains(in, in) is semidet. :- mode contains(in, out) is nondet. :- pred contains(graph, string, string, string). :- mode contains(in, in, in, in) is semidet. :- mode contains(in, in, in, out) is nondet. :- mode contains(in, in, out, in) is nondet. :- mode contains(in, out, in, in) is nondet. :- mode contains(in, in, out, out) is nondet. :- mode contains(in, out, in, out) is nondet. :- mode contains(in, out, out, in) is nondet. :- mode contains(in, out, out, out) is nondet. :- implementation. contains(G, S) :- contains(G, S, _, _); contains(G, _, S, _); contains(G, _, _, S). contains([ Head | Tail ], S, P, O) :- Head = { S, P, O }; contains(Tail, S, P, O).