Changelog
View SourceAll notable changes to this project will be documented in this file. This project adheres to Semantic Versioning and Keep a CHANGELOG.
v0.6.0 - 2025-04-09
Elixir versions < 1.14 and OTP version < 24 are no longer supported.
Added
- Support for RDF lists via the new
ordered_list_of/2type constructor that
can be used on the:typeofpropertyandlinkdefinitions in aschemasimilarly to thelist_of/2type constructor - Support for properties with
rdf:JSONvalues with the new:jsontype
v0.5.0 - 2024-08-07
This version upgrades to RDF.ex v2.0.
Elixir versions < 1.13 and OTP version < 23 are no longer supported.
Added
- option
:on_missing_descriptiononlinkmacro which allows to specify with value:use_rdf_nodethat a linked resource without a description should be kept as an RDF resource (RDF.IRIorRDF.BlankNode) when preloaded (instead of the default behaviour:empty_schemawhich creates an empty schema for the linked resource) - flag option
:validateonGrax.to_rdf/2which allows to turn off validation
Changed
- Replacement of
elixir_uuidwithuniqdependency
v0.4.1 - 2023-07-03
Fixed
- slow startup on large code bases due to long
Grax.Schema.Registryinitialization (thanks @semarco)
v0.4.0 - 2023-06-12
Added
- Grax schema mapping functions
from/1andfrom!/1on Grax schema modules, which allows to map one schema struct to another Grax.load/4andGrax.load!/4can now be called without providing a schema, which will be automatically detected based on therdf:typeof the loaded resource. The most specific schema with a class declaration matching one of therdf:types 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_mismatchoption is now supported on all types of links, including inverse links (previously it was available on union links only) Grax.Schema.schema?/1andGrax.Schema.struct?/1to determine whether a given module or struct is a Grax schema resp. Grax schema structGrax.schema/1to get the schema(s) of a given class IRIGrax.Schema.schema?/1to check if a given module or struct is aGrax.SchemaGrax.Schema.inherited_from?/1to check if a given module or struct is inherited from anotherGrax.SchemaGrax.id/1to get the id of a Grax struct (rather than of having to access:__id__field)Grax.reset_id/2to set a new id on a Grax structGrax.reset_id/1to set a new id on a Grax struct by reapplying its id schemaGrax.delete_additional_predicates/2to delete all additional statements with specific predicates
Changed
- 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
:polymorphicoption tofalseon alinkdefinition. However, the non-polymorphic behaviour still differs slightly from the previous version, in that, when:on_rdf_type_mismatchis 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_matcheswhen the resource is typed also with the broader classes. - The argument order of
Grax.load/4andGrax.load!/4has been changed to be the same as on the generatedloadfunctions 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 internalpredicationsfield ofRDF.Descriptions. 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/2now can handle the multitude of inputs as the respectiveRDF.Descriptioncounterpart. 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/1now. - You no longer can use
nilvalues on a property withGrax.put_additional_statements/2to remove statements with this property. You must use the newGrax.delete_additional_predicates/2function for this now.
- You no longer can pass the contents of the
- Rename
Grax.id/2toGrax.build_id/2and the generated__id__/1function on the Grax schema modules tobuild_id/1 - Rename
:on_type_mismatchlink option to:on_rdf_type_mismatchto make it clearer that it is only relevant during preloading from RDF data - Rename
Grax.Schema.InvalidPropertytoGrax.Schema.InvalidPropertyErrorfor 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)
Fixed
- a bug when preloading a nested schema with union links without values
- union links weren't validated properly
v0.3.5 - 2023-01-18
Fixed
- 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
v0.3.4 - 2022-11-03
This version upgrades to RDF.ex 1.0.
Elixir versions < 1.11 are no longer supported
Fixed
- a bug when reading the counter of a
Grax.Id.Counter.TextFile/2under Elixir 1.14
v0.3.3 - 2022-06-29
Added
Fixed
to_rdf/2failed when an inverse property was not a list (#1)
v0.3.2 - 2022-01-28
Added
on_load/3andon_to_rdf/3callbacks onGrax.SchemasGrax.Schemas 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!/2bang variant ofGrax.to_rdf/2
v0.3.1 - 2021-07-16
Added
- support for counter-based Grax ids
- support for blank nodes as Grax ids
Optimized
- improved Grax id schema lookup performance
v0.3.0 - 2021-05-26
Added
- Grax ids - see the new chapter in the Grax guide for more on this bigger feature
Changed
- not loaded links are no longer represented with
Grax.Link.NotLoadedstructs, but withRDF.IRIorRDF.BlankNodes instead - the value of link properties can be given as plain
RDF.IRI,RDF.BlankNodevalues or as vocabulary namespace terms onGrax.newandGrax.build - the value of properties with type
:irican be given as vocabulary namespace terms onGrax.newandGrax.build
v0.2.0 - 2021-03-16
Added
- heterogeneous link properties which can link different types of resources to different schemas
- schema inheritance
- support for cardinality constraints on properties
- support for
:requiredon link properties - support for custom
:from_rdfmappings on custom fields - support for custom mappings in separate modules
- the
buildfunctions can now be called with a single map when the map contains an id an:__id__field :contextfield onGrax.ValidationErrorexception with more context specific information
Changed
- 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/1orlist/0type builder functions - the default value of link properties has been changed to
nilrespective the empty list (previously it was aGrax.Link.NotLoadedstruct, which is now set explicitly during loading) - in the
Grax.buildandGrax.putfunctions duplicates in the given values are ignored - in the
Grax.buildandGrax.putfunctions a single value in a list for a non-list property will now be extracted, instead of leading to a validation error - failing
:requiredrequirements result in aGrax.Schema.CardinalityErrorinstead of aGrax.Schema.RequiredPropertyMissingexception - the opts on
Grax.to_rdf/2are now passed-through to theRDF.Graph.new/2constructor allowing to set the name of the graph, prefixes etc.
v0.1.0 - 2021-01-06
Initial release