You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Riccardo Mariani <ma...@gmail.com> on 2015/09/08 12:23:11 UTC

multiple schemas

Hi Olingo users,
I'm using the latest Olingo java library, v4 snapshot.

If I understand well the Olingo EdmProvider,
I can create multiple data models using multiple schemas (CsdlSchema) 
where each schema has a different namespace.

So if I suppose that
- Schema1 has a namespace named DataModel1 and
- Schema2 has a namespace named DataModel2
then I can query http://service/DataModel1.ContainerX.EntitySetX or 
http://service/DataModel2.ContainerY.EntitySetY

Am I right until here?

Now I'd like to have multiple containers inside the same namespace.
Let say
- http://service/DataModel1.ContainerX.EntitySetX
- http://service/DataModel1.ContainerY.EntitySetY

It seems to me that I cannot define multiple containers inside the same 
CsdlSchema.
Should I create 2 schemas where the namespace is the same and the 
container has a different name?
Is this the correct way to obtain my goal?

Thanks a lot at all.

Riccardo.

Re: multiple schemas

Posted by "Bolz, Michael" <mi...@sap.com>.
Hi Mathias,

In OData V2 exists the <using> (see chapter 2.1.13).
However with Olingo V2 this is not supported (unfortunately for your issue).

Best Regards,
Michael

> On 09 Sep 2015, at 15:13, Märker, Mathias <Ma...@tt-s.com> wrote:
> 
> Sorry to interrupt your conversion :)
> 
> Does anybody have an example of how "References" do work in olingo? Could I create a Service(v2) and Reference another Service and its entitysets etc. there (v2)? That would probably solve my current problems, but I don't understand how to set it up in olingo..
> 
> Regards
> Mathias 


AW: multiple schemas

Posted by Märker, Mathias <Ma...@tt-s.com>.
Sorry to interrupt your conversion :)

Does anybody have an example of how "References" do work in olingo? Could I create a Service(v2) and Reference another Service and its entitysets etc. there (v2)? That would probably solve my current problems, but I don't understand how to set it up in olingo..

Regards
Mathias 

-----Ursprüngliche Nachricht-----
Von: Ramesh Reddy [mailto:rareddy@redhat.com] 
Gesendet: Mittwoch, 9. September 2015 15:09
An: user@olingo.apache.org
Betreff: Re: multiple schemas

That really depends upon your requirement, do you have to represent one single service that encompass two data models, or two separate one is fine?

Two single ones is straight forward, yes, you have two distinctive end points, but you can still define references using the "References" element in CSDL document.

if you want single service, then define two schemas, but with single entity-container which defines the your *target* service that can define entitysets, function imports etc based on both schema elements.

Ramesh..

----- Original Message -----
> Thank you Ramesh!
> Maybe now I have a clearer idea.
> 
> At the end of the day:
> - a single odata end point always defines a single data model and a 
> single entity container;
> - But sometime you can use schemas, having different namespaces, to 
> "partition" the global data model and the global entity container.
> Right?
> 
> So if my objective is to provide 2 different data models, I have to 
> implement 2 odata end points. Right?
> 
> 
> On 08/09/15 15:55, Ramesh Reddy wrote:
> > Per OData specification, you can have multiple schemas, but single 
> > container in the $metadata of the service.
> >
> > The way I approached is, I created single schema and single 
> > container in $metadata such that
> >
> > http://service/DataModel1/EntitySetX
> > http://service/DataModel2/EntitySetY
> >
> > will work, then define the References between the schemas. See
> > http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/par
> > t3-csdl/odata-v4.0-errata02-os-part3-csdl-complete.html#_Toc40639793
> > 0
> >
> > another option is define multiple schemas in single document, but 
> > define single container that defines EnitySet, FunctionImport, 
> > ActionImport for any the schema element defined in any of the 
> > schemas. So essentially it works like
> >
> > http://service/EntitySetX
> > http://service/EntitySetY
> >
> >
> > Ramesh..
> >
> > ----- Original Message -----
> >> Hi Olingo users,
> >> I'm using the latest Olingo java library, v4 snapshot.
> >>
> >> If I understand well the Olingo EdmProvider, I can create multiple 
> >> data models using multiple schemas (CsdlSchema) where each schema 
> >> has a different namespace.
> >>
> >> So if I suppose that
> >> - Schema1 has a namespace named DataModel1 and
> >> - Schema2 has a namespace named DataModel2 then I can query 
> >> http://service/DataModel1.ContainerX.EntitySetX or 
> >> http://service/DataModel2.ContainerY.EntitySetY
> >>
> >> Am I right until here?
> >>
> >> Now I'd like to have multiple containers inside the same namespace.
> >> Let say
> >> - http://service/DataModel1.ContainerX.EntitySetX
> >> - http://service/DataModel1.ContainerY.EntitySetY
> >>
> >> It seems to me that I cannot define multiple containers inside the 
> >> same CsdlSchema.
> >> Should I create 2 schemas where the namespace is the same and the 
> >> container has a different name?
> >> Is this the correct way to obtain my goal?
> >>
> >> Thanks a lot at all.
> >>
> >> Riccardo.
> >>
> 
> 

