Rename BGP matcher algorithm behaviour

This commit is contained in:
Marcel Otto 2020-06-08 10:16:22 +02:00
parent 1ca082cbb2
commit 2fca23209b
3 changed files with 7 additions and 7 deletions

View file

@ -1,4 +1,4 @@
defmodule RDF.Query.BGP do
defmodule RDF.Query.BGP.Matcher do
@moduledoc """
An interface for various BGP matching algorithm implementations.
"""

View file

@ -1,10 +1,10 @@
defmodule RDF.Query.BGP.Simple do
@behaviour RDF.Query.BGP
@behaviour RDF.Query.BGP.Matcher
alias RDF.Query.BGP.{QueryPlanner, BlankNodeHandler}
alias RDF.{Graph, Description}
@impl RDF.Query.BGP
@impl RDF.Query.BGP.Matcher
def query(data, pattern, opts \\ [])
def query(_, [], _), do: [%{}] # https://www.w3.org/TR/sparql11-query/#emptyGroupPattern
@ -19,7 +19,7 @@ defmodule RDF.Query.BGP.Simple do
|> BlankNodeHandler.postprocess(bnode_state, opts)
end
@impl RDF.Query.BGP
@impl RDF.Query.BGP.Matcher
def query_stream(data, pattern, opts \\ []) do
query(data, pattern, opts)
|> Stream.into([])

View file

@ -1,11 +1,11 @@
defmodule RDF.Query.BGP.Stream do
@behaviour RDF.Query.BGP
@behaviour RDF.Query.BGP.Matcher
alias RDF.{Graph, Description}
alias RDF.Query.BGP.{QueryPlanner, BlankNodeHandler}
@impl RDF.Query.BGP
@impl RDF.Query.BGP.Matcher
def query_stream(data, pattern, opts \\ [])
def query_stream(_, [], _), do: stream([%{}]) # https://www.w3.org/TR/sparql11-query/#emptyGroupPattern
@ -20,7 +20,7 @@ defmodule RDF.Query.BGP.Stream do
|> BlankNodeHandler.postprocess(bnode_state, opts)
end
@impl RDF.Query.BGP
@impl RDF.Query.BGP.Matcher
def query(data, pattern, opts \\ []) do
query_stream(data, pattern, opts)
|> Enum.to_list()