<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.6(BH)" -->
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>Developer forum</title>
        <description></description>
        <link>http://www.midgard-project.org/discussion/developer-forum/</link>
        <lastBuildDate>Fri, 03 Sep 2010 05:44:14 +0000</lastBuildDate>
        <generator>FeedCreator 1.7.6(BH)</generator>
        <item>
            <title>Re: [midgard-dev] RDF use-case</title>
            <link>http://www.midgard-project.org/discussion/developer-forum/read/70f24164b51011df9bb15f4933bae5b0e5b0/</link>
            <description>&lt;blockquote&gt;
  &lt;p&gt;Application developer can use aliased property-names/class-names, but internally system operates using full namespaced names.
  And when queries are prepared for StorageManager these names are mapped to SQL field names or whatever current storage requires.&lt;/p&gt;
  
  &lt;p&gt;So, we can have several StorageManagers but only one NamespaceManager.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Agree.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Now, that I think of it, other option is, to implement NamespaceManager on application level.
  It's quite easy to do and NamespaceManager doesn't provide any vital functionality. It is there only to make things easier for app-developers&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It could be a wrapper for particular SchemaObject class.&lt;/p&gt;

&lt;p&gt;Piotras

&lt;hr /&gt;

dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <pubDate>Tue, 31 Aug 2010 15:00:06 +0000</pubDate>
        </item>
        <item>
            <title>Re: [midgard-dev] RDF use-case</title>
            <link>http://www.midgard-project.org/discussion/developer-forum/read/588952eab50e11dfb3a4ade118bbfec0fec0/</link>
            <description>&lt;p&gt;On 31.08.2010, at 17:46, Piotr Pokora wrote:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Why it can not associated with StorageManager which creates all storage
  related classes? To be consistent with Query, Model, Transaction and
  Profiler, Namespace manager should be created with StorageManager.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I don't like it either way.&lt;/p&gt;

&lt;p&gt;NamespaceManager is not related to StorageManager at all.
NamespaceManager is the property of the whole runtime context and is active on the level of SchemaModels&lt;/p&gt;

&lt;p&gt;Application developer can use aliased property-names/class-names, but internally system operates using full namespaced names.
And when queries are prepared for StorageManager these names are mapped to SQL field names or whatever current storage requires.&lt;/p&gt;

&lt;p&gt;So, we can have several StorageManagers but only one NamespaceManager.&lt;/p&gt;

&lt;p&gt;Now, that I think of it, other option is, to implement NamespaceManager on application level.
It's quite easy to do and NamespaceManager doesn't provide any vital functionality. It is there only to make things easier for app-developers&lt;/p&gt;


&lt;hr /&gt;

dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev
</description>
            <author>Alexey Zakhlestine</author>
            <pubDate>Tue, 31 Aug 2010 14:45:06 +0000</pubDate>
        </item>
        <item>
            <title>Re: [midgard-dev] RDF use-case</title>
            <link>http://www.midgard-project.org/discussion/developer-forum/read/a9660206b50611df9f45233c31d2a76aa76a/</link>
            <description>&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;blockquote&gt;
      &lt;p&gt;var nm = new NamespaceManager; // should it be singleton?&lt;/p&gt;
    &lt;/blockquote&gt;
    
    &lt;p&gt;Yes. If we associate it with StorageManager:&lt;/p&gt;
    
    &lt;ul&gt;
    &lt;li&gt;singleton&lt;/li&gt;
    &lt;li&gt;lazy initialization&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/blockquote&gt;
  
  &lt;p&gt;well the problem is, that NamespaceManager is not a property of storage
  though, NamespaceManager can (should?) use StorageManager as the backend&lt;/p&gt;
  
  &lt;p&gt;Maybe it should be associated with ModelManager, instead?:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var storage = new StorageManager(new Config());
storage.open();

var nm = storage.model_manager.namespace_manager;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;Why it can not associated with StorageManager which creates all storage
related classes? To be consistent with Query, Model, Transaction and
Profiler, Namespace manager should be created with StorageManager.&lt;/p&gt;

