in

The ORM Foundation

Get the facts!

XML schema

Last post 02-04-2009 19:09 by JimLudden. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 01-25-2009 12:30

    XML schema

    I'm trying to extract the entity objects and their 'informal' definitions.

    The standard report does not distinguish value type from entity type from facts in the top-level HTML report.

    I also tried to import the ORM file into Excel (without benefit of the schema).  I got tons of data, but cannot find an XML element that appears to define the nature of the object. The names require definition: how can I distinguish IsMandatory from IsMandatory58 from IsMandatory72 from IsMandatory77?

     Where can we get a fully-documented XML schema?

    Jim Ludden
    Filed under: ,
  • 01-25-2009 14:55 In reply to

    Re: XML schema

    I'm assuming you're trying to extra data from the .orm file, not the HTML report, which would be very difficult to query.

    NORMA installs schema files for all XML elements. If you have the .orm file open in an XML editor in VS, then right click on an orm-prefixed element (orm:EntityType, for example) and choose 'GoTo Definition' to open the schema file. Of course, you also get IntelliSense help in the XML file itself (click on EntityType and type Control-J, you'll see the possible element names for this position).

    All elements in the orm:ORMModel section fall into three categories:

    1. An element with an @id attribute forms the primary definition for an element
    2. An element with a @ref attribute references the secondary element. If a @ref element also has an @id, then the @id is the primary definition for the relationship (think objectification).
    3. Any element with @id or @ref describes the relationship between elements

    There are a few other file standards (any attribute that starts with an _ is derived, both ends of some relationships are serialized for convenience (orm:EntityType/orm:PlayedRoles is redundant with orm:Fact/orm:FactRoles/orm:Role/orm:RolePlayer, for example)). The Ctrl-F3 command (search for word under cursor) is your friend: click on the first part of and id or ref and type Ctrl-F3 to see where else it is used. If you don't have the XPathMania package installed in VS I'd recommend doing so to help with xpath work (Google XPathMania 2008 to find a VS2008 version I posted in 2007).

    The following xpath will find all non-ValueTypes that have a definition:

    */orm:ORMModel/orm:Objects/orm:*[self::orm:EntityType or self::orm:ObjectifiedType][orm:Definitions/orm:Definition] 

    You can get more advanced with some inner queries as well. This gets all FactTypes that are not part of the preferred identifier for any entity type. 

    */orm:ORMModel/orm:Facts/orm:Fact[not(orm:FactRoles/orm:Role[@id=../../../../orm:Constraints/orm:UniquenessConstraint[@id=../../orm:Objects/orm:*[self::orm:EntityType or self::orm:ObjectifiedType]/orm:PreferredIdentifier/@ref]/orm:RoleSequence/orm:Role/@ref])]

    However, straight xpath is rather limiting, you need to get an xsl transform running so that you can define some variables and refine your output. Excel is not going to be able to read these files easily, there are just too many references.

    I'm the first to admit that the schema file is not a strong part of the product. If you questions on individual elements please let me know.

    -Matt

    PS Please note that we will be doing a new file format at some point, at which point a lot of the tag names will change, but most of the structure will remain consistent. We've been holding off on this for a while to not cause folks pain more than once and will obviously let you know when it happens. Some tag names are just wrong (Facts/Fact instead of FactTypes/FactType, etc). We've also left a few things in the schema (IsPrimary on a SubtypeFact, for example) to allow files to read in, but we don't write these attributes to write back out.

  • 01-30-2009 16:26 In reply to

    Re: XML schema

    Matt,

    These instructions appear to be really helpful. However, I'm too naive for this answer. When I open the ORM file in VS, I only get the diagrams - even if I rename the file to be .XML. When I open the XML-named file in Internet Explorer I can see the raw XML, but cannot go to the definition.

    If I try to navigate to http://schemas.neumont.edu/ORM/2006-04/ORMDiagram, I get "The website cannot be found"

    I am able to open the .ORM file in Excel, which creates a huge worksheet. It is possible to get my data from there, only awkward.

    Jim Ludden
    Filed under: , ,
  • 01-31-2009 0:49 In reply to

    Re: XML schema

    First set of steps (in VS):

    1. File/Open dialog, choose the .ORM file, but do not actually open it (double click or enter).
    2. On the right of the Open button you'll see a small down arrow. Click it to open a menu.
    3. Choose Open With... on the dropdown
    4. Select the 'XML Editor'
    5. Once you're in the XML editor, right click on any orm: element (orm:ORMModel will do) and choose 'Goto Definition' to open the installed schema file.

    Note that it is not uncommon to have URI's used for XML namespaces not actually resolve to a file. It's just an identifier.

    Other steps:

    1. In the VS Tools/Options dialog, choose the Environment/Documents tab
    2. Check the 'Show Miscellaneous Files in Solution Explorer' option and pick a number above 0. OK to save the options
    3. Open the .orm file normally, then close it
    4. Open the 'Solution Explorer' window (near the top of the View menu)
    5. Right click the .orm file and select 'Open With...'
    6. Proceed as in step 1

    Let me know if you have other questions on navigating VS.

    -Matt

  • 02-04-2009 17:46 In reply to

    Re: XML schema

    Whoop dee doo.  Got it to work.  Moreover, I found the XSD files on my computer (with your help), located at:

    C:\Program Files\Common Files\Neumont\ORM\Schemas

    Now I should be able to import to Access easily.  We'll see.

    Jim Ludden
  • 02-04-2009 19:09 In reply to

    Re: XML schema

    Hmmm.  Not so easy.  Access finds the XSD and creates many tables, but with no foreign keys. I cannot connect an Object to its Note or Informal Definition.

    Is that evidence of my near-total ignorance of XML?

    Jim Ludden
Page 1 of 1 (6 items)
© 2008-2014 The ORM Foundation: A UK not-for-profit organisation -------------- Terms of Service