Hi,

On Tue, Jan 8, 2019 at 11:08 PM Jason E Bailey <jason.bai...@24601.org>
wrote:

> I really appreciate the thought that you put into this.
>
> If you are utilizing the JCR Resource Provider to store a resource you
> have to declare a jcr:primaryType, and you are then bound by the definition
> of the node as to what you can add as an attribute or a child type.  So
> there is such thing as "creating a  resource without a JCR node type" if
> that resource is to be persisted in the JCR.
>

You can simply use nt:unstructured or any other node type, but what I meant
was that you don't drive your type using JCR node type. Maybe you want to
use sling:resourceType exclusively.

For example if you have an existing content like this:

```
+ /mycontent
  - jcr:primaryNodeType = "nt:folder"
  - jcr:created = "2019-01-01T00:00:00Z"
```

Here, since it is using [nt:folder], you may decide to define a DataModel
for nt:folder by defining jcr:created property for it (Note the property is
actually from the supertype [nt:hierarchyNode]).
So when other code inspect the resource (/mycontent) using DataModel, it
will get Property instance for jcr:created.

But you don't have to strictly model your content using JCR like this. Like
I said, you can simply decide to drive the typing using resource type only:

```
+ /mycontent2
  - jcr:primaryNodeType = "nt:unstructured"
  - sling:resourceType = "my/page"
  - my:created = "2019-01-01T00:00:00Z"
  - my:title = "Title 1"
```

Here, you simply define a DataModel for `/apps/my/page` having my:created
and my:title properties.
So when other code inspect the resource (/mycontent2) using DataModel, it
will get Property instances for my:created and my:title.

Cheers,
Christanto

[nt:folder] https://wiki.apache.org/jackrabbit/nt%3Afolder
[nt:hierarchyNode] https://wiki.apache.org/jackrabbit/nt%3AhierarchyNode



