Add RDF.Resource.t type

This commit is contained in:
Marcel Otto 2022-02-25 17:18:03 +01:00
parent 9bb07c8259
commit f5d8d16bc9
4 changed files with 12 additions and 6 deletions

View file

@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and
- `:implicit_base` option on the `RDF.Turtle.Encoder` - `:implicit_base` option on the `RDF.Turtle.Encoder`
- `:base_description` option on the `RDF.Turtle.Encoder` - `:base_description` option on the `RDF.Turtle.Encoder`
- `RDF.Resource.t` type
- `RDF.Triple.coercible_t`, `RDF.Quad.coercible_t`, `RDF.Star.Triple.coercible_t` - `RDF.Triple.coercible_t`, `RDF.Quad.coercible_t`, `RDF.Star.Triple.coercible_t`
and `RDF.Star.Quad.coercible_t` types and `RDF.Star.Quad.coercible_t` types

5
lib/rdf/resource.ex Normal file
View file

@ -0,0 +1,5 @@
defmodule RDF.Resource do
alias RDF.{IRI, BlankNode}
@type t :: IRI.t() | BlankNode.t()
end

View file

@ -5,13 +5,13 @@ defmodule RDF.Statement do
An RDF statement is either a `RDF.Triple` or a `RDF.Quad`. An RDF statement is either a `RDF.Triple` or a `RDF.Quad`.
""" """
alias RDF.{BlankNode, IRI, Literal, Quad, Term, Triple, PropertyMap} alias RDF.{Resource, BlankNode, IRI, Literal, Quad, Term, Triple, PropertyMap}
import RDF.Guards import RDF.Guards
@type subject :: IRI.t() | BlankNode.t() @type subject :: Resource.t()
@type predicate :: IRI.t() | BlankNode.t() @type predicate :: Resource.t()
@type object :: IRI.t() | BlankNode.t() | Literal.t() @type object :: Resource.t() | Literal.t()
@type graph_name :: IRI.t() | BlankNode.t() | nil @type graph_name :: Resource.t() | nil
@type coercible_subject :: subject | atom | String.t() @type coercible_subject :: subject | atom | String.t()
@type coercible_predicate :: predicate | atom | String.t() @type coercible_predicate :: predicate | atom | String.t()

View file

@ -11,7 +11,7 @@ defprotocol RDF.Term do
see <https://www.w3.org/TR/sparql11-query/#defn_RDFTerm> see <https://www.w3.org/TR/sparql11-query/#defn_RDFTerm>
""" """
@type t :: RDF.IRI.t() | RDF.BlankNode.t() | RDF.Literal.t() @type t :: RDF.Resource.t() | RDF.Literal.t()
@doc """ @doc """
Checks if the given value is a RDF term. Checks if the given value is a RDF term.