Sord 0.14.0

Sord 0.14.0 is out. Sord is a lightweight C library for storing RDF statements in memory.

Developer note: this release does not break the ABI, but the semantics of iterators has changed: any modification to a model invalidates iterators on that model. Applications that keep iterators while modifying a model will need to be fixed. This is a consequence of a new underlying data structure, which significantly reduces memory overhead and improves performance.

Changes:

  • Reduce memory usage and increase performance with a better data structure
  • Add sord_erase() for erasing statements via an iterator
  • Fix bugs with stores that contain both graphs and default graph statements
  • Fix crash caused by multiple deletion of datatype nodes
  • Fix compilation on compilers that do not support -pthread flag
  • Fix minor memory leak in sordi
  • Fix using sordi with stdin
  • Show sordi errors in standard format
  • sord_validate: More extensive validation, including cardinality, PlainLiteral, and someValuesFrom restrictions.
  • Improve test coverage
  • Upgrade to waf 1.8.14
  • Flattr this!

Serd 0.22.0

Serd 0.22.0 is out. Serd is a lightweight, high-performance, dependency-free C library for RDF syntax which supports reading and writing Turtle and NTriples.

Changes:

  • Remove dependence on fmax() to avoid portability issues
  • Fix serd_reader_read_file() for URIs with escaped characters (spaces)
  • Add serd_reader_set_strict() and -l (lax) option to serdi to tolerate parsing URIs with escaped characters
  • Fix reading statements ending with a blank then dot with no space
  • Fix clash resolution when a blank node ID prefix is set
  • Fix serializing fractional decimals that would round up
  • Add support for Turtle named inline nodes extension
  • Report errors for invalid IRI characters and missing terminators
  • Show serdi errors in standard format
  • Fix warnings when building with ISO C++ compilers
  • Upgrade to waf 1.8.14

Flattr this!

Serd 0.20.0

Serd 0.20.0 is out. Serd is a lightweight, high-performance, dependency-free C library for RDF syntax which supports reading and writing Turtle and NTriples.

Changes:

  • Support new RDF 1.1 Turtle.
  • Don’t write xsd:decimal literals to Turtle bare if they would not be read back with the same type.
  • Fix possible crash in serd_writer_end_anon() when writing invalid lists.
  • Generate blank names like _:b1 and _:B2 not _:genid1 _:docid2.
  • Correctly handle posix_memalign failure.
  • Fix const-correctness violation for reader input string.
  • Add -lm to pkg-config libs.
  • Update to waf 1.7.16.

Flattr this!

Sord 0.12.0

Sord 0.12.0 is out. Sord is a lightweight C library for storing RDF statements in memory.

Changes:

  • Add sord_get() for easily getting single property values
  • sord_validate: Pass type check when range is xsd:anyURI and value is a URI
  • sord_validate: Support any subClassOf rdf:Property, not just baked-in ones
  • sordmm.hpp: Add convenient constructors for decimal and integer literals
  • sordmm.hpp: Add Node::to_serd_node()
  • sordmm.hpp: Don’t automatically add RDF namespace prefix to world
  • Update to waf 1.7.9 and autowaf r90 (install docs to versioned directory)

Flattr this!

Serd 0.18.2

Serd 0.18.2 is out. Serd is a lightweight, high-performance, dependency-free C library for RDF syntax which supports reading and writing Turtle and NTriples.

This release fixes a few potential crashes caused by garbage input, and incorrect abbreviation of rdf:type in subject and object position.

Changes:

  • Fix crash when serd_node_new_decimal is called with infinity or NaN
  • Fix crash when resolving against non-standard base URIs
  • Fix bug that caused “a” abbreviation in non-predicate position
  • Disable timestamps in HTML documentation for reproducible build
  • Fix clashing symbol “error” in amalgamation build
  • Update to waf 1.7.8 and autowaf r90 (install docs to versioned directory)

Flattr this!

Sord 0.10.4

Sord 0.10.4 is out. Sord is a lightweight C library for storing RDF statements in memory.

This release updates sord_validate to properly implement datatype validation as described in my previous post.

Changes:

  • Implement better data type validation in sord_validate conformant with the XSD and OWL specifications
  • Fix memory leaks in sord_validate
  • Install sord_validate man page
  • Disable timestamps in HTML documentation for reproducible build

Flattr this!

How to define a datatype in RDF

I had to do some digging around to figure out how to define a new Datatype with restrictions in RDF, so I thought it might make a useful post to save someone else the trouble in the future.

RDF datatypes are based on XSD datatypes, which are often used directly. Unfortunately, most implementations simply have the XSD types baked in and do not support or validate new datatype descriptions (though at least sord_validate can). Regardless, it is sometimes necessary to define a datatype with a specific restriction so it can be machine validated. It’s a bit tricky to figure out how to do this, since everything is buried in specifications that aren’t as triple oriented as they should be. So, here is an example of defining a datatype restricted by regular expression in Turtle, derived from the OWL documentation:

<http://example.org/CSymbol>
	a rdfs:Datatype ;
	rdfs:comment "A symbol in the C programming language" ;
	owl:onDatatype xsd:string ;
	owl:withRestrictions (
		[
			xsd:pattern "[_a-zA-Z][_a-zA-Z0-9]*"
		]
	) .

The XSD specification defines several constraining facets you can use in this way. See the XSD specification for details, but the most obvious and useful for RDF are: xsd:length, xsd:minLength, xsd:maxLength, xsd:pattern, xsd:maxInclusive, xsd:maxExclusive, xsd:minInclusive, xsd:minExclusive. For example, you can define a numeric type with restricted range like so:

<http://example.org/AnswerishInteger>
	a rdfs:Datatype ;
	rdfs:comment "An integer between 24 and 42 inclusive" ;
	owl:onDatatype xsd:integer ;
	owl:withRestrictions (
		[
			xsd:minInclusive 24
		] [
			xsd:maxInclusive 42
		]
	) .

Defining datatypes in this way and using them as the rdfs:range for properties is a good idea because it describes which values are valid in a machine readable way. This makes it possible for simple generic tools to validate data, ensuring that all literals are valid values for the property they describe.

Flattr this!

Sratom 0.4.0

Sratom 0.4.0 is out. Sratom is a small C library for serialising LV2 atoms to/from Turtle.

This release fixes reading objects with several rdf:type properties, and adds support for serialising blank nodes more elegantly, particularly useful for serialising messages to and from plugins for human inspection, storage, or network transmission. API has been added, but it remains backwards compatible with all previous releases.

Changes:

  • Correctly read objects with several rdf:type properties
  • Support writing Object Atoms as top level descriptions if subject and predicate are not given
  • Fix various hyper-strict warnings
  • Upgrade to waf 1.7.2

Flattr this!