p_select_match_fn :: RDF g => (Triple -> Triple -> Bool)
  -> (Triple -> (NodeSelector, NodeSelector, NodeSelector))
  -> (g -> Triples) -> g -> Property
p_select_match_fn tripleCompareFn mkPatternFn _triplesOf gr =
  forAll (tripleFromGen _triplesOf gr) f
  where
    f :: Maybe Triple -> Bool
    f Nothing = True
    f (Just t) =
      let
        all_ts = triplesOf gr
        all_ts_sorted = uordered all_ts
        results = uordered $ selectC gr (mkPatternFn t)
        notResults = ldiff all_ts_sorted results
      in
        all (tripleCompareFn t) results &&
        all (not . tripleCompareFn t) notResults
p_select_match_fn :: RDF g => (Triple -> Triple -> Bool)
  -> (Triple -> (NodeSelector, NodeSelector, NodeSelector))
  -> (g -> Triples) -> g -> Property
p_select_match_fn tripleCompareFn mkPatternFn _triplesOf gr =
  forAll (tripleFromGen _triplesOf gr) f
  where
    f :: Maybe Triple -> Bool
    f Nothing = True
    f (Just t) =
      let
        all_ts = triplesOf gr
        all_ts_sorted = uordered all_ts
        results = uordered $ selectC gr (mkPatternFn t)
        notResults = ldiff all_ts_sorted results
      in
        all (tripleCompareFn t) results &&
        all (not . tripleCompareFn t) notResults
p_select_match_fn tripleCompareFn mkPatternFn _triplesOf gr =
  forAll (tripleFromGen _triplesOf gr) f
  where
    f :: Maybe Triple -> Bool
    f Nothing = True
    f (Just t) =
      let
        all_ts = triplesOf gr
        all_ts_sorted = uordered all_ts
        results = uordered $ selectC gr (mkPatternFn t)
        notResults = ldiff all_ts_sorted results
      in
        all (tripleCompareFn t) results &&
        all (not . tripleCompareFn t) notResults