OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

obix-comment message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: RE: [obix-comment] Inheritance at instance level & contract behavior.


Hemraj,

That is a great question.

Yes, you can use any instance with an href as a contract.  That is the power of prototype inheritance - much of the oBIX design is inspired by the Self language which used a similar model for inheritance.  What is interesting to think about it, is that if you do allow contracts to define your defaults you can potentially do some of the awesome things Self allowed which was inheritance of state (and even types) on the fly - but that is not really practical today.

According to the specification, you may use contracts to declare default values as you are suggesting.  However, in practical terms you are requiring more sophisticated client software which will understand all your contracts and do the right thing.  I personally would err on the side of simplicity and just put everything into every oBIX document you serve.  That guarantees that drop dead simple client software will work reliably, and in most situations the extra bandwidth shouldn't really matter.

I think the appropriate situations to use contract defaults are in specifications themselves to keep specifications more concise and easier to read.  Potentially use contract defaults when you control both the client and server side of things.  But in general, I'd suggest a full serialization when sending oBIX over a network (I believe the specification actually suggests this too) - that will ensure that even the dumbest clients will work.

Brian

-----Original Message-----
From: Chaudhari, Hemraj [mailto:HChaudhari@trane.com]
Sent: Fri 16-Feb-07 9:51 AM
To: obix-comment@lists.oasis-open.org
Subject: [obix-comment] Inheritance at instance level & contract behavior.
 
Hi All,

I have some question about obix standard. Specifically, about inheritance,
definition and instance of contract.

 

1)       I can inherit one contract from other through "is" contract list.
Can I do such inheritance at instance level? i.e. can I inherit one instance
from other instance?

e.g.  Following is contract

<obj href="myNs:ContractA/">

  <int name="subElement1" val="1">

    <int name="subElement1_1" val="2"/>

  </int>

</obj>

 

      Instance 1:

<obj href="http://someServer/obix/inst1"; is="myNs:ContractA/">

  <int name="subElement1" val="11">

    <int name="subElement1_1" val="12"/>

  </int>

</obj>

 

      Instance 2:

      

<obj href="http://someServer/obix/inst2"; is="/obix/inst1 myNs:ContractA/">

  <int name="subElement1" val="21"/>

</obj>

 

      Is following interpretation of instance 2 is expected by client?

<obj href="http://someServer/obix/inst2"; is="/obix/inst1 myNs:ContractA/">

  <int name="subElement1" val="21">

    <int name="subElement1_1" val="12"/>

  </int>

</obj>

 

 

2)       Contract defines structure (or data type) for communication. Doest
that mean contract defines data also (default val facet)? If yes, can server
ignore sending whole element if val is according to contract. 

 

Consider following contract

<obj href="myNs:ContractA/">

  <int name="subElement1" val="1">

    <int name="subElement1_1" val="2"/>

  </int>

</obj>

 

            If value of subElement1 is 1 & value of subElement1_1 is 2 on
server, shall client treat following response as valid response from server?

 

<obj href="http://someServer/obix/inst1"; is="myNs:ContractA/">

</obj>    

 

And make assumption that subElement1 val="1" and subElement1_1 val="2"
(because that's what contract says implicitly).

 

 

Regards,

Hemraj Chaudhari.

 




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]