anchor.diff:      parse_query(Rest, Context, Result#search_sql{cats_exclude=Cats2, tables=Tables1});
   
   %% hassubject=[id]
  -%% Give all things which have an outgoing edge to Id
  +%% Give all things which have an incoming edge to Id
   parse_query([{hassubject, Id}|Rest], Context, Result) when is_integer(Id) ->
       parse_query([{hassubject, [Id]}|Rest], Context, Result);
   parse_query([{hassubject, [Id]}|Rest], Context, Result) ->
  +    {A, Result1} = add_edge_join("object_id", Result),
  +    {Arg, Result2} = add_arg(Id, Result1),
  +    Result3 = add_where(A ++ ".subject_id = " ++ Arg, Result2),
  +    parse_query(Rest, Context, Result3);
  +
  +%% hassubject=[id,predicate,[alias]]
  +%% Give all things which have an incoming edge to Id with the given predicate
  +parse_query([{hassubject, [Id, Predicate]}|Rest], Context, Result) ->
  +    parse_query([{hassubject, [Id, Predicate, "rsc"]}|Rest], Context, Result);
  +parse_query([{hassubject, [Id, Predicate, Alias]}|Rest], Context, Result) ->
  +    {A, Result1} = add_edge_join(Alias, "object_id", Result),
  +    Result2 = case Id of
  +                  undefined -> Result1;
  +                  _ -> {Arg1, R} = add_arg(Id, Result1),
  +                       add_where(A ++ ".subject_id = " ++ Arg1, R)
  +              end,
  +    PredicateId = m_predicate:name_to_id_check(Predicate, Context),
  +    {Arg2, Result3} = add_arg(PredicateId, Result2),
  +    Result4 = add_where(A ++ ".predicate_id = " ++ Arg2, Result3),
  +    parse_query(Rest, Context, Result4);
  +parse_query([{hassubject, Id}|Rest], Context, Result) when is_list(Id) ->
  +    parse_query([{hassubject, [z_convert:to_integer(Id)]}|Rest], Context, Result);
  +
  +
  +%% hasobject=[id]
  +%% Give all things which have an outgoing edge to Id
  +parse_query([{hasobject, Id}|Rest], Context, Result) when is_integer(Id) ->
  +    parse_query([{hasobject, [Id]}|Rest], Context, Result);
  +parse_query([{hasobject, [Id]}|Rest], Context, Result) ->
       {A, Result1} = add_edge_join("subject_id", Result),
       {Arg, Result2} = add_arg(Id, Result1),
       Result3 = add_where(A ++ ".object_id = " ++ Arg, Result2),
       parse_query(Rest, Context, Result3);
   
  -%% hassubject=[id,predicate,[alias]]
  +%% hasobject=[id,predicate,[alias]]
   %% Give all things which have an outgoing edge to Id with the given predicate
  -parse_query([{hassubject, [Id, Predicate]}|Rest], Context, Result) ->
  -    parse_query([{hassubject, [Id, Predicate, "rsc"]}|Rest], Context, Result);
  -parse_query([{hassubject, [Id, Predicate, Alias]}|Rest], Context, Result) ->
  +parse_query([{hasobject, [Id, Predicate]}|Rest], Context, Result) ->
  +    parse_query([{hasobject, [Id, Predicate, "rsc"]}|Rest], Context, Result);
  +parse_query([{hasobject, [Id, Predicate, Alias]}|Rest], Context, Result) ->
       {A, Result1} = add_edge_join(Alias, "subject_id", Result),
       Result2 = case Id of
                     undefined -> Result1;
  
positive.code: %% hassubjectpredicate=predicate
  %% Give all things which have any incoming edge with given predicate
  parse_query([{hassubjectpredicate, Predicate}|Rest], Context, Result) ->
      {A, Result1} = add_edge_join("subject_id", Result),
      PredicateId = m_predicate:name_to_id_check(Predicate, Context),
      {Arg1, Result2} = add_arg(PredicateId, Result1),
      Result3 = add_where(A ++ ".predicate_id = " ++ Arg1, Result2),
  
negative.code: %% hasobjectpredicate=predicate
  %% Give all things which have any outgoing edge with given predicate
  parse_query([{hasobjectpredicate, Predicate}|Rest], Context, Result) ->
      {A, Result1} = add_edge_join("subject_id", Result),
      PredicateId = m_predicate:name_to_id_check(Predicate, Context),
      {Arg1, Result2} = add_arg(PredicateId, Result1),
      Result3 = add_where(A ++ ".predicate_id = " ++ Arg1, Result2),
  