&lt;p&gt;On the other hand, if we would like to ModelManager to create Namespace
one, why do not make Namespace manager yet another model?&lt;/p&gt;

&lt;p&gt;Latter makes ModelManager implementation a bit difficult, and the first
one forces us to clarify StorageManager family relations I mentioned few
mails earlier.&lt;/p&gt;

&lt;p&gt;Piotras

&lt;hr /&gt;

dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <pubDate>Tue, 31 Aug 2010 13:50:06 +0000</pubDate>
        </item>
        <item>
            <title>Re: [midgard-dev] RDF use-case</title>
            <link>http://www.midgard-project.org/discussion/developer-forum/read/7c723284b4fb11df89e547f980e2d29fd29f/</link>
            <description>&lt;p&gt;[[ 2-nd edition ]]&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Vala code, for defining namespaces&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;var storage = new StorageManager(new Config());
storage.open();&lt;/p&gt;

&lt;p&gt;var nm = storage.model_manager.namespace_manager;&lt;/p&gt;

&lt;p&gt;nm.create_uri('http://purl.org/dc/elements/1.1/', 'dc');
nm.create_uri('http://example.com/client/', 'client');&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Vala code for defining properties&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;var dc_title = new SchemaModelProperty();
dc_title.namespace = 'dc';
dc_title.name = 'title';
dc_title.value_typename = 'string';&lt;/p&gt;

&lt;p&gt;var dc_date = new SchemaModelProperty();
dc_date.namespace = 'dc';
dc_date.name = 'date';
dc_date.value_typename = 'DateTime'; // from http://github.com/chergert/gdatetime&lt;/p&gt;

&lt;p&gt;var dc_language = new SchemaModelProperty();
dc_language.namespace = 'dc';
dc_language.name = 'language';
dc_language.value_typename = 'string';&lt;/p&gt;

&lt;p&gt;var client_book = new SchemaModelProperty();
client_book.namespace = 'client';
client_book.name = 'book';
client_book.value_typename = 'client:book'; // we'll need to define this beforehand&lt;/p&gt;

&lt;p&gt;// ====================================================================
// We need means to store properties definitions at this point without
// attaching them to classes&lt;br /&gt;
// ====================================================================&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Vala code for defining classes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// http://example.com/client/book
var book_model = new SchemaModel();
book_model.namespace = 'client';
book_model.name = 'book';&lt;/p&gt;

&lt;p&gt;book_model
  .add_model(dc_title)
  .add_model(dc_date)
  .add_model(dc_language);&lt;/p&gt;

&lt;p&gt;// http://example.com/client/movie
var movie_model = new SchemaModel();
movie_model.namespace = 'client';
movie_model.name = 'movie';&lt;/p&gt;

&lt;p&gt;movie_model
  .add_model(dc_title)
  .add_model(dc_date)
  .add_model(dc_language)
  .add_model(client_book);&lt;/p&gt;

