aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-04-05 23:12:07 +0000
committerDavid Robillard <d@drobilla.net>2011-04-05 23:12:07 +0000
commitbd6e5f17c38e0e0291fa40ad57a83b1009b76c08 (patch)
tree149d96a7e89719356d14c2689b6faf908e6ac090
parentf738ee3d9fa250d2ffad031d05663f888df56130 (diff)
downloadlv2-bd6e5f17c38e0e0291fa40ad57a83b1009b76c08.tar.xz
Make atom:String a simple C string (in UTF-8), and atom:Literal a full RDF literal.
Bump version number.
-rw-r--r--ext/atom.lv2/atom.h11
-rw-r--r--ext/atom.lv2/atom.ttl69
-rw-r--r--ext/atom.lv2/manifest.ttl2
3 files changed, 55 insertions, 27 deletions
diff --git a/ext/atom.lv2/atom.h b/ext/atom.lv2/atom.h
index b39844b..d3fd7cf 100644
--- a/ext/atom.lv2/atom.h
+++ b/ext/atom.lv2/atom.h
@@ -88,12 +88,13 @@ typedef struct _LV2_Atom {
typedef LV2_Atom LV2_Atom_Reference;
/**
- The body of an atom:String.
+ The body of an atom:Literal.
*/
-typedef struct _LV2_Atom_String {
- uint32_t lang; /**< The ID of the language of this string */
- uint8_t str[]; /**< Null-terminated string data in UTF-8 encoding */
-} LV2_Atom_String;
+typedef struct _LV2_Atom_Literal {
+ uint32_t datatype; /**< The ID of the datatype of this literal */
+ uint32_t lang; /**< The ID of the language of this literal */
+ uint8_t str[]; /**< Null-terminated string data in UTF-8 encoding */
+} LV2_Atom_Literal;
/**
The body of an atom:Vector.
diff --git a/ext/atom.lv2/atom.ttl b/ext/atom.lv2/atom.ttl
index 10b2aac..25318d9 100644
--- a/ext/atom.lv2/atom.ttl
+++ b/ext/atom.lv2/atom.ttl
@@ -1,6 +1,5 @@
-
# LV2 Atom Extension
-# Copyright (C) 2007-2010 David Robillard <d@drobilla.net>
+# Copyright (C) 2007-2011 David Robillard <d@drobilla.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@@ -31,6 +30,10 @@
<http://lv2plug.in/ns/ext/atom>
a lv2:Specification ;
doap:name "LV2 Atom" ;
+ doap:release [
+ doap:revision "0.1" ;
+ doap:created "2011-04-05"
+ ] ;
doap:maintainer [
a foaf:Person ;
foaf:name "David Robillard" ;
@@ -125,41 +128,63 @@ atom:String a rdfs:Class ;
rdfs:subClassOf atom:Atom ;
rdfs:label "String" ;
lv2:documentation """
-<p>A UTF-8 encoded string, with an optional language tag. An
-<a href="urn:struct:LV2_Atom_String">LV2_Atom_String</a> has an <a href="#ID">ID</a>
-<code>lang</code> followed by the string data in UTF-8 encoding. The length of the
-string data in bytes is <code>size - sizeof(uint32_t)</code>, including the
-terminating NULL character. The <code>lang</code> may be any URI; to
-describe a human language, use http://lexvo.org/id/term/LANG where LANG is
-an <a href="http://www.loc.gov/standards/iso639-2/">ISO 693-2</a> or
-<a href="http://www.loc.gov/standards/iso639-2/">ISO 693-3</a> language code.</p>
+<p>A UTF-8 encoded string.</p>
+
+<p>The body of an atom:String is a C string in UTF-8 encoding, i.e. an array of
+bytes (<code>uint8_t</code>) terminated with a NULL byte (<code>'\\0'</code>).</p>
+
+<p>This type can be used for free-form strings, but in most cases it is better to
+use atom:Literal since this supports a language tag or datatype. Implementations
+SHOULD NOT use atom:String unless translating the string does not make sense and
+the string has no meaningful datatype.</p>
+""" .
+
+
+atom:Literal a rdfs:Class ;
+ rdfs:subClassOf atom:Atom ;
+ rdfs:label "String Literal" ;
+ lv2:documentation """
+<p>A UTF-8 encoded string literal, with an optional language tag or datatype.</p>
+
+<p>This type is compatible with an RDF literal and is capable of expressing a
+string in any language, or a value of any type. An LV2_Atom_Literal has an <a
+href="#ID">ID</a> <code>lang</code> and <code>datatype</code> followed by the
+string data in UTF-8 encoding. The length of the string data in bytes is
+<code>size - (2 * sizeof(uint32_t))</code>, including the terminating NULL
+character. The <code>lang</code> field SHOULD be a URI of the form
+&lt;http://lexvo.org/id/term/LANG&gt; where LANG is an <a
+href="http://www.loc.gov/standards/iso639-2/">ISO 693-2</a> or <a
+href="http://www.loc.gov/standards/iso639-2/">ISO 693-3</a> language code.</p>
<p>For example, "Hello" in English:</p>
<pre>
struct LV2_Atom {
- uint16_t type = uri_to_id(atom:String);
- uint16_t size = 10;
+ uint16_t type = uri_to_id(atom:Literal);
+ uint16_t size = 14;
}
-uint32_t lang = uri_to_id("http://lexvo.org/id/term/en");
-char str[] = "Hello";
+uint32_t datatype = 0;
+uint32_t lang = uri_to_id("http://lexvo.org/id/term/en");
+char str[] = "Hello";
</pre>
and French:
<pre>
struct LV2_Atom {
- uint16_t type = uri_to_id(atom:String);
- uint16_t size = 12;
+ uint16_t type = uri_to_id(atom:Literal);
+ uint16_t size = 16;
}
-uint32_t lang = uri_to_id("http://lexvo.org/id/term/fr");
-char str[] = "Bonjour";
+uint32_t datatype = 0;
+uint32_t lang = uri_to_id("http://lexvo.org/id/term/fr");
+char str[] = "Bonjour";
</pre>
<p>or a Turtle string:</p>
<pre>
struct LV2_Atom {
- uint16_t type = uri_to_id(atom:String);
- uint16_t size = 60;
+ uint16_t type = uri_to_id(atom:Literal);
+ uint16_t size = 64;
}
-uint32_t lang = uri_to_id("http://www.w3.org/2008/turtle#turtle");
-char str[] = "&lt;http://example.org/foo&gt; a &lt;http://example.org/Thing&gt; ."
+uint32_t datatype = uri_to_id("http://www.w3.org/2008/turtle#turtle");
+uint32_t lang = 0;
+char str[] = "&lt;http://example.org/foo&gt; a &lt;http://example.org/Thing&gt; ."
</pre>
""" .
diff --git a/ext/atom.lv2/manifest.ttl b/ext/atom.lv2/manifest.ttl
index 65a4e6e..d8488b1 100644
--- a/ext/atom.lv2/manifest.ttl
+++ b/ext/atom.lv2/manifest.ttl
@@ -3,5 +3,7 @@
<http://lv2plug.in/ns/ext/atom>
a lv2:Specification ;
+ lv2:minorVersion 0 ;
+ lv2:microVersion 1 ;
rdfs:seeAlso <atom.ttl> .