Repository: SINTEF/dlite (language: python)

Issue:
Remove iri from instances and properties
In the spirit of SOFT, we want to be able to relate an instance to different ontologies depending on context, or to refer to multiple ontologies at the same time. For such flexibility, it is better to remove the iri's from instances and properties and add them at an ontological level instead.

This also simplifies the instances and properties which is always welcome


Discussion / hints:

Fix patch:
diff --git a/bindings/fortran/dlite.f90 b/bindings/fortran/dlite.f90
index 0bfcf8d33..22796b188 100644
--- a/bindings/fortran/dlite.f90
+++ b/bindings/fortran/dlite.f90
@@ -39,7 +39,6 @@ module DLite
      procedure :: save_url => dlite_instance_save_url
      procedure :: get_uuid => dlite_instance_get_uuid
      procedure :: get_uri => dlite_instance_get_uri
-     procedure :: get_iri => dlite_instance_get_iri          
      procedure :: get_dimension_size => dlite_instance_get_dimension_size
      procedure :: get_dimension_size_by_index => dlite_instance_get_dimension_size_by_index
      procedure :: get_property => dlite_instance_get_property
@@ -176,12 +175,6 @@ type(c_ptr) function dlite_instance_get_uri_c(instance) &
     type(c_ptr), value, intent(in)                         :: instance
   end function dlite_instance_get_uri_c
 
-  type(c_ptr) function dlite_instance_get_iri_c(instance) &
-      bind(C,name='dlite_instance_get_iri')
-    import c_ptr
-    type(c_ptr), value, intent(in)                         :: instance
-  end function dlite_instance_get_iri_c
-
   integer(c_size_t) function dlite_instance_get_dimension_size_c(instance, name) &
       bind(C,name="dlite_instance_get_dimension_size")
     import c_ptr, c_char, c_size_t
@@ -243,14 +236,12 @@ end function dlite_meta_decref_c
   ! --------------------------------------------------------
   !
   ! DLiteMetaModel *dlite_metamodel_create(const char *uri,
-  !                                        const char *metaid,
-  !                                        const char *iri);
-  type(c_ptr) function dlite_metamodel_create_c(uri, metaid, iri) &
+  !                                        const char *metaid);
+  type(c_ptr) function dlite_metamodel_create_c(uri, metaid) &
     bind(C,name="dlite_metamodel_create")
     import c_char, c_ptr
     character(len=1,kind=c_char), dimension(*), intent(in) :: uri
     character(len=1,kind=c_char), dimension(*), intent(in) :: metaid
-    character(len=1,kind=c_char), dimension(*), intent(in) :: iri
   end function dlite_metamodel_create_c
 
   ! void dlite_metamodel_free(DLiteMetaModel *model);
@@ -285,16 +276,14 @@ end function dlite_metamodel_add_dimension_c
   !                                  const char *name,
   !                                  const char *typename,
   !                                  const char *unit,
-  !                                  const char *iri,
   !                                  const char *description);
-  integer(c_int) function dlite_metamodel_add_property_c(model, name, typename, unit, iri, description) &
+  integer(c_int) function dlite_metamodel_add_property_c(model, name, typename, unit, description) &
     bind(C,name="dlite_metamodel_add_property")
     import c_int, c_ptr, c_char
     type(c_ptr), value, intent(in)                         :: model
     character(len=1,kind=c_char), dimension(*), intent(in) :: name
     character(len=1,kind=c_char), dimension(*), intent(in) :: typename
     character(len=1,kind=c_char), dimension(*), intent(in) :: unit
-    character(len=1,kind=c_char), dimension(*), intent(in) :: iri
     character(len=1,kind=c_char), dimension(*), intent(in) :: description
   end function dlite_metamodel_add_property_c
 
@@ -434,7 +423,6 @@ function dlite_instance_create_from_id(metaid, ndim, dims, id) result(instance)
     endif
     !instance%uuid =
     !instance%uri =
-    !instance%iri =
   end function dlite_instance_create_from_id
 
   function dlite_instance_load(storage, id) result(instance)
@@ -502,14 +490,6 @@ function dlite_instance_get_uri(instance) result(uri)
     call c_f_string(cptr, uri)
   end function dlite_instance_get_uri
 
-  function dlite_instance_get_iri(instance) result(iri)
-    class(DLiteInstance), intent(in) :: instance
-    character(len=256)               :: iri
-    type(c_ptr) :: cptr
-    cptr = dlite_instance_get_iri_c(instance%cinst)
-    call c_f_string(cptr, iri)
-  end function dlite_instance_get_iri
-
   function dlite_instance_get_dimension_size(instance, name) result(n)
     class(DLiteInstance), intent(in) :: instance
     character(len=*), intent(in)     :: name
@@ -601,26 +581,23 @@ function dlite_meta_decref(meta) result(count)
     if (count .le. 0) then
       meta%cptr = c_null_ptr
       count = 0
-    endif    
+    endif
   end function dlite_meta_decref
 
   ! --------------------------------------------------------
   ! Fortran methods for DLiteMetaModel
   ! --------------------------------------------------------
 
-  function dlite_metamodel_create(uri, metaid, iri) result(model)
+  function dlite_metamodel_create(uri, metaid) result(model)
     character(len=*), intent(in) :: uri
     character(len=*), intent(in) :: metaid
-    character(len=*), intent(in) :: iri
     character(len=1,kind=c_char) :: uri_c(len_trim(uri)+1)
     character(len=1,kind=c_char) :: metaid_c(len_trim(metaid)+1)
-    character(len=1,kind=c_char) :: iri_c(len_trim(iri)+1)
     type(DLiteMetaModel)         :: model
 
     call f_c_string(uri, uri_c)
     call f_c_string(metaid, metaid_c)
