Tuesday, November 29, 2011

Newbie question on re-defining an XML schema in my Django data model...

I need some help in resetting my thinking on creating my Django data
model.

I have previously created an XML schema definition for my data model,
but am now trying to re-create this XML data model in a Django data
model.

In my XML schema, I had defined "collections" of XML complex types
that essentially were lists that I could XQuery. I used the ID &
IDREF tags to cross-reference my elements between lists of elements.
As XML is a tree structure, my schema defined a top down tree
hierarchy. Now I want to redefine this in a Django data model.

In my primary scenario, I had a list of "singular" workflows that
constituted a "parent" element "catalog" of workflows, i.e. a workflow
catalog. Multiple "singular" workflows can be combined into an ORDERED
collection of workflows called a "reference" or "composite" workflow.
There are many composite/reference workflow instances with varied
ordered combinations of singular workflows.

In my XML hierarchy, I used the IDREF tags to reference the "singular"
workflows from within the "reference" workflow element instance.

In my Django object model, I can define a class for a "singular"
workflow...easy enough, and I can query the Django database model to
select the "singular" workflows.

But, what is the correct method of now creating the "composite"
workflow that will reference the singular workflows?

My pseudo-code for the composite workflow class looks like this...

class SingularWorkFlow(models.Model):
pass

class CompositeWorkflow(models.Model):
OrderedListOfSingularWorkflows =
list(models.ForeignKey(SingularWorkFlow)

I don't think this will work, but would kindly ask for some guidance.

Regards, Marc

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment