All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning and Keep a CHANGELOG.
Elixir versions < 1.14 and OTP version < 24 are no longer supported.
- Support for RDF lists via the new
ordered_list_of/2
type constructor that
can be used on the:type
ofproperty
andlink
definitions in aschema
similarly to thelist_of/2
type constructor - Support for properties with
rdf:JSON
values with the new:json
type
This version upgrades to RDF.ex v2.0.
Elixir versions < 1.13 and OTP version < 23 are no longer supported.
- option
:on_missing_description
onlink
macro which allows to specify with value:use_rdf_node
that a linked resource without a description should be kept as an RDF resource (RDF.IRI
orRDF.BlankNode
) when preloaded (instead of the default behaviour:empty_schema
which creates an empty schema for the linked resource) - flag option
:validate
onGrax.to_rdf/2
which allows to turn off validation
- Replacement of
elixir_uuid
withuniq
dependency
- slow startup on large code bases due to long
Grax.Schema.Registry
initialization (thanks @semarco)
- Grax schema mapping functions
from/1
andfrom!/1
on Grax schema modules, which allows to map one schema struct to another Grax.load/4
andGrax.load!/4
can now be called without providing a schema, which will be automatically detected based on therdf:type
of the loaded resource. The most specific schema with a class declaration matching one of therdf:type
s will be selected.- The class mapping on a union type can now also be provided as a list of
{class_iri, schema}
tuples or just Grax schemas, for those which are associated with a class IRI with a class declaration. - the
:on_rdf_type_mismatch
option is now supported on all types of links, including inverse links (previously it was available on union links only) Grax.Schema.schema?/1
andGrax.Schema.struct?/1
to determine whether a given module or struct is a Grax schema resp. Grax schema structGrax.schema/1
to get the schema(s) of a given class IRIGrax.Schema.schema?/1
to check if a given module or struct is aGrax.Schema
Grax.Schema.inherited_from?/1
to check if a given module or struct is inherited from anotherGrax.Schema
Grax.id/1
to get the id of a Grax struct (rather than of having to access:__id__
field)Grax.reset_id/2
to set a new id on a Grax structGrax.reset_id/1
to set a new id on a Grax struct by reapplying its id schemaGrax.delete_additional_predicates/2
to delete all additional statements with specific predicates
- Links now have become polymorphic, i.e. the most specific
inherited schema matching one of the types of a linked resource is used.
Opting-out to non-polymorphic behaviour is possible by setting the
:polymorphic
option tofalse
on alink
definition. However, the non-polymorphic behaviour still differs slightly from the previous version, in that, when:on_rdf_type_mismatch
is set to:error
, preloading of an RDF
resource which is not typed with the class of the specified schema, but the class of an inherited schema, no longer leads to an error. - Preloading of union links whose schemas are in an inheritance relationship
are resolved to the most specific class and no longer result in an
:multiple_matches
when the resource is typed also with the broader classes. - The argument order of
Grax.load/4
andGrax.load!/4
has been changed to be the same as on the generatedload
functions of Grax schemas. - The internal representation of the
__additional_statements__
field of Grax schema structs was changed to use now the same format as the internalpredications
field ofRDF.Description
s. This allows various optimizations and a richer API for accessing the additional statements, e.g. all the functions to update the additional statements likeGrax.add_additional_statements/2
now can handle the multitude of inputs as the respectiveRDF.Description
counterpart. Unfortunately, this brings two additional breaking changes:- You no longer can pass the contents of the
__additional_statements__
field of one Grax schema as the additional statements to another one. You should instead pass the result ofGrax.additional_statements/1
now. - You no longer can use
nil
values on a property withGrax.put_additional_statements/2
to remove statements with this property. You must use the newGrax.delete_additional_predicates/2
function for this now.
- You no longer can pass the contents of the
- Rename
Grax.id/2
toGrax.build_id/2
and the generated__id__/1
function on the Grax schema modules tobuild_id/1
- Rename
:on_type_mismatch
link option to:on_rdf_type_mismatch
to make it clearer that it is only relevant during preloading from RDF data - Rename
Grax.Schema.InvalidProperty
toGrax.Schema.InvalidPropertyError
for consistency reasons - "heterogeneous link properties" are now called "union link properties" (since this name didn't appear in the code, this change only affects the documentation)
- a bug when preloading a nested schema with union links without values
- union links weren't validated properly
- additional statements with objects in MapSets weren't handled properly, which is critical in particular, because the objects in additional statements are kept in MapSets internally, which meant additional statements from one schema couldn't be passed to another schema
- raise a proper error when preloading of a link fails because a literal is given
This version upgrades to RDF.ex 1.0.
Elixir versions < 1.11 are no longer supported
- a bug when reading the counter of a
Grax.Id.Counter.TextFile/2
under Elixir 1.14
Grax.delete_additional_statements/2
to_rdf/2
failed when an inverse property was not a list (#1)
on_load/3
andon_to_rdf/3
callbacks onGrax.Schema
sGrax.Schema
s now have an__additional_statements__
field, which holds additional statements about the resource, which are not mapped to schema fields, but should be mapped back to RDFGrax.to_rdf!/2
bang variant ofGrax.to_rdf/2
- support for counter-based Grax ids
- support for blank nodes as Grax ids
- improved Grax id schema lookup performance
- Grax ids - see the new chapter in the Grax guide for more on this bigger feature
- not loaded links are no longer represented with
Grax.Link.NotLoaded
structs, but withRDF.IRI
orRDF.BlankNode
s instead - the value of link properties can be given as plain
RDF.IRI
,RDF.BlankNode
values or as vocabulary namespace terms onGrax.new
andGrax.build
- the value of properties with type
:iri
can be given as vocabulary namespace terms onGrax.new
andGrax.build
- heterogeneous link properties which can link different types of resources to different schemas
- schema inheritance
- support for cardinality constraints on properties
- support for
:required
on link properties - support for custom
:from_rdf
mappings on custom fields - support for custom mappings in separate modules
- the
build
functions can now be called with a single map when the map contains an id an:__id__
field :context
field onGrax.ValidationError
exception with more context specific information
- the way in which list types are defined in a schema has been changed from putting the
base type in square bracket to using one of the new
list_of/1
orlist/0
type builder functions - the default value of link properties has been changed to
nil
respective the empty list (previously it was aGrax.Link.NotLoaded
struct, which is now set explicitly during loading) - in the
Grax.build
andGrax.put
functions duplicates in the given values are ignored - in the
Grax.build
andGrax.put
functions a single value in a list for a non-list property will now be extracted, instead of leading to a validation error - failing
:required
requirements result in aGrax.Schema.CardinalityError
instead of aGrax.Schema.RequiredPropertyMissing
exception - the opts on
Grax.to_rdf/2
are now passed-through to theRDF.Graph.new/2
constructor allowing to set the name of the graph, prefixes etc.
Initial release