@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix : <http://example.org/#>.

# \Every x: type(x, Resource)
{
    ?x a rdfs:Resource.
} <= true.

# Everybody loves somebody who is lonely
{
    ?A :loves ?B.
} <= {
    (?A) log:skolem ?B.
}.

{
    ?B :is :lonely.
} <= {
    (?A) log:skolem ?B.
}.

# query
{
    :pat a rdfs:Resource.
    :bob :loves ?x.
    ?x :is :lonely.
} =^ {
    :pat a rdfs:Resource.
    :bob :loves ?x.
    ?x :is :lonely.
}.