-    call f_c_string(iri, iri_c)
-    model%cptr = dlite_metamodel_create_c(uri_c, metaid_c, iri_c)
+    model%cptr = dlite_metamodel_create_c(uri_c, metaid_c)
   end function dlite_metamodel_create
 
   subroutine dlite_metamodel_free(model)
@@ -660,27 +637,24 @@ function dlite_metamodel_add_dimension(model, name, description) result(status)
   end function dlite_metamodel_add_dimension
 
   function dlite_metamodel_add_property(model, name, typename, &
-                                        unit, iri, description) result(status)
+                                        unit, description) result(status)
     class(DLiteMetaModel)        :: model
     character(len=*), intent(in) :: name
     character(len=*), intent(in) :: typename
     character(len=*), intent(in) :: unit
-    character(len=*), intent(in) :: iri
     character(len=*), intent(in) :: description
     character(len=1,kind=c_char) :: name_c(len_trim(name)+1)
     character(len=1,kind=c_char) :: typename_c(len_trim(typename)+1)
     character(len=1,kind=c_char) :: unit_c(len_trim(unit)+1)
-    character(len=1,kind=c_char) :: iri_c(len_trim(iri)+1)
     character(len=1,kind=c_char) :: description_c(len_trim(description)+1)
     integer(c_int)                  :: status_c
     integer                      :: status
     call f_c_string(name, name_c)
     call f_c_string(typename, typename_c)
     call f_c_string(unit, unit_c)
-    call f_c_string(iri, iri_c)
     call f_c_string(description, description_c)
     status_c = dlite_metamodel_add_property_c(model%cptr, name_c, typename_c, &
-                                              unit_c, iri_c, description_c)
+                                              unit_c, description_c)
     status = status_c
   end function dlite_metamodel_add_property
 
diff --git a/bindings/python/dlite-entity-python.i b/bindings/python/dlite-entity-python.i
index d8e80f505..0b732bb35 100644
--- a/bindings/python/dlite-entity-python.i
+++ b/bindings/python/dlite-entity-python.i
@@ -113,7 +113,6 @@ def get_instance(id: "str", metaid: "str"=None, check_storages: "bool"=True) ->
     def __repr__(self):
         dims = ', dims=%r' % self.dims.tolist() if self.ndims else ''
         unit = ', unit=%r' % self.unit if self.unit else ''
-        #iri = ', iri=%r' % self.iri if self.iri else ''
         descr = ', description=%r' %self.description if self.description else ''
         return 'Property(%r, type=%r%s%s%s)' % (
             self.name, self.type, dims, unit, descr)
@@ -127,8 +126,6 @@ def get_instance(id: "str", metaid: "str"=None, check_storages: "bool"=True) ->
             d['dims'] = self.dims.tolist()
         if self.unit:
             d['unit'] = self.unit
-        #if self.iri:
-        #    d['iri'] = self.iri
         if self.description:
             d['description'] = self.description
         return d
@@ -137,7 +134,6 @@ def get_instance(id: "str", metaid: "str"=None, check_storages: "bool"=True) ->
         """Returns a representation of self as a tuple of strings."""
         return (self.name, self.type, ','.join(str(d) for d in self.dims),
                 '' if self.unit is None else self.unit,
-                #'' if self.iri is None else self.iri,
                 '' if self.description is None else self.description)
 
     type = property(get_type, doc='Type name.')
@@ -228,8 +224,6 @@ def get_instance(id: "str", metaid: "str"=None, check_storages: "bool"=True) ->
         raise ValueError(f'No property "{name}" in "{self.uri}"')
 
     meta = property(get_meta, doc="Reference to the metadata of this instance.")