>
> One of the core tenants of Sling is that everything is a Resource. One of
> my expectations of a Type system is that I can create a type by POST and
> retrieve the structure of the type via a GET.  That the  definitions of a
> Type are themselves resources.
>
> I may be missing this from your whitepaper, is that doable?
>
> --
> Jason
>
> On Tue, Jan 8, 2019, at 9:11 AM, Christanto Leonardo wrote:
> > Hi,
> >
> > > 5. you describe it should be possible to derive data models from JCR
> CND
> > definitions. do you think this should be the major use case? JCR CND
> > definitions are quite out-of-fashion nowadays, and used more for
> historical
> > reasons (or for performance optimizations because oak indexes are based
> on
> > them). the tooling around them is not good (e.g. difficult to
> > update/replace them in a running system).
> >
> > The purpose of the Sling Modeling Framework is to model your
> applications,
> > possibly the existing ones.
> > So if you have an existing resource defined in JCR with all the node
> types
> > (e.g. cq:PageContent resource), the modeling framework must be able to
> > model that.
> > If you create a new resource without JCR node type, then when defining
> that
> > resource type you don't need to use CND.
> >
> > I think it is already explained at:
> >
> >    1.
> >
> >
> https://github.com/christanto/sling-whiteboard/blob/master/modeling/docs/explainer.md#data-modeling-using-jcr-node-types
> >    2.
> >
> >
> https://github.com/christanto/sling-whiteboard/blob/master/modeling/docs/explainer.md#modeling-the-underlying-platforms-typing-system
> >
> > Cheers,
> > Christanto
> >
> >
> > On Tue, Jan 8, 2019 at 6:44 PM Stefan Seifert <sseif...@pro-vision.de>
> > wrote:
> >
> > > hello christanto.
> > >
> > > thanks for bringing this up! some first questions after a first read:
> > >
> > > 1. why defining a new "DSL" to describe the model metadata? what's with
> > > existing things like json schema. defining a completely new DSL often
> has
> > > the risk of not getting it "right" in the first place.
> > >
> > > 2. do you plan to support only a single resource/node and it's
> properties.
> > > what's with sub tree structures, that are supported by JCR CND
> definitions?
> > > more complex data models like forms are unlikely to be represented by a
> > > single resource. or maybe that is already covered with the property
> > > handlers although the name does not indicate it.
> > >
> > > 3. one of the reasons why sling is why it is (without an explicit
> modeling
> > > capability) is the rule #1 of david's model "Data First, Structure
> Later.
> > > Maybe." [1]. this was stated a very long time ago. would be nice if
> you can
> > > add a reference to your explainer page to it as well and explain why
> you
> > > think different nowadays (i think there are good reasons for it, but it
> > > always depends on the use cases).
> > >
> > > 4. the name "Models" can be mixed up with "Sling Models" [2] which
> points
> > > somewhat into the same direction but is currently based on different
> > > concepts and is already used much. but i suppose this can be sorted out
> > > later to decide if this new approach can be "Sling Models 2.0" or the
> new
> > > things should get a different name (like Type System). still it would
> make
> > > sense to also add a reference to sling models to the explainer.
> > >
> > > 5. you describe it should be possible to derive data models from JCR
> CND
> > > definitions. do you think this should be the major use case? JCR CND
> > > definitions are quite out-of-fashion nowadays, and used more for
> historical
> > > reasons (or for performance optimizations because oak indexes are
> based on
> > > them). the tooling around them is not good (e.g. difficult to
> > > update/replace them in a running system).
> > >
> > > 6. you describe some "other models" like FormModel, ActionsModel which
> > > sound like hypermedia support. i do not fully understand how hypermedia
> > > support fits into the other parts you describe which primarily
> describe the
> > > data model and not the actions for them. where does this hypermedia
> > > metadata come from?
> > >
> > > stefan
> > >
> > > [1] https://wiki.apache.org/jackrabbit/DavidsModel
> > > [2] https://sling.apache.org/documentation/bundles/models.html
> > >
> > >
> > >
> > > >-----Original Message-----
> > > >From: Christanto Leonardo [mailto:christanto.leona...@gmail.com]
> > > >Sent: Tuesday, January 8, 2019 4:03 AM
> > > >To: dev@sling.apache.org
> > > >Subject: Re: Sling Type System: started a wiki page for concepts,
> ideas,
> > > >motivation
> > > >
> > > >Hello,
> > > >
> > > >I am currently working on the proposal to introduce the concept of
> > > modeling
> > > >in Sling. See it at <
> > > >https://github.com/christanto/sling-whiteboard/tree/master/modeling>.
> > > >One is especially encouraged to read the explainer at <
> > > >https://github.com/christanto/sling-
> > > >whiteboard/blob/master/modeling/docs/explainer.md
> > > >>.
> > > >
> > > >My hope is that the Sling Modeling Framework can provide the ability
> to
> > > >model many concepts in the application, starting with the typing
> system of
> > > >the resource (i.e. the resource type definition) as the lowest layer.
> > > >
> > > >Please let me know what you think. I plan to continue developing this
> > > >proposal.
> > > >
> > > >Cheers,
> > > >Christanto
> > > >
> > > >On 2018/10/02 11:59:08, Bertrand Delacretaz <b...@apache.org> wrote:
> > > >> Hi,>
> > > >>
> > > >> Recent discussions with a number of people from the Sling community>
> > > >> [1] have helped clarify my thoughts about this, I have started a
> wiki>
> > > >> page at
> > > >
> > >
> https://cwiki.apache.org/confluence/display/SLING/Sling+Type+System%3A+moti
> > > >vation+and+requirements>
> > > >
> > > >> and feedback is welcome, on that page or here.>
> > > >>
> > > >> Roughly, the goal is to create a Sling Type System that defines
> much>
> > > >> more precisely what the various Resource Types can contain, how
> they>
> > > >> work together, etc. with the goal of generating self-describing>
> > > >> interfaces.>
> > > >>
> > > >> Let's see where this leads, it's just rough ideas so far but it
> feels>
> > > >> like a useful unifying concept for Sling.>
> > > >>
> > > >> -Bertrand>
> > > >>
> > > >> [1] along with reading "a conversation with Alan Kay, creator of>
> > > >> Smalltalk" - https://queue.acm.org/detail.cfm?id=1039523>
> > > >>
> > >
> >
>

Reply via email to