(* ** These views provide the data needed to create the objects defined ** in the the OMG PDM Enablers specification (PDME) ** ftp://ftp.omg.org/pub/docs/mfg/98-02-02.pdf including the changes ** sited in the revision task force report ** ftp://ftp.omg.org/pub/docs/dtc/99-02-02 from the PDM Schema ** produced by PDES Inc and ProSTEP, Version 1.1 12/09/1998, ** http://www.pdm-if.org. ** Author: KC Morris, kc@nist.gov ** last revised: June 30, 1999 ** Development of this software was funded by the United States ** Government, and is not subject to copyright. ** With the exceptions noted below this mapping covers the PDME ** modules PdmResponsibility, PdmProductStructureDefintion and ** PdmDocumentManagement. Portions of the PdmFoundation module are ** also covered as needed by the other modules. The following ** interfaces from those modules are not mapped explicitly although ** they are supported by PDMS data. Vault FileStorage ** The following conventions are used in this mapping: ** - In some cases if there was a possibility that some instances ** would be lost by projections a complimentary view was created to ** catch those lost instances. The convention for naming these ** complimentary views is to preface the originating view name with ** "missing_." ** - When there were data fields, from the primary entities involved ** in a view, that did not map into the PDM Enablers interfaces, ** those attributes were retained in the view. They are located at ** the end of the view and are preceded by the comment (* missing *) ** . ** - To aid in debugging, generating comments, and in some cases ** getting to certain attributes a pointer to the primary entity ** instance is sometimes maintained in the view. These attributes ** are named with the preface "i" followed by the identifier for the ** entity instance within that view. For example, this convention is ** used when accessing aggregates such as to get to the names of ** files in the documents_with_files view. The aggregate can be ** traversed more easily in the code processing the EXPRESS-X than it ** was to write an EXPRESS-X function to do the same thing. It is ** recommended that these abbreviations be expanded as EXPRESS-X ** functions if this mapping becomes more widely used. ** *) SCHEMA_VIEW pdm_enablers_view REFERENCE FROM pdm_schema; (********* The following views support the PDM Enablers ********** PdmProductStructureDefintion module. *********) VIEW parts (* This view supports the PDM Enabler objects: ** PartMaster. *) FROM p: pdm_schema.product; WHERE ( (* when the product is not a document *) SIZEOF (QUERY (c <* EXTENT ('pdm_schema.product_related_product_category') | (c.name = 'document') AND (p IN c.products))) = 0 ); SELECT (* PartMaster attributes *) part_name : string := p.id ; short_description : string := p.name; long_description : string := p.description; END_VIEW; VIEW standard_parts (* This view contains all the standard parts. ** It supports the PDM Enablers object: ** PartMaster.standard_part *) FROM p : pdm_schema.product; pcr : pdm_schema.product_category_relationship; WHERE ( (* Find the product_categories object with ** name = 'standard_part'. *) (pcr.category.name = 'standard_part') OR (pcr.category.name = 'standard') AND (* Find the products through the subtype sub_category *) ('PDM_SCHEMA.PRODUCT_RELATED_PRODUCT_CATEGORY' IN TYPEOF(pcr.sub_category)) AND (p IN pcr.sub_category.products) ); SELECT pid: string := p.id; END_VIEW; VIEW part_categorizations (* This view supports the PDM Enabler objects: ** PartMaster. *) FROM prpc : pdm_schema.product_related_product_category; p : pdm_schema.product; WHERE ( (* when the product is not a document *) (SIZEOF (QUERY (c <* EXTENT ('pdm_schema.product_related_product_category') | (c.name = 'document') AND (p IN c.products))) = 0) AND (* get the categories that it belongs to *) (p IN prpc.products) ); SELECT (* PartMaster attributes - part_type and part_classification *) part_name : string := p.id ; part_type : string := prpc.name ; END_VIEW; VIEW part_revisions (* This view supports the PDM Enabler objects: ** PartRevision, PartData, and PartDataIteration. *) FROM pdf : pdm_schema.product_definition_formation; WHERE ( (* when the product is not a document *) SIZEOF (QUERY (c <* EXTENT ('pdm_schema.product_related_product_category') | (c.name = 'document') AND (pdf.of_product IN c.products))) = 0 ); SELECT (* The following enable you to get at the entity instances in ** Expresso. This is used to test whether the product_definition has ** a specified source. *) iprod : Product := pdf.of_product; ipdf : product_definition_formation := pdf; (* PartMaster attributes *) part_name : string := pdf.of_product.id ; (* Part Revision attributes *) change_level : string := pdf.id; pr_description : string := pdf.description; END_VIEW; VIEW assemblies (* This view supports the PDM Enabler objects ** PartStructure ** NextAssemblyUsageOccurrence ** PromissoryUsageOccurrence ** MakeFromUsage *) FROM pdr : pdm_schema.product_definition_relationship; (* includes Next_assembly_usage_occurrence as subtype *) SELECT ipdr : product_definition_relationship := pdr; name : string := pdr.name; description : string := pdr.description; component_id : string := pdr.related_product_definition.id; component_pid : string := pdr.related_product_definition.formation.of_product.id; assembly_id : string := pdr.id; assembly_pid : string := pdr.relating_product_definition.formation.of_product.id + pdr.relating_product_definition.formation.id ; (* NextAssemblyUsageOccurrence *) (* if pdr is assembly_component_usage then reference_designator = pdr.reference_designator; *) (* Measurement *) (* if pdr is quantified_assembly_component_usage then quantity =... *) END_VIEW; VIEW alternates (* This view supports the PDM Enabler object ** Alternate *) FROM apr : pdm_schema.alternate_product_relationship; SELECT apart: string :=apr.alternate.id; bpart: string :=apr.base.id; name: string :=apr.name; description: string :=apr.definition; basis: string :=apr.basis; END_VIEW; VIEW substitutes (* This view supports the PDM Enabler object ** Substitute *) FROM acus : pdm_schema.assembly_component_usage_substitute; SELECT base_usage: string :=acus.base.id; substitute_usage: string :=acus.substitute.id; name: string :=acus.name; description: string :=acus.definition; END_VIEW; VIEW part_document_relationship (* This view supports the PDM Enabler objects: ** PartDocumentRelationship *) FROM ar: pdm_schema.applied_document_reference; dp: pdm_enablers_view.document_product; WHERE ( dp.idoc = ar.assigned_document ); SELECT (* pvs is the set of document_reference_items which must be filtered ** for product versions *) master_id: string := dp.master_id; rev_id: string := dp.rev_id; pvs: set [1:?] OF document_reference_item := ar.items; (* -- assuming select type is product_definition part_id: set [1:0] OF string := ar.items[*].formation.of_product.id; ver_id: set [1:0] OF string := ar.items[*].formation.id; *) (* missing *) source: label := ar.source; END_VIEW; VIEW applied_assignments (* The applied assignments view is an abstract view supporing the ** PDM Enabler objects ** DesignSupplierRelationships ** PartSupplierRelationships ** ObjectOwner ** ObjectCreator ** ** Sub-views restrict the role.name to create the appropriate PDM ** Enabler object including DesignSupplierRelationship, ** PartSupplierRelationship, ObjectCreator, and ObjectOwner. These ** are defined in AP 203. The PDM Schema does not specify any types ** of roles so this mapping is only valid by analogy AP 203. ** The view only refers to part products and filters out all document ** products. This means ownership information for documents is ** lost. I don't see anywhere to put that in PDME. ** The view has 2 sets of partitions, 1-3, for finding an assigned ** party through a person_and_organization_assignment and, 4-6, for ** traversing organization_assignments. Each of these sets has 3 ** partitions for finding the product version being assigned by ** traversing from the possible types of the select type for the ** attribute items. Not all types of the select are covered. ** EXPRESS functions may be a better way of representing the second ** class of partitioning. ** The person attribute is reflected in the view for convience. It ** would be lost in the PDM Enablers representation of the data. ** *) PARTITION p1 : FROM poassign : pdm_schema.applied_person_and_organization_assignment; p : pdm_schema.product; pdf : pdm_schema.product_definition_formation; WHERE ( (p IN poassign.items) AND (pdf.of_product = p) AND (* when the product is not a document *) (SIZEOF (QUERY (c <* EXTENT ('pdm_schema.product_related_product_category') | (c.name = 'document') AND (p IN c.products))) = 0) ); SELECT part_number : string := p.id + pdf.id; org_id : string := poassign.assigned_person_and_organization.the_organization.id; named_roles : string := poassign.role.name; person : string := poassign.assigned_person_and_organization.the_person.last_name; PARTITION p2 : FROM poassign : pdm_schema.applied_person_and_organization_assignment; pdf : pdm_schema.product_definition_formation; WHERE ( (pdf IN poassign.items) AND (* when the product is not a document *) (SIZEOF (QUERY (c <* EXTENT ('pdm_schema.product_related_product_category') | (c.name = 'document') AND (pdf.of_product IN c.products))) = 0) ); SELECT part_number : string := pdf.of_product.id + pdf.id; org_id : string := poassign.assigned_person_and_organization.the_organization.id; named_roles : string := poassign.role.name; person : string := poassign.assigned_person_and_organization.the_person.last_name; PARTITION p5 : FROM oassign : pdm_schema.applied_organization_assignment; p : pdm_schema.product; pdf : pdm_schema.product_definition_formation; WHERE ( (p IN oassign.items) AND (pdf.of_product = p) AND (* when the product is not a document *) (SIZEOF (QUERY (c <* EXTENT ('pdm_schema.product_related_product_category') | (c.name = 'document') AND (p IN c.products))) = 0) ); SELECT part_number : string := p.id + pdf.id; org_id : string := oassign.assigned_organization.id; named_roles : string := oassign.role.name; person : string := ''; PARTITION p6 : FROM oassign : pdm_schema.applied_organization_assignment; pdf : pdm_schema.product_definition_formation; WHERE ( (pdf IN oassign.items) AND (* when the product is not a document *) (SIZEOF (QUERY (c <* EXTENT ('pdm_schema.product_related_product_category') | (c.name = 'document') AND (pdf.of_product IN c.products))) = 0) ); SELECT part_number : string := pdf.of_product.id + pdf.id; org_id : string := oassign.assigned_organization.id; named_roles : string := oassign.role.name; person : string := ''; END_VIEW; VIEW design_supplier_relationship (* This view supports the PDM Enabler object ** DesignSupplierRelationships *) FROM aa : pdm_enablers_view.applied_assignments; WHERE ( aa.named_roles = 'design_supplier' ); SELECT part_number : string := aa.part_number; org_id : string := aa.org_id; named_roles : string := aa.named_roles; person : string := aa.person; END_VIEW; VIEW part_supplier_relationship (* This view supports the PDM Enabler object ** PartSupplierRelationships *) FROM aa : pdm_enablers_view.applied_assignments; WHERE ( aa.named_roles = 'part_supplier' ); SELECT part_number : string := aa.part_number; org_id : string := aa.org_id; named_roles : string := aa.named_roles; person : string := aa.person; END_VIEW; (********* The following views support a subset of the PDM Enablers ********** PdmFoundation module. *********) VIEW object_owners (* This view supports the PDM Enabler interface ** ObjectOwner *) FROM aa : pdm_enablers_view.applied_assignments; WHERE ( aa.named_roles = 'design_owner' ); SELECT part_number : string := aa.part_number; org_id : string := aa.org_id; named_roles : string := aa.named_roles; person : string := aa.person; END_VIEW; VIEW oc (* object_creators *) (* This view supports the PDM Enabler interface ** ObjectCreator ** revised: June 30, 1999 - The oc view was added to limit the ** object_creator view to only include a single entry for each ** part_number. IDENTIFIED_BY and WHERE clauses can not both appear ** in a VIEW definition. The effect of this view would more correctly ** be achieved by creating a person_organization object. This was an ** oversight in the original mapping. *) FROM aa : pdm_enablers_view.applied_assignments; WHERE ( (aa.named_roles = 'creator') OR (aa.named_roles = 'creation') ); (* IDENTIFIED_BY (aa.part_number); *) SELECT part_number : string := aa.part_number; org_id : string := aa.org_id; named_roles : string := aa.named_roles; person : string := aa.person; END_VIEW; VIEW object_creators FROM aa : pdm_enablers_view.oc; IDENTIFIED_BY (aa.part_number); SELECT part_number : string := aa.part_number; org_id : string := aa.org_id; named_roles : string := aa.named_roles; person : string := aa.person; END_VIEW; VIEW missing_assignments (* This view is informational for indicating which assignments are ** not covered by the design_supplier, part_supplier, design_owner, ** and creator categories. *) FROM aa : pdm_enablers_view.applied_assignments; WHERE ( NOT ( (aa.named_roles = 'design_supplier') OR (aa.named_roles = 'part_supplier') OR (aa.named_roles = 'design_owner') OR (aa.named_roles = 'creator') OR (aa.named_roles = 'creation') ) ); SELECT part_number : string := aa.part_number; org_id : string := aa.org_id; named_roles : string := aa.named_roles; person : string := aa.person; END_VIEW; (********* The following views support a subset of the PDM Enablers ********** PdmResponsibility module. *********) VIEW person_party (* This view supports the PDM Enabler object ** Person *) PARTITION paddr : (** people who have direct addresses **) FROM per : pdm_schema.person; addr : pdm_schema.personal_address; WHERE ( (per IN addr.people) ); SELECT (* given_name : string := per.the_person.first_name + per.the_person.middle_names; -- need a function to properly concat a string with a list *) given_name : string := per.first_name; family_name : string := per.last_name; phone_number : string := addr.telephone_number; street_address : string := addr.street_number + addr.street + addr.postal_box; city : string := addr.town; state : string := addr.region; country : string := addr.country; mail_code : string := addr.postal_code; e_mail : string := addr.electronic_mail_address; id : string := per.id; org_name : string := ''; PARTITION waddr : (** people who have organizational addresses **) FROM pao : pdm_schema.person_and_organization; addr : pdm_schema.address; WHERE ( (* This will create as many person objects as there are ** organizational associations with unique addresses for a given ** person. *) (pao.the_organization IN addr.organizations) ); SELECT (* given_name : string := pao.the_person.first_name + pao.the_person.middle_names; -- need a function to properly concat a string with a list *) given_name : string := pao.the_person.first_name; family_name : string := pao.the_person.last_name; phone_number : string := addr.telephone_number; street_address : string := addr.street_number + addr.street + addr.postal_box; city : string := addr.town; state : string := addr.region; country : string := addr.country; mail_code : string := addr.postal_code; e_mail : string := addr.electronic_mail_address; id : string := pao.the_person.id; org_name : string := pao.the_organization.name; PARTITION woaddr : (** people who do not have addresses ** *** associated with them or their orgs **) FROM pao : pdm_schema.person_and_organization; WHERE ( (* the person doesn't have a personal address *) (SIZEOF (QUERY (a <* EXTENT ('pdm_schema.personal_address') | (pao.the_person IN a.people) )) = 0) AND (* and there's no organizational address associated ** with the person *) (SIZEOF (QUERY (a <* EXTENT('pdm_schema.organizational_address') | (pao.the_organization IN a.organizations))) = 0) ); SELECT (* given_name : string := pao.the_person.first_name + pao.the_person.middle_names; -- need a function to properly concat a string with a list *) given_name : string := pao.the_person.first_name; family_name : string := pao.the_person.last_name; phone_number : string := ''; street_address : string := ''; city : string := ''; state : string := ''; country : string := ''; mail_code : string := ''; e_mail : string := ''; id : string := ''; org_name : string := pao.the_organization.name; END_VIEW; VIEW organization_party (* This view supports the PDM Enabler object ** Organization *) PARTITION waddr : (** organizations that have addresses **) FROM org : pdm_schema.organization; addr : pdm_schema.organizational_address; WHERE (org IN addr.organizations); SELECT name : string := org.name; organization_type : string := org.description; (* is this the right mapping? *) phone_number : string := addr.telephone_number; street_address : string := addr.street_number + addr.street + addr.postal_box; city : string := addr.town; state : string := addr.region; country : string := addr.country; mail_code : string := addr.postal_code; e_mail : string := addr.electronic_mail_address; id : string := org.id; PARTITION woaddr : (** organizations that do not have addresses **) FROM org : pdm_schema.organization; WHERE ( (SIZEOF (QUERY (a <* EXTENT('pdm_schema.organizational_address') | (org IN a.organizations))) = 0 ) ); SELECT name : string := org.name; organization_type : string := org.description; (* is this the right mapping? *) phone_number : string := ''; street_address : string := ''; city : string := ''; state : string := ''; country : string := ''; mail_code : string := ''; e_mail : string := ''; id : string := org.id; END_VIEW; (********* The following views support a subset of the PDM Enablers ********** PdmDocumentManagement module. *********) VIEW document_product (* This view supports the PDM Enabler objects: ** DocumentMaster ** DocumentRevision ** DocumentFile ** This view support the series of interfaces dealing with document ** in that it identifies the product, version, and document ** information associated with a given document. There should be an ** entry for every document_product_equivalence instance. The 3 ** partitions provide the access path to the product and product ** version info from the 3 different types of the select type ** product_or_formation_or_definition. ** The document master is created for the product entity ** participating in the document_product_equivalence (rather than ** the document entity) and uses the product.id identifier for the ** document master. A potential problem is that the document master ** id needs to be unique but the PDMS data does not require ** uniqueness. ** Another potential problem is that if there's no version of the ** product that document_product_equivalence points at the product ** will be missing from this table. *) PARTITION p1 : FROM d : pdm_schema.document_product_association; pd: pdm_schema.product_definition; WHERE ( (pd = d.related_product) ); SELECT ip : product := pd.formation.of_product; ipdf : product_definition_formation := pd.formation; idoc : document := d.relating_document; master_id : string := pd.formation.of_product.id; rev_id : string := pd.formation.id; PARTITION p2 : FROM d : pdm_schema.document_product_equivalence; p: pdm_schema.product; pdf: pdm_schema.product_definition_formation; WHERE ( (p = d.related_product) AND (pdf.of_product = p) ); SELECT ip : product := p; ipdf : product_definition_formation := pdf; idoc : document := d.relating_document; master_id : string := p.id; rev_id : string := pdf.id; PARTITION p3 : FROM d : pdm_schema.document_product_equivalence; pdf: pdm_schema.product_definition_formation; WHERE ( (d.related_product = pdf) ); SELECT ip : product := pdf.of_product; ipdf : product_definition_formation := pdf; idoc : document := d.relating_document; master_id : string := pdf.of_product.id; rev_id : string := pdf.id; END_VIEW; VIEW document_masters (* This view supports the PDM Enabler objects: ** DocumentMaster. ** This view restricts document_product view, which contains all ** revisions, to only the masters. *) FROM d: pdm_enablers_view.document_product; IDENTIFIED_BY (d.master_id); SELECT (* DocumentMaster attributes *) doc_id : string := d.master_id; (* document_name : string := d.idoc.name; *) document_name : string := d.ip.name; (* missing *) description : string := d.idoc.description; kind : string := d.idoc.kind.product_data_type; relating_doc: string := d.idoc.id; END_VIEW; VIEW document_revisions (* This view supports the PDM Enabler objects: ** DocumentRevision. *) FROM d: pdm_enablers_view.document_product; SELECT (* DocumentMaster attributes *) doc_id : string := d.master_id; (* DocumentRevision attributes *) rev_id : string := d.rev_id; description : string := d.idoc.description; (* missing *) (* document_name : string := d.idoc.name; *) document_name : string := d.ip.name; kind : string := d.idoc.kind.product_data_type; END_VIEW; VIEW documents_with_files (* This view supports the PDM Enabler objects: ** DocumentIteration ** DocumentFileRelationship ** This mapping is taken from the memo: ** impact to document as a product ** from Glen Ziolko dated Feb.2 1999 ** which details the impact of the document_as_product concept to ** part 41 . ** One inconsistency between the PDMS data and the PDM Enablers is ** that the PDMS allows for products represented by the ** product_defintion_with_associated_documents that are not ** documents. (For instance in AP203 this entity is used but ** there's no document_as_product concept.) This means that in ** calls to the PDM Enablers there are files not associated with any ** document object which is not entirely consistent with the PDME ** view, although it is not explicitly excluded by the spec. *) FROM d: pdm_enablers_view.document_product; pdwad : pdm_schema.product_definition_with_associated_documents; WHERE ( (d.ipdf = pdwad.formation) ); SELECT (* Name(s) of File(s) containing a document *) doc_id : string := d.master_id; rev_id : string := d.rev_id; iter_id : string := pdwad.id; ipwad : product_definition_with_associated_documents := pdwad; (* files: set of string: pdwad.document_ids [*].id *) END_VIEW; VIEW files (* This view supports the PDM Enabler objects: ** File ** I would use the subtype document_file except that it looks like ** there are some cases where document is used ** instead...specifically for the type 'cad_filename.' *) FROM df: pdm_schema.document; WHERE ( (* The first 2 cases are instances of document_file *) (df.kind.product_data_type = 'digital') OR (df.kind.product_data_type = 'physical') (* The cad_filename type is an instance of document--not ** document_file and is a recommended practice in the AP203 Usage ** Guide **) OR (df.kind.product_data_type = 'cad_filename') ); SELECT filename :string := df.id; type : string := df.kind.product_data_type; END_VIEW; (********* The following views present some data that may have been ********** lost in the mapping. *********) VIEW missing_document_files (* This view is a check to see if any pdwad's got left out in the ** document_files view. *) FROM pdwad: pdm_schema.product_definition_with_associated_documents; WHERE ( (SIZEOF (QUERY (d <* EXTENT('pdm_enablers_view.document_product') | (pdwad.formation = d.ipdf))) = 0 ) ); SELECT (* Name(s) of File(s) containing a document *) pid : string := pdwad.formation.id + pdwad.formation.of_product.id; ipwad : product_definition_with_associated_documents := pdwad; END_VIEW; VIEW missing_files (* This view is a check to see if there's any other document ** objects that should be caught. *) FROM df: pdm_schema.document; WHERE NOT ( (df.kind.product_data_type = 'digital') OR (df.kind.product_data_type = 'physical') OR (df.kind.product_data_type = 'cad_filename') ); SELECT filename :string := df.id; name :string := df.name; type :string := df.kind.product_data_type; END_VIEW; END_SCHEMA_VIEW;