Re: multiple schemas

Posted by Ramesh Reddy <ra...@redhat.com>.
That really depends upon your requirement, do you have to represent one single service that encompass two data models, or two separate one is fine?

Two single ones is straight forward, yes, you have two distinctive end points, but you can still define references using the "References" element in CSDL document.

if you want single service, then define two schemas, but with single entity-container which defines the your *target* service that can define entitysets, function imports etc based on both schema elements.

Ramesh..

----- Original Message -----
> Thank you Ramesh!
> Maybe now I have a clearer idea.
> 
> At the end of the day:
> - a single odata end point always defines a single data model and a
> single entity container;
> - But sometime you can use schemas, having different namespaces, to
> "partition" the global data model and the global entity container.
> Right?
> 
> So if my objective is to provide 2 different data models, I have to
> implement 2 odata end points. Right?
> 
> 
> On 08/09/15 15:55, Ramesh Reddy wrote:
> > Per OData specification, you can have multiple schemas, but single
> > container in the $metadata of the service.
> >
> > The way I approached is, I created single schema and single container in
> > $metadata such that
> >
> > http://service/DataModel1/EntitySetX
> > http://service/DataModel2/EntitySetY
> >
> > will work, then define the References between the schemas. See
> > http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part3-csdl/odata-v4.0-errata02-os-part3-csdl-complete.html#_Toc406397930
> >
> > another option is define multiple schemas in single document, but define
> > single container that defines EnitySet, FunctionImport, ActionImport for
> > any the schema element defined in any of the schemas. So essentially it
> > works like
> >
> > http://service/EntitySetX
> > http://service/EntitySetY
> >
> >
> > Ramesh..
> >
> > ----- Original Message -----
> >> Hi Olingo users,
> >> I'm using the latest Olingo java library, v4 snapshot.
> >>
> >> If I understand well the Olingo EdmProvider,
> >> I can create multiple data models using multiple schemas (CsdlSchema)
> >> where each schema has a different namespace.
> >>
> >> So if I suppose that
> >> - Schema1 has a namespace named DataModel1 and
> >> - Schema2 has a namespace named DataModel2
> >> then I can query http://service/DataModel1.ContainerX.EntitySetX or
> >> http://service/DataModel2.ContainerY.EntitySetY
> >>
> >> Am I right until here?
> >>
> >> Now I'd like to have multiple containers inside the same namespace.
> >> Let say
> >> - http://service/DataModel1.ContainerX.EntitySetX
> >> - http://service/DataModel1.ContainerY.EntitySetY
> >>
> >> It seems to me that I cannot define multiple containers inside the same
> >> CsdlSchema.
> >> Should I create 2 schemas where the namespace is the same and the
> >> container has a different name?
> >> Is this the correct way to obtain my goal?
> >>
> >> Thanks a lot at all.
> >>
> >> Riccardo.
> >>
> 
> 

