Hi Peter!

thanks for the details - I did my proxy class and it works,

but I think it is very slow ... ?

May be I can do something with the indices but at the moment I am not very
satisfied ...

I think the "native" xml projection would be faster ?
may be because of the managed relationships ...

here is my proxy class:

 Class GAS.DisplayDocument Extends (%RegisteredObject, %XML.Adaptor) [
ProcedureBlock ]
{

Property Name As %String;

Property DocumentType As %String;

Property StorageType As %String;

Property Field As %String;

Property Responsibility As %String;

Property Origin As %String;

Property WorkOrder As %String;

Property Archive As %String;

Property Folder As %String;

Property PaperFormat As %String;

Property DrawingDate As %Date;

Property OriginId As %String(MAXLEN = 256);

Property Path As %String(MAXLEN = 256);

Property ProjectNumber As %String(MAXLEN = 256);

Property DrawingNumber As %String(MAXLEN = 256);

Property PageNumber As %String(MAXLEN = 256);

Property RevisionNumber As %String(MAXLEN = 256);

Property RevisionAuthor As %String(MAXLEN = 256);

Property RevisionMark As %String(MAXLEN = 256);

Property ToObject As %String[ Collection = List ];

Property ToHandBookType As %String [ Collection = List ];

ClassMethod getData(inOBJID) as GAS.DisplayDocument
{
set oData=##class(GAS.Document).%OpenId(inOBJID)
set out=..%New()
set out.Name=oData.Name

set out.DocumentType=oData.DocumentType.Name
set out.StorageType=oData.StorageType.Name
set out.Field=oData.Field.Name
set out.Responsibility=oData.Responsibility.Name
set out.Origin=oData.Origin.Name
set out.WorkOrder=oData.WorkOrder.Name
set out.Archive=oData.Archive.Name
set out.Folder=oData.Folder.Name
set out.PaperFormat=oData.PaperFormat.Name

set out.DrawingDate=oData.DrawingDate
set out.PageNumber=oData.PageNumber
set out.OriginId=oData.OriginId
set out.Path=oData.Path
set out.ProjectNumber=oData.ProjectNumber
set out.DrawingNumber=oData.DrawingNumber
set out.RevisionNumber=oData.RevisionNumber
set out.RevisionAuthor=oData.RevisionAuthor
set out.RevisionMark=oData.RevisionMark

for i=1:1:oData.ToObject.Count()
{
set x = oData.ToObject.GetAt(i)
do out.ToObject.Insert(
x.DocumentReferenceObject.Name _ " -> " _
x.ToObject.Name _ " [ " _
x.ToObject.ObjectType.Name _ " ] "
)
}
for i=1:1:oData.ToHandBookType.Count()
{
set x = oData.ToHandBookType.GetAt(i)
do out.ToHandBookType.Insert(
x.DocumentReferenceObject.Name _ " -> " _
x.ToHandBookType.Name _ " [ " _
x.ToHandBookType.ObjectType.Name _ " ] "
)
}

quit out
}

}

as you can see I have 2 collections and these are both relationships to an
n:m class with relationships to 2 another classes...
and a lot of objects with a calculated property "Name" - but with the native
property "NameDe" it is not faster.

when I dump the whole stuff into an xml file - what is not really nice to
read - I get a lot more of data and it tooks less time ?

do not know if I can do anything with indices - as I am not very fit in this
index miracle ;-)

but may I need some "persistent proxy" with triggers that stores the data
read only for better performance if I need on-line methods...
I work with only 317 resulting records and it takes 00:01:44 seconds to get
a 333kB (6500 xml lines) on a 2.6 GHz WinXP machine.

the query itself takes 00:00:28 seconds

 set query = "SELECT * FROM GAS.Document, GAS.DocumentReference,
GAS.DocumentDynamicReference " _
" WHERE ( GAS.DocumentDynamicReference.ToHandBookType = " _ HandBookType _
" AND GAS.Document.Id = GAS.DocumentDynamicReference.FromDocument AND " _
" GAS.DocumentReference.ToObject = " _ Responsibility _
" AND GAS.Document.ID = GAS.DocumentReference.FromDocument ) " _
" ORDER BY GAS.Document.DocumentType "


SELECT Count(*) FROM GAS.Document ... 21084
SELECT Count(*) FROM GAS.DocumentReference ... 73853
SELECT Count(*) FROM GAS.DocumentDynamicReference ... 12397


brg
werner

"Peter Cooper" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Werner
>
> I have not tried the various things that Marvin has done in 5.0.5 for
> various reasons I am on 5.0.4 for a while
>
> For the transforms you could look at making your own datatype and
> writing a custom XSDToLogical and LogicalToXSD functions
>
> What are you doing with XML?
> SOAP/Web Services or something else?
>
> I suspect from your questions you will end up doing proxy classes -
> Marvin and his team do an amazing job but they are producing a general
> purpose structure and I suspect that you will require something more
> specific
>
> So some more detail on the Proxy classes
>
> make them registered, descended from %XML.Adaptor
> if you have a many side (children) make these a list - not a
> relationship, relationships are only supported by persistent classes
>
> and then make a getData method
>
> something like
>
> Class ClassA Extends %RegisteredObject,%XML.Adaptor
> property p1 as %String;
> properyt p2 as %String;
> properyt p3 as ClassB [collection=list];
> ===
>
> Class ClassB  Extends %RegisteredObject,%XML.Adaptor
> property p1 as %String;
> properyt p2 as %String;
>
> ====
> this is a classmethod of ClassA
> ClassMethod getData(inOBJID) as ClassA
> set oData=##class(TheDataClass).%OpenId(inOBJID)
> set out=..%New()
> set out.p1=oData.SomeProp
> set out.p2=oData.SomeOtherProp
>
> for i=1:1:some_counter
> {
>   set oLine=##class(classB).%New()
>   set oLine.p1=Some_Data
>   set oLine.p2=Some_Other_Data
>   do out.p3.Insert(oLine)
> }
>
>  quit out
> ======
> And then in a web service
>
> ClassMethod getTheData(inOBJID) as ClassA [Webmethod]
> quit ##class(ClassA).getData(inOBJID)
> ===
>
> this will result in a XML file that looks like
>
> <classA>
> <p1>data</p1>
> <p2>data</p2>
> <p3>
>    <p1>data</p1>
>    <p2>data</p2>
> </p3>
> <p3>
>    <p1>data</p1>
>    <p2>data</p2>
> </p3>
> <p3>
>    <p1>data</p1>
>    <p2>data</p2>
> </p3>
> ... repeats for however many lines there are
> and you have complete control over it
> </classA>
>
> if you then need a different structure but based on the same
> persistent data just make a new proxy to represent the structure and a
> new getData to populate it
>
> you also have complete control over the projection in the proxy class
> just make
> property p1 as %String[xmlprojection=Attribute]
>
> will produce
> <classA p1="data">
> <p2>data</p2>
> <p3>
> ....
>
> Have fun
>
> Peter
>
> PS typed this from scratch so there will be typos but you get the idea
>
>



Reply via email to