-    #iri = property(get_iri, set_iri,
-    #               doc="Unique IRI to corresponding concept in an ontology.")
     dimensions = property(
         lambda self: OrderedDict((d.name, int(v))
                                  for d, v in zip(self.meta['dimensions'],
diff --git a/bindings/python/dlite-entity.i b/bindings/python/dlite-entity.i
index 245109544..4f099557b 100644
--- a/bindings/python/dlite-entity.i
+++ b/bindings/python/dlite-entity.i
@@ -13,7 +13,6 @@
 DLiteProperty *
 dlite_swig_create_property(const char *name, enum _DLiteType type,
                            size_t size, obj_t *dims, const char *unit,
-                           const char *iri,
                            const char *description)
 {
   DLiteProperty *p = calloc(1, sizeof(DLiteProperty));
@@ -33,7 +32,6 @@ dlite_swig_create_property(const char *name, enum _DLiteType type,
     p->dims = NULL;
   }
   if (unit) p->unit = strdup(unit);
-  if (iri) p->iri = strdup(iri);
   if (description) p->description = strdup(description);
   return p;
 }
@@ -123,7 +121,7 @@ struct _DLiteDimension {
 %feature("docstring", "\
 Creates a new property.
 
-Property(name, type, dims=None, unit=None, iri=None, description=None)
+Property(name, type, dims=None, unit=None, description=None)
     Creates a new property with the provided attributes.
 
 Property(seq)
@@ -141,27 +139,23 @@ struct _DLiteProperty {
   size_t size;
   int ndims;
   char *unit;
-  //char *iri;
   char *description;
 };
 
 %extend _DLiteProperty {
   _DLiteProperty(const char *name, const char *type,
                  obj_t *dims=NULL, const char *unit=NULL,
-                 //const char *iri=NULL,
                  const char *description=NULL) {
     DLiteType dtype;
     size_t size;
-    const char *iri=NULL;
     if (dlite_type_set_dtype_and_size(type, &dtype, &size)) return NULL;
-    return dlite_swig_create_property(name, dtype, size, dims, unit, iri,
+    return dlite_swig_create_property(name, dtype, size, dims, unit,
                                       description);
   }
   ~_DLiteProperty() {
     free($self->name);
     if ($self->dims) free_str_array($self->dims, $self->ndims);
     if ($self->unit) free($self->unit);
-    //if ($self->iri) free($self->iri);
     if ($self->description) free($self->description);
     free($self);
   }
@@ -319,7 +313,7 @@ struct _DLiteInstance {
       if (inst) dlite_errclr();
       return inst;
     } else if (uri && dimensions && properties && description){
-       DLiteMeta *inst = dlite_meta_create(uri, NULL, description,
+       DLiteMeta *inst = dlite_meta_create(uri, description,
                                         ndimensions, dimensions,
                                         nproperties, properties);
       if (inst) dlite_errclr();
@@ -339,18 +333,6 @@ struct _DLiteInstance {
     return (const DLiteInstance *)$self->meta;
   }
 
-  %feature("docstring", "Returns ontology IRI reference.") get_iri;
-  const char *get_iri() {
-    return $self->iri;
-  }
-
-  %feature("docstring", "Sets ontology IRI (no argument clears the "
-           "IRI).") set_iri;
-  void set_iri(const char *iri=NULL) {
-    if ($self->iri) free((char *)self->iri);
-    $self->iri = (iri) ? strdup(iri) : NULL;
-  }
-
   %feature("docstring", "\
 Saves this instance to url or storage.
 
diff --git a/bindings/python/dlite-python.i b/bindings/python/dlite-python.i
index c97212cc3..10196d6c7 100644
--- a/bindings/python/dlite-python.i
+++ b/bindings/python/dlite-python.i
@@ -854,8 +854,7 @@ int dlite_swig_set_scalar(void *ptr, DLiteType type, size_t size, obj_t *obj)
         PyObject *type  = PySequence_GetItem(obj, 1);
         PyObject *dims  = PySequence_GetItem(obj, 2);
         PyObject *unit  = PySequence_GetItem(obj, 3);
-        PyObject *iri   = PySequence_GetItem(obj, 4);
-        PyObject *descr = PySequence_GetItem(obj, 5);
+        PyObject *descr = PySequence_GetItem(obj, 4);
         DLiteType t;
         size_t size;
         if (name && PyUnicode_Check(name) &&
@@ -865,7 +864,6 @@ int dlite_swig_set_scalar(void *ptr, DLiteType type, size_t size, obj_t *obj)
           if (dest->name)        free(dest->name);
           if (dest->dims)        free_str_array(dest->dims, dest->ndims);
           if (dest->unit)        free(dest->unit);
-          if (dest->iri)         free(dest->iri);
           if (dest->description) free(dest->description);
           dest->name = strdup(PyUnicode_AsUTF8(name));
           dest->type = t;
@@ -887,8 +885,6 @@ int dlite_swig_set_scalar(void *ptr, DLiteType type, size_t size, obj_t *obj)
           }
           dest->unit = (unit && PyUnicode_Check(unit)) ?
             strdup(PyUnicode_AsUTF8(unit)) : NULL;
-          dest->iri = (iri && PyUnicode_Check(iri)) ?
-            strdup(PyUnicode_AsUTF8(iri)) : NULL;
           dest->description = (descr && PyUnicode_Check(descr)) ?
             strdup(PyUnicode_AsUTF8(descr)) : NULL;
         } else {
diff --git a/src/dlite-codegen.c b/src/dlite-codegen.c
index 6c0650795..1d69d0f08 100644
--- a/src/dlite-codegen.c
+++ b/src/dlite-codegen.c
@@ -207,7 +207,6 @@ static int list_properties_helper(TGenBuf *s, const char *template, int len,
     size_t nref = (p->ndims > 0) ? 1 : 0;
     int isallocated = dlite_type_is_allocated(p->type);
     char typename[32], pcdecl[64], ftype[25], isoctype[64];
-    char *iri = (p->iri) ? p->iri : "";
     dlite_type_set_typename(p->type, p->size, typename, sizeof(typename));
     dlite_type_set_cdecl(p->type, p->size, p->name, nref, pcdecl,
 			 sizeof(pcdecl), g->use_native_typenames);
@@ -224,7 +223,6 @@ static int list_properties_helper(TGenBuf *s, const char *template, int len,
     tgen_subs_set(&psubs, "prop.isoctype", isoctype, NULL);
     tgen_subs_set(&psubs, "prop.cdecl",    pcdecl,   NULL);
     tgen_subs_set(&psubs, "prop.unit",     unit,     NULL);
-    tgen_subs_set(&psubs, "prop.iri",      iri,      NULL);
     tgen_subs_set(&psubs, "prop.descr",    descr,    NULL);
     tgen_subs_set(&psubs, "prop.dims",     NULL,     list_dims);
     tgen_subs_set_fmt(&psubs, "prop.typeno",      NULL, "%d",  p->type);
@@ -365,7 +363,6 @@ int dlite_instance_subs(TGenSubs *subs, const DLiteInstance *inst)
   /* General (all types of instances) */
   tgen_subs_set(subs, "uuid", inst->uuid, NULL);
   tgen_subs_set(subs, "uri", (inst->uri) ? inst->uri : "", NULL);
-  tgen_subs_set(subs, "iri", (inst->iri) ? inst->iri : "", NULL);
   if (inst->uri)
     tgen_subs_set(subs, "uri",        inst->uri,  NULL);
 
@@ -374,7 +371,6 @@ int dlite_instance_subs(TGenSubs *subs, const DLiteInstance *inst)
   descr = dlite_instance_get_property((DLiteInstance *)meta, "description");
   tgen_subs_set(subs, "meta.uuid",       meta->uuid, NULL);
   tgen_subs_set(subs, "meta.uri",        meta->uri,  NULL);
-  tgen_subs_set(subs, "meta.iri",        (meta->iri) ? meta->iri : "",  NULL);
   tgen_subs_set(subs, "meta.name",       name,       NULL);
   tgen_subs_set(subs, "meta.version",    version,    NULL);
   tgen_subs_set(subs, "meta.namespace",  namespace,  NULL);
@@ -394,7 +390,6 @@ int dlite_instance_subs(TGenSubs *subs, const DLiteInstance *inst)
   /* DLiteInstance_HEAD */
   tgen_subs_set(subs, "_uuid", inst->uuid, NULL);
   tgen_subs_set(subs, "_uri", (inst->uri) ? inst->uri : "", NULL);
-  tgen_subs_set(subs, "_iri", (inst->iri) ? inst->iri : "", NULL);
 
   /* For all metadata  */
   if (dlite_meta_is_metameta(inst->meta)) {
diff --git a/src/dlite-entity.c b/src/dlite-entity.c
index cdae05ed7..d30a91573 100644
--- a/src/dlite-entity.c
+++ b/src/dlite-entity.c
@@ -200,7 +200,6 @@ void dlite_instance_debug(const DLiteInstance *inst)
   fprintf(fp, "  _uri: %s\n", inst->uri);
   fprintf(fp, "  _refcount: %d\n", inst->_refcount);
   fprintf(fp, "  _meta: (%p) %s\n", (void *)inst->meta, inst->meta->uri);
-  fprintf(fp, "  _iri: %s\n", inst->iri);
 
   if (dlite_instance_is_meta(inst)) {
     DLiteMeta *meta = (DLiteMeta *)inst;
@@ -561,7 +560,6 @@ static int dlite_instance_free(DLiteInstance *inst)
   /* Standard free */
   nprops = meta->_nproperties;
   if (inst->uri) free((char *)inst->uri);
-  if (inst->iri) free((char *)inst->iri);
   if (meta->_properties) {
     for (i=0; i<nprops; i++) {
       DLiteProperty *p = (DLiteProperty *)meta->_properties + i;
@@ -1046,14 +1044,6 @@ const char *dlite_instance_get_uri(const DLiteInstance *inst)
   return inst->uri;
 }
 
-/*
-  Returns a pointer to instance IRI.
- */
-const char *dlite_instance_get_iri(const DLiteInstance *inst)
-{
-  return inst->iri;
-}
-
 /*
   Returns a pointer to the UUID of the instance metadata.
  */
@@ -1967,8 +1957,7 @@ int dlite_instance_assign_casted_property_by_index(const DLiteInstance *inst,
   given arguments.  It is an instance of DLITE_ENTITY_SCHEMA.
  */
 DLiteMeta *
-dlite_meta_create(const char *uri, const char *iri,
-                  const char *description,
+dlite_meta_create(const char *uri, const char *description,
                   size_t ndimensions, const DLiteDimension *dimensions,
                   size_t nproperties, const DLiteProperty *properties)
 {
@@ -1984,7 +1973,6 @@ dlite_meta_create(const char *uri, const char *iri,
   if (!(e=dlite_instance_create(dlite_get_entity_schema(), dims, uri)))
     goto fail;
 
-  if (iri) e->iri = strdup(iri);
   if (dlite_instance_set_property(e, "name", &name)) goto fail;
   if (dlite_instance_set_property(e, "version", &version)) goto fail;
   if (dlite_instance_set_property(e, "namespace", &namespace)) goto fail;
@@ -2397,7 +2385,6 @@ DLiteProperty *dlite_property_create(const char *name,
                                      DLiteType type,
                                      size_t size,
                                      const char *unit,
-                                     const char *iri,
                                      const char *description)
 {
   DLiteProperty *prop;
@@ -2406,7 +2393,6 @@ DLiteProperty *dlite_property_create(const char *name,
   prop->type = type;
   prop->size = size;
   if (unit && !(prop->unit = strdup(unit))) goto fail;
-  if (iri && !(prop->iri = strdup(iri))) goto fail;
   if (description && !(prop->description = strdup(description))) goto fail;
   return prop;
  fail:
@@ -2423,7 +2409,6 @@ void dlite_property_free(DLiteProperty *prop)
   if (prop->name) free(prop->name);
   for (i=0; i < prop->ndims; i++) free(prop->dims[i]);
   if (prop->unit) free(prop->unit);
-  if (prop->iri) free(prop->iri);
   if (prop->description) free(prop->description);
   free(prop);
 }
@@ -2829,18 +2814,13 @@ struct _DLiteMetaModel {
 
   Returns NULL on error.
  */
-DLiteMetaModel *dlite_metamodel_create(const char *uri,
-                                       const char *metaid,
-                                       const char *iri)
+DLiteMetaModel *dlite_metamodel_create(const char *uri, const char *metaid)
 {
   DLiteMetaModel *model;
 
-  if (iri && !*iri) iri = NULL;
-
   if (!(model = calloc(1, sizeof(DLiteMetaModel)))) goto fail;
   if (!(model->uri = strdup(uri))) goto fail;
   if (!(model->meta = dlite_meta_get(metaid))) goto fail;
-  if (iri && !(model->iri = strdup(iri))) goto fail;
   if (!(model->dimvalues = calloc(model->meta->_ndimensions, sizeof(size_t))))
     goto fail;
   return model;
@@ -2848,7 +2828,6 @@ DLiteMetaModel *dlite_metamodel_create(const char *uri,
   if (model) {
     if (model->uri) free(model->uri);
     if (model->meta) dlite_meta_decref(model->meta);
-    if (model->iri) free(model->iri);
     free(model);
   }
   return err(1, "allocation failure"), NULL;
@@ -3057,7 +3036,6 @@ int dlite_metamodel_add_dimension(DLiteMetaModel *model,
     - name: name of new property
     - typename: type of new property, ex. "string80", "int64", "string",...
     - unit: unit of new type. May be NULL
-    - iri: iri reference to an ontology. May be NULL
     - description: description of property. May be NULL
 
   Use dlite_metamodel_add_property_dim() to add dimensions to the
@@ -3069,7 +3047,6 @@ int dlite_metamodel_add_property(DLiteMetaModel *model,
                                  const char *name,
                                  const char *typename,
                                  const char *unit,
-                                 const char *iri,
                                  const char *description)
 {
   size_t i;
@@ -3098,7 +3075,6 @@ int dlite_metamodel_add_property(DLiteMetaModel *model,
   p->type = type;
   p->size = size;
   if (unit && !(p->unit = strdup(unit))) FAIL("allocation failure");
-  if (iri && !(p->iri = strdup(iri))) FAIL("allocation failure");
   if (description && !(p->description = strdup(description)))
     FAIL("allocation failure");
 
@@ -3211,8 +3187,6 @@ DLiteMeta *dlite_meta_create_from_metamodel(DLiteMetaModel *model)
   if (!(meta = (DLiteMeta *)dlite_instance_create(model->meta,
                                                   model->dimvalues,
                                                   model->uri))) goto fail;
-  if (model->iri && !(meta->iri = strdup(model->iri)))
-    FAIL("allocation failure");
 
   for (i=0; i < model->meta->_nproperties; i++) {
     const void *src;
diff --git a/src/dlite-entity.h b/src/dlite-entity.h
index 8837eddda..7b2e33d7a 100644
--- a/src/dlite-entity.h
+++ b/src/dlite-entity.h
@@ -191,10 +191,8 @@ typedef int (*DLiteSaveProperty)(DLiteInstance *inst, size_t i);
   int _refcount;                  /* Number of references to this */    \
                                   /* instance. */                       \
   const struct _DLiteMeta *meta;  /* Pointer to the metadata descri- */ \
-                                  /* bing this instance. */             \
-  const char *iri;                /* Unique IRI to corresponding */     \
-                                  /* entity in an ontology. May be */   \
-                                  /* NULL. */
+                                  /* bing this instance. */
+
 
 /**
   Initial segment of all DLite metadata.  With instance we here refer
@@ -282,8 +280,6 @@ struct _DLiteProperty {
                            data.  Zero if scalar. */
   char **dims;        /*!< Array of dimension strings.  May be NULL. */
   char *unit;         /*!< Unit of the described data. May be NULL. */
-  char *iri;          /*!< Unique IRI to corresponding entity in an
-                           ontology. */
   char *description;  /*!< Human described of the described data. */
 };
 
@@ -587,11 +583,6 @@ const char *dlite_instance_get_uuid(const DLiteInstance *inst);
  */
 const char *dlite_instance_get_uri(const DLiteInstance *inst);
 
-/**
-  Returns a pointer to instance IRI.
- */
-const char *dlite_instance_get_iri(const DLiteInstance *inst);
-
 /**
   Returns a pointer to the UUID of the instance metadata.
  */
@@ -987,8 +978,7 @@ int dlite_instance_assign_casted_property_by_index(const DLiteInstance *inst,
   given arguments.  It is an instance of DLITE_ENTITY_SCHEMA.
  */
 DLiteMeta *
-dlite_meta_create(const char *uri, const char *iri,
-                  const char *description,
+dlite_meta_create(const char *uri, const char *description,
                   size_t ndimensions, const DLiteDimension *dimensions,
                   size_t nproperties, const DLiteProperty *properties);
 
@@ -1144,13 +1134,12 @@ void dlite_dimension_free(DLiteDimension *dim);
   It is created with no dimensions.  Use dlite_property_add_dim() to
   add dimensions to the property.
 
-  The arguments `unit`, `iri` and `description` may be NULL.
+  The arguments `unit`, and `description` may be NULL.
 */
 DLiteProperty *dlite_property_create(const char *name,
                                      DLiteType type,
                                      size_t size,
                                      const char *unit,
-                                     const char *iri,
                                      const char *description);
 
 /**
@@ -1260,14 +1249,12 @@ int dlite_property_jscan(const char *src, const jsmntok_t *item,
 /** @{ */
 
 /**
-  Create and return a new empty metadata model.  `iri` is optional and
+  Create and return a new empty metadata model.
   may be NULL.
 
   Returns NULL on error.
  */
-DLiteMetaModel *dlite_metamodel_create(const char *uri,
-                                       const char *metaid,
-                                       const char *iri);
+DLiteMetaModel *dlite_metamodel_create(const char *uri, const char *metaid);
 
 /**
   Frees metadata model.
@@ -1346,7 +1333,6 @@ int dlite_metamodel_add_dimension(DLiteMetaModel *model,
     - name: name of new property
     - typename: type of new property, ex. "string80", "int64", "string",...
     - unit: unit of new type. May be NULL
-    - iri: iri reference to an ontology. May be NULL
     - description: description of property. May be NULL
 
   Use dlite_metamodel_add_property_dim() to add dimensions to the
@@ -1358,7 +1344,6 @@ int dlite_metamodel_add_property(DLiteMetaModel *model,
                                  const char *name,
                                  const char *typename,
                                  const char *unit,
-                                 const char *iri,
                                  const char *description);
 
 /**
diff --git a/src/dlite-json.c b/src/dlite-json.c
index 2d9f6d309..2f903f78a 100644
--- a/src/dlite-json.c
+++ b/src/dlite-json.c
@@ -720,7 +720,7 @@ DLiteInstance *dlite_json_sscan(const char *src, const char *id,
     char uuid[DLITE_UUID_LENGTH + 1];
     if (dlite_get_uuid(uuid, metaid) < 0 ||
         (strcmp(metaid, uuid) != 0 && strcmp(metaid, inst->meta->uri) != 0)) {
-      if (!id) id = (inst->iri) ? inst->iri : inst->uuid;
+      if (!id) id = inst->uuid;
       err(1, "instance '%s' has meta id '%s' but '%s' is expected",
           id, inst->meta->uri, metaid);
       dlite_instance_decref(inst);
diff --git a/src/dlite-schemas.c b/src/dlite-schemas.c
index 4c491d7a7..92bde93db 100644
--- a/src/dlite-schemas.c
+++ b/src/dlite-schemas.c
@@ -26,7 +26,6 @@ static DLiteProperty basic_metadata_schema_properties[] = {
    0,                                         /* ndims */
    NULL,                                      /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Schema name."                             /* description */
   },
   {
@@ -36,7 +35,6 @@ static DLiteProperty basic_metadata_schema_properties[] = {
    0,                                         /* ndims */
    NULL,                                      /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Schema version."                          /* description */
   },
   {
@@ -46,7 +44,6 @@ static DLiteProperty basic_metadata_schema_properties[] = {
    0,                                         /* ndims */
    NULL,                                      /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Schema namespace."                        /* description */
   },
   {
@@ -56,7 +53,6 @@ static DLiteProperty basic_metadata_schema_properties[] = {
    0,                                         /* ndims */
    NULL,                                      /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Description of schema."                   /* description */
   },
   {
@@ -66,7 +62,6 @@ static DLiteProperty basic_metadata_schema_properties[] = {
    1,                                         /* ndims */
    basic_metadata_schema_prop_dimensions_dims,/* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Schema dimensions."                       /* description */
   },
   {
@@ -76,7 +71,6 @@ static DLiteProperty basic_metadata_schema_properties[] = {
    1,                                         /* ndims */
    basic_metadata_schema_prop_properties_dims,/* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Schema properties."                       /* description */
   },
   {
@@ -86,7 +80,6 @@ static DLiteProperty basic_metadata_schema_properties[] = {
    1,                                         /* ndims */
    basic_metadata_schema_prop_relations_dims, /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Schema relations."                        /* description */
   }
 };
@@ -118,7 +111,6 @@ static struct _BasicMetadataSchema {
   DLITE_BASIC_METADATA_SCHEMA,                   /* uri */
   1,                                             /* _refcount, never free */
   (DLiteMeta *)&basic_metadata_schema,           /* meta */
-  NULL,                                          /* iri */
 
   3,                                             /* _ndimensions */
   7,                                             /* _nproperties */
@@ -192,7 +184,6 @@ static DLiteProperty entity_schema_properties[] = {
    0,                                         /* ndims */
    NULL,                                      /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Entity name."                             /* description */
   },
   {
@@ -202,7 +193,6 @@ static DLiteProperty entity_schema_properties[] = {
    0,                                         /* ndims */
    NULL,                                      /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Entity version."                          /* description */
   },
   {
@@ -212,7 +202,6 @@ static DLiteProperty entity_schema_properties[] = {
    0,                                         /* ndims */
    NULL,                                      /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Entity namespace."                        /* description */
   },
   {
@@ -222,7 +211,6 @@ static DLiteProperty entity_schema_properties[] = {
    0,                                         /* ndims */
    NULL,                                      /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Description of entity."                   /* description */
   },
   {
@@ -232,7 +220,6 @@ static DLiteProperty entity_schema_properties[] = {
    1,                                         /* ndims */
    entity_schema_prop_dimensions_dims,        /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Entity dimensions."                       /* description */
   },
   {
@@ -242,7 +229,6 @@ static DLiteProperty entity_schema_properties[] = {
    1,                                         /* ndims */
    entity_schema_prop_properties_dims,        /* dims */
    NULL,                                      /* unit */
-   NULL,                                      /* iri */
    "Entity properties."                       /* description */
   }
 };
@@ -274,7 +260,6 @@ static struct _EntitySchema {
   DLITE_ENTITY_SCHEMA,                        /* uri */
   1,                                          /* _refcount, never free */
   (DLiteMeta *)&basic_metadata_schema,        /* meta */
-  NULL,                                       /* iri */
 
   2,                                          /* _ndimensions */
   6,                                          /* _nproperties */
@@ -342,7 +327,6 @@ static DLiteProperty collection_entity_properties[] = {
   1,                                         /* ndims */
   collection_entity_prop_relations_dims,     /* dims */
   NULL,                                      /* unit */
-  NULL,                                      /* iri */
   "Array of relations (s-p-o triples)."      /* description */
   }
 };
@@ -372,7 +356,6 @@ static struct _CollectionEntity {
   DLITE_COLLECTION_ENTITY,                       /* uri */
   1,                                             /* _refcount, never free */
   (DLiteMeta *)&entity_schema,                   /* meta */
-  NULL,                                          /* iri */
 
   1,                                             /* _ndimensions */
   1,                                             /* _nproperties */
diff --git a/tools/templates/c-header.txt b/tools/templates/c-header.txt
index 35f313f91..3084db39c 100644
--- a/tools/templates/c-header.txt
+++ b/tools/templates/c-header.txt
@@ -53,10 +53,8 @@
 #define {name%C}_NAMESPACE "{namespace}"
 #define {name%C}_URI       "{_uri}"
 #define {name%C}_UUID      "{_uuid}"
-#define {name%C}_IRI       "{_iri}"
 #define {name%C}_META_URI  "{meta.uri}"
 #define {name%C}_META_UUID "{meta.uuid}"
-#define {name%C}_META_IRI  "{meta.iri}"
 #endif
 
 /** Minimal set of needed definitions in case we don't have dlite */
@@ -73,7 +71,7 @@ typedef struct {{
   DLiteType type;
   size_t size;
   int ndims;
-  char **dims, *unit, *iri, *description;
+  char **dims, *unit, *description;
 }} DLiteProperty;
 typedef void DLiteInstance;
 #define DLiteInstance_HEAD
diff --git a/tools/templates/c-meta-header.txt b/tools/templates/c-meta-header.txt
index cd1ccb505..1f5dc70ef 100644
--- a/tools/templates/c-meta-header.txt
+++ b/tools/templates/c-meta-header.txt
@@ -64,11 +64,9 @@
 #define {name%C}_NAMESPACE "{namespace}"
 #define {name%C}_URI       "{_uri}"
 #define {name%C}_UUID      "{_uuid}"
-#define {name%C}_IRI       "{_iri}"
 #ifndef {struct_name}_HEAD
 #define {name%C}_META_URI  "{meta.uri}"
 #define {name%C}_META_UUID "{meta.uuid}"
-#define {name%C}_META_IRI  "{meta.iri}"
 #endif
 #endif
 
@@ -87,7 +85,7 @@ typedef struct {{
   DLiteType type;
   size_t size;
   int ndims;
-  char **dims, *unit, *iri, *description;
+  char **dims, *unit, *description;
 }} DLiteProperty;
 typedef void DLiteInstance;
 #define DLiteInstance_HEAD
diff --git a/tools/templates/c-source.txt b/tools/templates/c-source.txt
index f55cfeaee..1762af2fe 100644
--- a/tools/templates/c-source.txt
+++ b/tools/templates/c-source.txt
@@ -106,11 +106,6 @@ static DLiteProperty {name%u}_properties[] = {{
 {@else}\
     NULL,          {@40}/* unit */
 {@endif}\
-{@if:"{prop.iri}"}\
-    "{prop.iri}",  {@40}/* iri */
-{@else}\
-    NULL,          {@40}/* iri */
-{@endif}\
 {@if:"{prop.descr}"}\
     "{prop.descr}" {@40}/* description */
 {@else}\
@@ -129,11 +124,6 @@ static {basename}Struct {name%u} = {{
   "{_uri}",   {@52}/* _uri */
   1,                        {@52}/* _refcount */
   NULL,                     {@52}/* _meta */
-{@if:"{_iri}"}\
-  "{_iri}",                 {@52}/* _iri */
-{@else}\
-  NULL,                     {@52}/* _iri */
-{@endif}\
 {@if:{ismeta}=1}
   {_ndimensions},           {@52}/* _ndimensions */
   {_nproperties},           {@52}/* _nproperties */
diff --git a/tools/templates/fortran-module.txt b/tools/templates/fortran-module.txt
index 78bdaf3bc..b3d9d725c 100644
--- a/tools/templates/fortran-module.txt
+++ b/tools/templates/fortran-module.txt
@@ -63,7 +63,7 @@ module {name}
 {@if:{_ndimensions}>0}
       ! create a {name} and allocate the arrays (type of dimensions: integer(8))
       module procedure create64
-{@endif}      
+{@endif}
     END INTERFACE T{name}
 
   contains
@@ -72,10 +72,10 @@ module {name}
     type(DLiteMetaModel) :: model
     integer              :: i
     if (.not. meta_{name%c}%check()) then
-      model = DLiteMetaModel('{_uri}', 'http://onto-ns.com/meta/0.3/EntitySchema', '')
+      model = DLiteMetaModel('{_uri}', 'http://onto-ns.com/meta/0.3/EntitySchema')
       i = model%add_string('description', '{descr}')
 {list_dimensions:{@6}i = model%add_dimension('{dim.name}', '{dim.descr}')\n}
-{list_properties:{@6}i = model%add_property('{prop.name}', '{prop.typename}', '{prop.unit}', '{prop.iri}', '{prop.descr}')\
+{list_properties:{@6}i = model%add_property('{prop.name}', '{prop.typename}', '{prop.unit}', '{prop.descr}')\
 {@if:{prop.ndims}!0}\n{prop.dims:{@6}i = model%add_property_dim('{prop.name}', '{dim.name}')\n}{@endif}\n}
       meta_{name%c} = DLiteMeta(model)
       call model%destroy()
@@ -85,7 +85,7 @@ module {name}
   function create32({list_dimensions:{dim.name}{, }\.}) result({name%c})
     implicit none
     type(T{name}) :: {name%c}
-{list_dimensions:{@4}integer(4)    :: {dim.name}\n}    
+{list_dimensions:{@4}integer(4)    :: {dim.name}\n}
     call create_meta_{name%c}()
     {name%c}%instance%cinst = c_null_ptr
     {name%c}%uuid(:) = ' '
@@ -96,7 +96,7 @@ module {name}
   function create64({list_dimensions:{dim.name}{, }\.}) result({name%c})
     implicit none
     type(T{name}) :: {name%c}
-{list_dimensions:{@4}integer(8)    :: {dim.name}\n}    
+{list_dimensions:{@4}integer(8)    :: {dim.name}\n}
     call create_meta_{name%c}()
     {name%c}%instance%cinst = c_null_ptr
     {name%c}%uuid(:) = ' '
@@ -166,7 +166,7 @@ module {name}
     type(DLiteInstance)                   :: instance
     {@if:{_ndimensions}>0}{@3}type(c_ptr){@42}:: cptr{@endif}
     {@if:{_ndimensions}>0}{@3}integer(8), dimension(*), allocatable :: dims(:){@endif}
-    integer(8), dimension({_ndimensions}) :: dimensions    
+    integer(8), dimension({_ndimensions}) :: dimensions
 {list_properties:\
 {@if:{prop.typeno}=5}\
 {@4}! {prop.isoctype} {@42}:: {prop.name}\n\
@@ -289,6 +289,6 @@ module {name}
     class(T{name}), intent(in)     :: {name%c}
     integer                        :: status
     status = {name%c}%instance%destroy()
-  end function destroy  
+  end function destroy
 
 end module


Test patch:
diff --git a/src/tests/test_entity.c b/src/tests/test_entity.c
index 9ba55c9ed..ea82e9099 100644
--- a/src/tests/test_entity.c
+++ b/src/tests/test_entity.c
@@ -37,16 +37,15 @@ MU_TEST(test_meta_create)
     {"N", "Length of dimension N."}
   };
   DLiteProperty properties[] = {
-    /* name           type            size         ndims dims   unit iri   descr */
-    {"a-string",      dliteStringPtr, sizeof(char *), 0, NULL,  "",  NULL, "..."},
-    {"a-float",       dliteFloat,     sizeof(float),  0, NULL,  "m", NULL, ""},
-    {"an-int-arr",    dliteInt,       sizeof(int),    2, dims0, "#", NULL, "descr.."},
-    {"a-string-arr",  dliteStringPtr, sizeof(char *), 1, dims1, "",  NULL, "descr.."},
-    {"a-string3-arr", dliteFixString, 3,              1, dims2, "",  NULL, "descr.."}
+    /* name           type            size         ndims dims   unit descr */
+    {"a-string",      dliteStringPtr, sizeof(char *), 0, NULL,  "",  "..."},
+    {"a-float",       dliteFloat,     sizeof(float),  0, NULL,  "m", ""},
+    {"an-int-arr",    dliteInt,       sizeof(int),    2, dims0, "#", "descr.."},
+    {"a-string-arr",  dliteStringPtr, sizeof(char *), 1, dims1, "",  "descr.."},
+    {"a-string3-arr", dliteFixString, 3,              1, dims2, "",  "descr.."}
   };
 
   mu_check((entity = (DLiteMeta *)dlite_meta_create(uri, "My test entity.",
-                                                    NULL,
                                                     2, dimensions,
                                                     5, properties)));
   mu_assert_int_eq(2, entity->_refcount);  /* refs: global+store */
@@ -65,17 +64,17 @@ MU_TEST(test_meta_create)
   /* be careful here.. the expected values are for a memory-aligned 64 bit
      system */
 #if (__GNUC__ && SIZEOF_VOID_P == 8)
-  mu_assert_int_eq(72, sizeof(DLiteInstance));
-  mu_assert_int_eq(72, entity->_dimoffset);
-  mu_assert_int_eq(72, entity->_headersize);
-  mu_assert_int_eq(88, entity->_propoffsets[0]);
-  mu_assert_int_eq(96, entity->_propoffsets[1]);
-  mu_assert_int_eq(104, entity->_propoffsets[2]);
-  mu_assert_int_eq(112, entity->_propoffsets[3]);
-  mu_assert_int_eq(120, entity->_propoffsets[4]);
-  mu_assert_int_eq(128, entity->_reloffset);
-  mu_assert_int_eq(128, entity->_propdimsoffset);
-  mu_assert_int_eq(160, entity->_propdimindsoffset);
+  mu_assert_int_eq(64, sizeof(DLiteInstance));
+  mu_assert_int_eq(64, entity->_dimoffset);
+  mu_assert_int_eq(64, entity->_headersize);
+  mu_assert_int_eq(80, entity->_propoffsets[0]);
+  mu_assert_int_eq(88, entity->_propoffsets[1]);
+  mu_assert_int_eq(96, entity->_propoffsets[2]);
+  mu_assert_int_eq(104, entity->_propoffsets[3]);
+  mu_assert_int_eq(112, entity->_propoffsets[4]);
+  mu_assert_int_eq(120, entity->_reloffset);
+  mu_assert_int_eq(120, entity->_propdimsoffset);
+  mu_assert_int_eq(152, entity->_propdimindsoffset);
 #endif
 }
 
diff --git a/src/tests/test_metamodel.c b/src/tests/test_metamodel.c
index 57129e79c..4a376fdf7 100644
--- a/src/tests/test_metamodel.c
+++ b/src/tests/test_metamodel.c
@@ -13,11 +13,11 @@ DLiteMetaModel *nodim;
 MU_TEST(test_metamodel_create)
 {
   model = dlite_metamodel_create("http://onto-ns.com/meta/0.1/Vehicle",
-                                 DLITE_ENTITY_SCHEMA, NULL);
+                                 DLITE_ENTITY_SCHEMA);
   mu_check(model);
 
   nodim = dlite_metamodel_create("http://onto-ns.com/meta/1.0/NoDimension",
-                                 DLITE_ENTITY_SCHEMA, NULL);
+                                 DLITE_ENTITY_SCHEMA);
   mu_check(nodim);
 
 }
@@ -40,20 +40,20 @@ MU_TEST(test_metamodel_add_dimension)
 MU_TEST(test_metamodel_add_property)
 {
   int stat;
-  stat = dlite_metamodel_add_property(model, "brand", "string32", NULL, NULL,
+  stat = dlite_metamodel_add_property(model, "brand", "string32", NULL,
                                       "Brand of the vehicle.");
   mu_assert_int_eq(0, stat);
 
-  stat = dlite_metamodel_add_property(model, "checks", "int32", NULL, NULL,
+  stat = dlite_metamodel_add_property(model, "checks", "int32", NULL,
                                       "Year of each check.");
   mu_assert_int_eq(0, stat);
   stat = dlite_metamodel_add_property_dim(model, "checks", "nchecks");
   mu_assert_int_eq(0, stat);
 
-  stat = dlite_metamodel_add_property(nodim, "name", "string32", NULL, NULL,
+  stat = dlite_metamodel_add_property(nodim, "name", "string32", NULL,
                                       "Name of the instance.");
   mu_assert_int_eq(0, stat);
-  stat = dlite_metamodel_add_property(nodim, "value", "float", "mm", NULL,
+  stat = dlite_metamodel_add_property(nodim, "value", "float", "mm",
                                       "Value of the instance.");
   mu_assert_int_eq(0, stat);
 }
diff --git a/src/tests/test_property.c b/src/tests/test_property.c
index e05bdcbe3..9b90dbd06 100644
--- a/src/tests/test_property.c
+++ b/src/tests/test_property.c
@@ -81,7 +81,7 @@ MU_TEST(test_print)
                       "\"description\": \"number of something\"}", s);
 
   char *dims[] = {"M", "N"};
-  DLiteProperty p = {"x", dliteInt, 4, 2, dims, "m", NULL, "about x..."};
+  DLiteProperty p = {"x", dliteInt, 4, 2, dims, "m", "about x..."};
   prop.type = dliteProperty;
   prop.size = sizeof(p);
   m = dlite_property_aprint(&s, &size, n, &p, &prop, NULL, 0, -2, 0);