Re: multiple schemas

Posted by Riccardo Mariani <ma...@gmail.com>.
Thank you Ramesh!
Maybe now I have a clearer idea.

At the end of the day:
- a single odata end point always defines a single data model and a 
single entity container;
- But sometime you can use schemas, having different namespaces, to 
"partition" the global data model and the global entity container.
Right?

So if my objective is to provide 2 different data models, I have to 
implement 2 odata end points. Right?


On 08/09/15 15:55, Ramesh Reddy wrote:
> Per OData specification, you can have multiple schemas, but single container in the $metadata of the service.
>
> The way I approached is, I created single schema and single container in $metadata such that
>
> http://service/DataModel1/EntitySetX
> http://service/DataModel2/EntitySetY
>
> will work, then define the References between the schemas. See http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part3-csdl/odata-v4.0-errata02-os-part3-csdl-complete.html#_Toc406397930
>
> another option is define multiple schemas in single document, but define single container that defines EnitySet, FunctionImport, ActionImport for any the schema element defined in any of the schemas. So essentially it works like
>
> http://service/EntitySetX
> http://service/EntitySetY
>
>
> Ramesh..
>
> ----- Original Message -----
>> Hi Olingo users,
>> I'm using the latest Olingo java library, v4 snapshot.
>>
>> If I understand well the Olingo EdmProvider,
>> I can create multiple data models using multiple schemas (CsdlSchema)
>> where each schema has a different namespace.
>>
>> So if I suppose that
>> - Schema1 has a namespace named DataModel1 and
>> - Schema2 has a namespace named DataModel2
>> then I can query http://service/DataModel1.ContainerX.EntitySetX or
>> http://service/DataModel2.ContainerY.EntitySetY
>>
>> Am I right until here?
>>
>> Now I'd like to have multiple containers inside the same namespace.
>> Let say
>> - http://service/DataModel1.ContainerX.EntitySetX
>> - http://service/DataModel1.ContainerY.EntitySetY
>>
>> It seems to me that I cannot define multiple containers inside the same
>> CsdlSchema.
>> Should I create 2 schemas where the namespace is the same and the
>> container has a different name?
>> Is this the correct way to obtain my goal?
>>
>> Thanks a lot at all.
>>
>> Riccardo.
>>


Re: multiple schemas

Posted by Ramesh Reddy <ra...@redhat.com>.
Per OData specification, you can have multiple schemas, but single container in the $metadata of the service.

The way I approached is, I created single schema and single container in $metadata such that 

http://service/DataModel1/EntitySetX 
http://service/DataModel2/EntitySetY

will work, then define the References between the schemas. See http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part3-csdl/odata-v4.0-errata02-os-part3-csdl-complete.html#_Toc406397930

another option is define multiple schemas in single document, but define single container that defines EnitySet, FunctionImport, ActionImport for any the schema element defined in any of the schemas. So essentially it works like

http://service/EntitySetX
http://service/EntitySetY


Ramesh..

----- Original Message -----
> Hi Olingo users,
> I'm using the latest Olingo java library, v4 snapshot.
> 
> If I understand well the Olingo EdmProvider,
> I can create multiple data models using multiple schemas (CsdlSchema)
> where each schema has a different namespace.
> 
> So if I suppose that
> - Schema1 has a namespace named DataModel1 and
> - Schema2 has a namespace named DataModel2
> then I can query http://service/DataModel1.ContainerX.EntitySetX or
> http://service/DataModel2.ContainerY.EntitySetY
> 
> Am I right until here?
> 
> Now I'd like to have multiple containers inside the same namespace.
> Let say
> - http://service/DataModel1.ContainerX.EntitySetX
> - http://service/DataModel1.ContainerY.EntitySetY
> 
> It seems to me that I cannot define multiple containers inside the same
> CsdlSchema.
> Should I create 2 schemas where the namespace is the same and the
> container has a different name?
> Is this the correct way to obtain my goal?
> 
> Thanks a lot at all.
> 
> Riccardo.
>