&lt;p&gt;// register in type-system
var builder = new SchemaBuilder();
builder.register_model(book_model);
builder.register_model(movie_model);
builder.execute();&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Vala code for creating objects of defined classes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;var book = SchemaBuilder.factory(&quot;http://example.com/client/book&quot;) as SchemaObject;
book.set_property_value('dc:title',    'Do Androids Dream of Electric Sheep?');
book.set_property_value('dc:date',     '1968');
book.set_property_value('dc:language', 'en_EN');&lt;/p&gt;

&lt;p&gt;var movie = SchemaBuilder.factory(&quot;http://example.com/client/movie&quot;) as SchemaObject;
movie.set_property_value('dc:title',    'Blade_Runner');
movie.set_property_value('dc:date',     '1982-06-25');
movie.set_property_value('dc:language', 'en_EN');
movie.set_property_value('client:book', book);&lt;/p&gt;


&lt;hr /&gt;

dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev
</description>
            <author>Alexey Zakhlestine</author>
            <pubDate>Tue, 31 Aug 2010 12:30:06 +0000</pubDate>
        </item>
        <item>
            <title>Re: [midgard-dev] RDF use-case</title>
            <link>http://www.midgard-project.org/discussion/developer-forum/read/ff4c7984b4f711df9b55cba5d50a6edb6edb/</link>
            <description>&lt;p&gt;On 31.08.2010, at 15:09, Piotr Pokora wrote:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;blockquote&gt;
      &lt;ol&gt;
      &lt;li&gt;Vala code, for defining namespaces&lt;/li&gt;
      &lt;/ol&gt;
    &lt;/blockquote&gt;
    
    &lt;p&gt;var nm = new NamespaceManager; // should it be singleton?&lt;/p&gt;
  &lt;/blockquote&gt;
  
  &lt;p&gt;Yes. If we associate it with StorageManager:&lt;/p&gt;
  
  &lt;ul&gt;
  &lt;li&gt;singleton&lt;/li&gt;
  &lt;li&gt;lazy initialization&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;well the problem is, that NamespaceManager is not a property of storage
though, NamespaceManager can (should?) use StorageManager as the backend&lt;/p&gt;

&lt;p&gt;Maybe it should be associated with ModelManager, instead?:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var storage = new StorageManager(new Config());
storage.open();

var nm = storage.model_manager.namespace_manager;
&lt;/code&gt;&lt;/pre&gt;

&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;blockquote&gt;
      &lt;ol&gt;
      &lt;li&gt;Vala code for defining properties&lt;/li&gt;
      &lt;/ol&gt;
    &lt;/blockquote&gt;
    
    &lt;p&gt;dc_title.name = 'title';
    dc_title.value_gtype = gchararray;&lt;/p&gt;
  &lt;/blockquote&gt;
  
  &lt;p&gt;I added typename and g_type.
  For typename, you can declare just 'string' which is common in every
  language, while gchararray is GType system specific.
  g_type let us tune schema vs storage models creation. For example
  datetime values which must be string ones in some DBMS.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;ok. will post updated vala-example in a moment&lt;/p&gt;

&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;blockquote&gt;
      &lt;ol&gt;
      &lt;li&gt;Vala code for defining classes&lt;/li&gt;
      &lt;/ol&gt;
    &lt;/blockquote&gt;
    
    &lt;p&gt;// http://example.com/client/book
    var book_model = new SchemaModel();
    book_model.namespace = 'client';&lt;/p&gt;
  &lt;/blockquote&gt;
  
  &lt;p&gt;If class namespace is needed, please update Model interface.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;done&lt;/p&gt;


&lt;hr /&gt;

dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev
</description>
            <author>Alexey Zakhlestine</author>
            <pubDate>Tue, 31 Aug 2010 12:05:07 +0000</pubDate>
        </item>
        <item>
            <title>Re: [midgard-dev] RDF use-case</title>
            <link>http://www.midgard-project.org/discussion/developer-forum/read/01e60e1eb4f111df943dad5c09c0d9bad9ba/</link>
            <description>&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;ol&gt;
    &lt;li&gt;Vala code, for defining namespaces&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/blockquote&gt;
  
  &lt;p&gt;var nm = new NamespaceManager; // should it be singleton?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Yes. If we associate it with StorageManager:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;singleton&lt;/li&gt;
&lt;li&gt;lazy initialization&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;ol&gt;
    &lt;li&gt;Vala code for defining properties&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/blockquote&gt;
  
  &lt;p&gt;dc_title.name = 'title';
  dc_title.value_gtype = gchararray;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I added typename and g_type.
For typename, you can declare just 'string' which is common in every
language, while gchararray is GType system specific.
g_type let us tune schema vs storage models creation. For example
datetime values which must be string ones in some DBMS.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;// ====================================================================
  // We need means to store properties definitions at this point without
  // attaching them to classes&lt;br /&gt;
  // ====================================================================&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Proposal?&lt;/p&gt;

&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;ol&gt;
    &lt;li&gt;Vala code for defining classes&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/blockquote&gt;
  
  &lt;p&gt;// http://example.com/client/book
  var book_model = new SchemaModel();
  book_model.namespace = 'client';&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If class namespace is needed, please update Model interface.&lt;/p&gt;

&lt;p&gt;Piotras

&lt;hr /&gt;

dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <pubDate>Tue, 31 Aug 2010 11:15:05 +0000</pubDate>
        </item>
        <item>
            <title>Re: [midgard-dev] Midgard3 API proposal</title>
            <link>http://www.midgard-project.org/discussion/developer-forum/read/9bdbe57cb4ef11dfafd2f91088a15a575a57/</link>
            <description>&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;p&gt;Do you mean this?
    MidgardStorage::setParameterAlias('HelloWorld', 'dc:title', 'title');&lt;/p&gt;
    
    &lt;p&gt;I think it can be managed via NamespaceManager.&lt;/p&gt;
  &lt;/blockquote&gt;
  
  &lt;p&gt;I mean application developer should be able to use any of these if namespace and parameter-alias are defined:&lt;/p&gt;
  
  &lt;p&gt;obj.setParameter('http://dublincore.org/documents/dcmi-namespace/title', 'new_title');
  obj.setParameter('dc:title', 'new_title');
  obj.setParameter('title', 'new_title');&lt;/p&gt;
  
  &lt;p&gt;this, as the bonus, would be nice too:&lt;/p&gt;
  
  &lt;p&gt;obj.title = new_title&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;'new_title' is a value?&lt;/p&gt;

&lt;p&gt;I added set(get)_property_value methods by purpose.
If we set/get property, then any developer will look for property
set/get method.&lt;/p&gt;

&lt;p&gt;Another bonus: we leave deprecated API untouched.&lt;/p&gt;

&lt;p&gt;Piotras

&lt;hr /&gt;

dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <pubDate>Tue, 31 Aug 2010 11:05:04 +0000</pubDate>
        </item>
        <item>
            <title>Re: [midgard-dev] RDF use-case</title>
            <link>http://www.midgard-project.org/discussion/developer-forum/read/39469f98b4ee11df860a150663270b4d0b4d/</link>
            <description>&lt;blockquote&gt;
  &lt;p&gt;namespaces:
    -
      uri: http://purl.org/dc/elements/1.1/
      alias: dc
    -
      uri: http://example.com/client/
      alias: client&lt;/p&gt;
  
  &lt;p&gt;properties:
    -
      uri: http://purl.org/dc/elements/1.1/title
      db_type: text # can be varchar(1024) for sql
    -
      uri: http://purl.org/dc/elements/1.1/date
      db_type: datetime
    -
      uri: http://purl.org/dc/elements/1.1/language
      db_type: text # can be varchar(50) for sql
    -
      uri: http://example.com/client/book
      db_type: uuid # reference to book. can be char(32) or binary(16) for sql&lt;/p&gt;
  
  &lt;p&gt;classes:
    -
      uri: http://example.com/client/book
      fields:
        - http://purl.org/dc/elements/1.1/title
        - http://purl.org/dc/elements/1.1/date
        - http://purl.org/dc/elements/1.1/language&lt;/p&gt;
  
  &lt;p&gt;-
      uri: http://example.com/client/movie
      fields:
        - http://purl.org/dc/elements/1.1/title
        - http://purl.org/dc/elements/1.1/date
        - http://purl.org/dc/elements/1.1/language
        - http://example.com/client/book
  ...&lt;/p&gt;
  
  &lt;ol&gt;
  &lt;li&gt;Vala code, for defining namespaces&lt;/li&gt;
  &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;With NamespaceManager in &lt;em&gt;current&lt;/em&gt; shape:&lt;/p&gt;

&lt;p&gt;NamespaceManager nsm = NamespaceManager ();
nsm.create_uri (&quot;http://purl.org/dc/elements/1.1/&quot;, &quot;dc&quot;);
nsm.create_uri (&quot;http://example.com/client/&quot;, &quot;client&quot;);
nsm.create_uri (&quot;uri: http://purl.org/dc/elements/1.1/title&quot;, &quot;title&quot;);&lt;/p&gt;

&lt;p&gt;Latter case clearly shows there's additional reference needed.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;ol&gt;
  &lt;li&gt;Vala code for defining properties&lt;/li&gt;
  &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;SchemaModelProperty title_p = SchemaModelProperty (&quot;title&quot;, &quot;string&quot;,
&quot;&quot;, &quot;The title&quot;);
SchemaModelProperty date_p = SchemaModelProperty (&quot;date&quot;, &quot;datetime&quot;,
&quot;0000-01-01 00:00:00&quot;, &quot;Date&quot;);
SchemaModelProperty language_p = SchemaModelProperty (&quot;language&quot;,
&quot;string&quot;, &quot;&quot;, &quot;Languge&quot;);&lt;/p&gt;

&lt;blockquote&gt;
  &lt;ol&gt;
  &lt;li&gt;Vala code for defining classes&lt;/li&gt;
  &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;SchemaModel book_model = SchemaModel (&quot;Book&quot;);
SchemaModel movie_model = SchemaModel (&quot;Movie&quot;);&lt;/p&gt;

&lt;p&gt;book_model.add_model (title_p).add_model (date_p).add_model (language_p);&lt;/p&gt;

&lt;p&gt;movie_model.add_model(title_p).add_model (date_p).add_model
(language_p).add_model (book_model);&lt;/p&gt;

&lt;p&gt;SchemaBuilder schema_builder = SchemaBuilder ();&lt;/p&gt;

&lt;p&gt;try {
    schema_builder.register_model (book_model);
    schema_builder.register_model (movie_model);
    schema_builder.execute ();
} catch () { }&lt;/p&gt;

&lt;blockquote&gt;
  &lt;ol&gt;
  &lt;li&gt;Vala code for creating objects of defined classes&lt;/li&gt;
  &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;StorageModelManager model_manager = storage.get_model_manager();&lt;/p&gt;

&lt;p&gt;StorageModel book_storage_model = model_manager.create_storage_model
(book_model, &quot;books_table&quot;);
StorageModel movie_storage_model = model_manager.create_storage_model
(movie_model, &quot;movies_table&quot;);&lt;/p&gt;

&lt;p&gt;StorageModelProperty title_storage = StorageModelProperty (title_p,
&quot;title_field&quot;);
StorageModelProperty date_storage = StorageModelProperty (date_p,
&quot;date_field&quot;);
StorageModelProperty lang_storage = StorageModelProperty (language_p,
&quot;lang_field&quot;);&lt;/p&gt;

&lt;p&gt;book_storage_model.add_model (title_storage).add_model
(date_storage).add_model (lang_storage);&lt;/p&gt;

&lt;p&gt;StorageModelProperty book_storage = StorageModelProperty (book_model,
&quot;book_field&quot;);&lt;/p&gt;

&lt;p&gt;movie_storage_model.add_model (title_storage).add_model
(date_storage).add_model (lang_storage).add_model (book_storage);&lt;/p&gt;

&lt;p&gt;model_manager.add_model (book_storage_model).add_model
(book_model).add_model (movie_storage_model).add_model (movie_model);&lt;/p&gt;

&lt;p&gt;try {
    model_manager.prepare_create ();
        model_manager.execute  ();
} catch () {}&lt;/p&gt;

&lt;p&gt;SchemaObject book = schema_builder.factory (&quot;Book&quot;);
book.set_property_value (&quot;http://purl.org/dc/elements/1.1/title&quot;, &quot;The
true story of the movie&quot;);&lt;/p&gt;

&lt;p&gt;ContentManager cm = storage.get_content_manager();
cm.create (book);&lt;/p&gt;

&lt;p&gt;SchemaObject movie = schema_builder.factory (&quot;Movie&quot;);
book.set_property_value (&quot;http://purl.org/dc/elements/1.1/title&quot;, &quot;The
great movie&quot;);
book.set_property_value (&quot;http://example.com/client/book&quot;, book);&lt;/p&gt;

&lt;p&gt;cm.create (movie);&lt;/p&gt;

&lt;p&gt;Piotras

&lt;hr /&gt;

dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <pubDate>Tue, 31 Aug 2010 10:55:10 +0000</pubDate>
        </item>
        <item>
            <title>Re: [midgard-dev] RDF use-case</title>
            <link>http://www.midgard-project.org/discussion/developer-forum/read/3798e4f8b4ee11dfbf225f09629cdbd1dbd1/</link>
            <description>&lt;p&gt;On 31.08.2010, at 13:49, Alexey Zakhlestin wrote:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;ol&gt;
  &lt;li&gt;Vala code, for defining namespaces&lt;/li&gt;
  &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;var nm = new NamespaceManager; // should it be singleton?&lt;/p&gt;

&lt;p&gt;nm.create_uri('http://purl.org/dc/elements/1.1/', 'dc');
nm.create_uri('http://example.com/client/', 'client');&lt;/p&gt;

&lt;blockquote&gt;
  &lt;ol&gt;
  &lt;li&gt;Vala code for defining properties&lt;/li&gt;
  &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;var dc_title = new SchemaModelProperty();
dc_title.namespace = 'dc';
dc_title.name = 'title';
dc_title.value_gtype = gchararray;&lt;/p&gt;

&lt;p&gt;var dc_date = new SchemaModelProperty();
dc_date.namespace = 'dc';
dc_date.name = 'date';
dc_date.value_gtype = GDateTime; // from http://github.com/chergert/gdatetime&lt;/p&gt;

&lt;p&gt;var dc_language = new SchemaModelProperty();
dc_language.namespace = 'dc';
dc_language.name = 'language';
dc_language.value_gtype = gchararray;&lt;/p&gt;

&lt;p&gt;var client_book = new SchemaModelProperty();
client_book.namespace = 'client';
client_book.name = 'book';
client_book.value_gtype = ClientBook; // we'll need to define this beforehand&lt;/p&gt;

&lt;p&gt;// ====================================================================
// We need means to store properties definitions at this point without
// attaching them to classes&lt;br /&gt;
// ====================================================================&lt;/p&gt;

&lt;blockquote&gt;
  &lt;ol&gt;
  &lt;li&gt;Vala code for defining classes&lt;/li&gt;
  &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;// http://example.com/client/book
var book_model = new SchemaModel();
book_model.namespace = 'client';
book_model.name = 'book';&lt;/p&gt;

&lt;p&gt;book_model
   .add_model(dc_title)
   .add_model(dc_date)
   .add_model(dc_language);&lt;/p&gt;

&lt;p&gt;// http://example.com/client/movie
var movie_model = new SchemaModel();
movie_model.namespace = 'client';
movie_model.name = 'movie';&lt;/p&gt;

&lt;p&gt;movie_model
   .add_model(dc_title)
   .add_model(dc_date)
   .add_model(dc_language)
   .add_model(client_book);&lt;/p&gt;

&lt;p&gt;// register in type-system
var builder = new SchemaBuilder();
builder.register_model(book_model);
builder.register_model(movie_model);
builder.execute();&lt;/p&gt;

&lt;blockquote&gt;
  &lt;ol&gt;
  &lt;li&gt;Vala code for creating objects of defined classes&lt;/li&gt;
  &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;var book = SchemaBuilder.factory(&quot;http://example.com/client/book&quot;) as SchemaObject;
book.set_property_value('dc:title', 'Do Androids Dream of Electric Sheep?');
book.set_property_value('dc:date', '1968');
book.set_property_value('dc:language', 'en_EN');&lt;/p&gt;

&lt;p&gt;var movie = SchemaBuilder.factory(&quot;http://example.com/client/movie&quot;) as SchemaObject;
movie.set_property_value('dc:title', 'Blade_Runner');
movie.set_property_value('dc:date', '1982-06-25');
movie.set_property_value('dc:language', 'en_EN');
movie.set_property_value('client:book', book);&lt;/p&gt;


&lt;hr /&gt;

dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev
</description>
            <author>Alexey Zakhlestine</author>
            <pubDate>Tue, 31 Aug 2010 10:55:07 +0000</pubDate>
        </item>
        <item>
            <title>Re: [midgard-dev] Midgard3 API proposal</title>
            <link>http://www.midgard-project.org/discussion/developer-forum/read/3b630de0b4e711df926b933c0b9be0d1e0d1/</link>
            <description>&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;p&gt;There are two more issues (at least :) I didn't resolve so far.
    StorageManager is a (kind of) facade for other storage related classes.
    Like ContentManager, ModelManager or QueryManager.&lt;/p&gt;
    
    &lt;p&gt;Returned QueryManager could be responsible to create particular Query
    class, like Select, Iterator, Data, and so on. I wonder if it makes
    sense to provide such functionality (with predefined and limited number
    of Query classes) or make them standalone, constructed for given
    StorageManager?&lt;/p&gt;
  &lt;/blockquote&gt;
  
  &lt;p&gt;well, my thoughts were, that exact number of storage-query classes is dependent on storage.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Yes, thinking about this too.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;we just need to have:
  1) some entry-point, which will be able to convert schema-query to storage-query (and how exactly this storage-query looks like is just &quot;implementation detail&quot; which is not important to application developer)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Can you describe what is schema-query?&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;2) some entry point, which will be able to execute this storage-query (that will be Executable interface, I guess)&lt;/p&gt;
  
  &lt;p&gt;as long as these are present Storage can have any set of query-classes (in the edge-case it even can be single object holding sql-string)&lt;/p&gt;
  
  &lt;p&gt;am I talking nonsense? ;-)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;No. I added QueryManager by purpose. This one should be responsible to
create proper Query object of the storage it belongs too. Tell you what
Query tools are available, etc.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;p&gt;Another issue is similar. I am pretty sure, with SQL StorageManager
    implementation, we will need more than one StorageManager (different SQL
    class instance) objects sharing the same underlying database connection.
    Those might be, for example, raw SQL and Workspace managers used by the
    same application.&lt;/p&gt;
  &lt;/blockquote&gt;
  
  &lt;p&gt;well we can represent it as the system of pipes/transformers, which convert queries to other form.&lt;/p&gt;
  
  &lt;p&gt;Something like this:&lt;/p&gt;
  
  &lt;p&gt;SchemaQuery =&gt; SchemaQuery in Workspace =&gt; StorageQuery
              ^                           ^
             (WorkspaceMapper)           (StorageMapper)&lt;/p&gt;
  
  &lt;p&gt;in this case, we don't need to have actual connection for the workspace.
  workspace can operate on higher level, above any storage-details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I am thinking about different thing. I am thing about possibility to
reuse very low level (from API point of view) and internal resources,
like database connection or file handler (if needed).&lt;/p&gt;

&lt;p&gt;Possible scenario (let's use SQL storage):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I need to authenticate user, so I use raw SQL query.&lt;/li&gt;
&lt;li&gt;User creates some document which should be stored in Workspace A, so
I use Workspace content manager&lt;/li&gt;
&lt;li&gt;User gets some document, which uses RDF ontology and should be
updated, so I use SPARQL content manager.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If those three content managers, need to use the same database, should
application create three different StorageManagers and thus, three
different database connections?&lt;/p&gt;

&lt;p&gt;Main idea is that any object is storage unaware, so any query or content
manager is responsible to store and query data its own way.&lt;/p&gt;

&lt;p&gt;With current state of the API, there should be three storage managers
initialized for this case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;StorageManagerSQL&lt;/li&gt;
&lt;li&gt;StorageManagaerSQLWorkspace&lt;/li&gt;
&lt;li&gt;StorageManagerSPARQL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is bad from resources usage point of view. But it gives us clean
runtime solution.&lt;/p&gt;

&lt;p&gt;Piotras

&lt;hr /&gt;

dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev&lt;/p&gt;
</description>
            <author>Piotr Pokora</author>
            <pubDate>Tue, 31 Aug 2010 10:05:07 +0000</pubDate>
        </item>
    </channel>
</rss>
