Add RDF.Guards is_statement/1 and is_quad/1
This commit is contained in:
parent
bb62e631f3
commit
8cb72f5ccc
2 changed files with 12 additions and 0 deletions
|
@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and
|
|||
### Added
|
||||
|
||||
- `RDF.Graph.new/2` and `RDF.Graph.add/2` support the addition of `RDF.Dataset`s
|
||||
- new guards in `RDF.Guards`: `is_statement/1` and `is_quad/1`
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -14,4 +14,15 @@ defmodule RDF.Guards do
|
|||
Returns if the given value is a triple, i.e. a tuple with three elements.
|
||||
"""
|
||||
defguard is_triple(t) when is_tuple(t) and tuple_size(t) == 3
|
||||
|
||||
@doc """
|
||||
Returns if the given value is a quad, i.e. a tuple with four elements.
|
||||
"""
|
||||
defguard is_quad(q) when is_tuple(q) and tuple_size(q) == 4
|
||||
|
||||
@doc """
|
||||
Returns if the given value is a triple or a quad
|
||||
in terms of `is_triple/1` and `is_quad/1`.
|
||||
"""
|
||||
defguard is_statement(s) when is_triple(s) or is_quad(s)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue