From waterbug at step.nasa.gov Mon Jul 17 01:37:40 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Mon Jul 17 01:37:42 2006 Subject: [pangalactic-commits] Document new architecture concepts. Message-ID: <200607170537.k6H5bd94021503@ned.gsfc.nasa.gov> Modified files: PanGalactic/doc/PgefManual.html 1.28 1.29 PanGalactic/doc/PgefManual.txt 1.36 1.37 Log message: Document new architecture concepts. Index: PanGalactic/doc/PgefManual.html diff -u PanGalactic/doc/PgefManual.html:1.28 PanGalactic/doc/PgefManual.html:1.29 --- PanGalactic/doc/PgefManual.html:1.28 Mon Jan 9 01:42:35 2006 +++ PanGalactic/doc/PgefManual.html Mon Jul 17 01:37:37 2006 @@ -3,9 +3,291 @@ - + The PGEF Manual - +
@@ -19,14 +301,14 @@ Author:Ginny Keech -Version:$Revision: 1.28 $ +Version:$Revision: 1.29 $ -Date:$Date: 2006/01/09 06:42:35 $ +Date:$Date: 2006/07/17 05:37:37 $ -
-

Table of Contents

+ -
-

Foreword

+
+

Foreword

Don't Panic! :)

This document provides information on the current concepts and features of the PanGalactic Engineering Framework (PGEF, a.k.a. PanGalactic). @@ -88,8 +370,8 @@ incomplete. Comments are welcome! (Send them to Stephen Waterbury at the email address shown.)

-
-

Executive Summary

+
+

Executive Summary

The PanGalactic Engineering Framework (PGEF) is being developed to provide an easy-to-use, open-source, open-architecture software toolkit for integrating engineering tools, models, knowledge, and data. Its purpose is to @@ -118,10 +400,10 @@ Numeric and SciPy suites, which provide powerful computational, analytical, and visualization tools.

-
-

Scope and Requirements

-
-

Scope Summary

+
+

Scope and Requirements

+
+

Scope Summary

  • In Scope
    • General
        @@ -214,8 +496,8 @@
-
-

Use Case Sketches

+
+

Use Case Sketches

[TODO: flesh these out, and include the ones in the slides.]

  • Repository and Client (thick or thin)
      @@ -243,10 +525,10 @@
-
-

The PanGalactic Architecture

-
-

Design Intent

+
+

The PanGalactic Architecture

+
+

Design Intent

PanGalactic's principal application target is the manufacturing enterprise, in the broadest possible sense -- i.e., any type of product life cycle support (as the current buzz words go) where a product is any @@ -288,21 +570,31 @@ engines designed for Semantic Web applications, for which OWL is the lingua franca.

-
-

Major Components of PGEF

+
+

Major Components of PGEF

  • PGER -- Repository Services

    [see Repository Services: The PanGalactic Entropy Reverser (PGER), for more detail.]

      -
    • provides a logical interface layer above the object-relational -hyperdatabase (the Chronosynclastic Infundibulum)

      +
    • provides a logical interface layer above two services: DB/KB (The +Chronosynclastic Infundibulum) and versioning system (backend: +Subversion). Features:

      +
      +
        +
      • file and object store
      • +
      • file and object versioning
      • +
      • transactional updates
      • +
      • knowledgebase (objects + free-form statements/facts)
      • +
      • simple and complex searches, queries
      • +
      +
    • contains a Registry in which lives the PanGalactic Core Ontology and any application-specific ontologies

    • -
    • is implemented as a Twisted "MultiService"

      +
    • is implemented as a Twisted "MultiService"

    • drives all external interfaces (XML-RPC, SOAP, etc.)

    • @@ -320,19 +612,28 @@
  • -
  • The Chronosynclastic Infudibulum -- An Object-Relational HyperDatabase

    +
  • The Chronosynclastic Infudibulum -- Object-Relational +HyperDatabase and KnowledgeBase

    +
    +

    [see The Chronosynclastic Infundibulum, for more detail.]

    +

    Unified API layer above two linked services:

    +
      +
    • O-R database: postgresql (later: sqlite?) backend, auto-generated schema

      -

      [see O-R Mapping: The Chronosynclastic Infundibulum, for more -detail.]

        -
      • uses Twisted's adbapi, which provides a non-blocking database API -that returns "deferred" place-holders that are called back with -results when they become available.
      • -
      • generates its database schema from the application ontology. The -default schema is generated from the PanGalactic Core Ontology, -which applications can extend by adding other ontologies and/or -ontological classes).
      • -
      • provides a flexible O-R mapping
      • +
      • handles object requests, simple (e.g., single-join) searches
      • +
      • schema generated from ontology (-ies) and other models
      • +
      +
      +
    • +
    • Knowledgebase: Proximity (MonetDB backend)

      +
      +
        +
      • synced from database; adds free-form knowledge (statements)
      • +
      • handles complex searches, analytical queries
      • +
      +
      +
  • @@ -370,8 +671,8 @@
-
-

Implementation Notes on Some Features

+
+

Implementation Notes on Some Features

  • Unique Object Identifiers

    @@ -483,10 +784,10 @@
-
-

The PanGalactic Ontology

-
-

Domain

+
+

The PanGalactic Ontology

+
+

Domain

One of PanGalactic's principal goals is to collect, integrate, and manage information about products, product models, and documents created and used by the manufacturing enterprise. Consequently, the scope of the @@ -494,8 +795,8 @@ to products, product models, and documents throughout the product life cycle.

-
-

Structure

+
+

Structure

The PanGalactic Ontology is a set of ontological Class definitions encoded in OWL. It spans 2 meta levels and includes some meta-level-agnostic classes -- so it is an OWL-Full ontology [TODO: link for @@ -505,8 +806,8 @@ PanGalactic Core Ontology the PanGalactic Meta Ontology, and the PanGalactic Fu.

-
-

The PanGalactic Core Ontology

+
+

The PanGalactic Core Ontology

The PanGalactic Core Ontology models some core concepts in engineering and science; i.e., they map to engineering and science domain objects:

@@ -515,8 +816,8 @@ domain space.

(source: The Wiki)

-
-

The PanGalactic Meta Ontology

+
+

The PanGalactic Meta Ontology

Some of the Classes in the PanGalactic Ontology are specified to serve in the role of Meta Objects; they are the PanGalactic Meta Objects, and they are subclasses of PanGalacticMetaObject. To avoid circularities, the @@ -525,22 +826,22 @@

For more information on the PanGalactic Meta Ontology, see The PanGalactic Meta Object Registry

-
-

The PanGalactic Fu

+
+

The PanGalactic Fu

The PanGalactic Fu are Classes that represent collections of characteristics that apply to both the PanGalactic Core Ontology and the PanGalactic Meta Ontology. As such, they are meta-agnostic.

-
-

The PanGalactic UberORB

+
+

The PanGalactic UberORB

The PanGalactic UberORB implements PanGalactic's Meta Object Registry, which contains all metadata required by PanGalaxian and PGER about namespaces, interfaces, and attributes of a PanGalactic application.

It also implements the client-side interfaces needed to communicate with any services that PanGalaxian will be talking to, whether local or remote.

-
-

The PanGalactic Meta Object Registry

+
+

The PanGalactic Meta Object Registry

The PanGalactic Meta Object Registry does not conform to the OMG Meta Object Facility (MOF) standard [TODO: MOF link], but it has in common with it the purpose of managing meta objects that are used to define application @@ -597,7 +898,7 @@

  • property_type (default value: datatype) -- values of property_type can be:

    -'datatype' (maps to owl:DatatypeProperty) 
    +'datatype' (maps to owl:DatatypeProperty)
     'object'   (maps to owl:ObjectProperty)
     
  • @@ -638,8 +939,8 @@
    -
    -

    Global State

    +
    +

    Global State

    The global state of a PanGalactic application node (instance) is persisted in the UberORB as a module-level dictionary (pangalactic.node.uberorb.state). For the moment, most of these state @@ -696,16 +997,16 @@

    -
    -

    The Local Object Cache (ZODB)

    +
    +

    The Local Object Cache (ZODB)

    The UberORB wraps the interface to the local object cache (an instance of ObjectCache), which uses ZODB with a FileStorage.

    -
    -

    PanGalactic Domain Objects

    -
    -

    PanGalacticObject and PgefObject

    +
    +

    PanGalactic Domain Objects

    +
    +

    PanGalacticObject and PgefObject

    Metaphorically, the PgefObject class (pangalactic.core.pgefobject.PgefObject) serves as the avatar (body used for incarnation :) of a PanGalactic domain object, and an Interface @@ -746,8 +1047,8 @@ distributed application if that synchronization is done by way of a special protocol.

    -
    -

    Maintaining State for Domain Objects

    +
    +

    Maintaining State for Domain Objects

    Certain attributes of PgefObject are used solely to maintain the local state of a domain object instance, especially for the purpose of reflecting state when they are viewed and edited in PanGalaxianObject. Some of those @@ -773,8 +1074,8 @@

    -
    -

    Versioning of Domain Objects

    +
    +

    Versioning of Domain Objects

    The PanGalactic ontological Class pgef:Versionable is the Class of objects for which versions must be tracked and managed. The most important PanGalactic domain Classes (Part, Model, Document, and @@ -842,8 +1143,8 @@

    -
    -

    Versioning of PanGalactic Meta Objects

    +
    +

    Versioning of PanGalactic Meta Objects

    PanGalactic Meta Objects can be edited, versioned, and managed in the same way as domain objects in PGEF. However, new versions of meta objects are only deployed within the context of a full configuration of the Ontology version @@ -866,15 +1167,28 @@ Foo 1.1 namespace (say, "http://www.foo.org/20051001/").

    -
    -

    Repository Services: The PanGalactic Entropy Reverser (PGER)

    +
    +

    Repository Services: The PanGalactic Entropy Reverser (PGER)

    The PanGalactic Core Ontology provides the basis for the database structures of the The PanGalactic Entropy Reverser (PGER) (also known more prosaically as the PanGalactic Engineering Repository). The layer that translates the domain Classes and Properties of the ontology to the structure of the database is the Chronosynclastic Infundibulum.

    -
    -

    O-R Mapping: The Chronosynclastic Infundibulum

    +
    +

    The Chronosynclastic Infundibulum

    +

    Features:

    +
    +
      +
    • uses Twisted adbapi, which provides a non-blocking database API +that returns "deferred" place-holders that are called back with +results when they become available.
    • +
    • generates its database schema from the application ontology. The +default schema is generated from the PanGalactic Core Ontology, +which applications can extend by adding other ontologies and/or +ontological classes).
    • +
    • provides a flexible O-R mapping
    • +
    +

    The O-R Mapping used by PGER is implemented in the Chronosynclastic Infundibulum (the pangalactic.repo.chronosynclastic module). Chronosynclastic makes extensive use of the PanGalactic Meta Object @@ -959,13 +1273,13 @@

    -
    -

    Notes on the PGER XML-RPC Service Interface

    +
    +

    Notes on the PGER XML-RPC Service Interface

    [Only the search interface is discussed here ... see PgerXmlrpcService API documentation for more info.]

    Syntax:

    -search(schemaid, refs, subtypes, args)
    +search(schemaid, refs, subtypes, args, spec)
     
     ... where:
     
    @@ -985,6 +1299,10 @@
     
                 - for strings, '=' means exact match, and 'like' means
                   case-insensitive match on the value as a substring
    +
    +spec      = specification of attributes to be returned (a list of names of
    +            attributes).  A non-null spec implies that the result should
    +            come back as a data set rather than extracts of objects.
     

    Some examples of valid 'args' lists:

    @@ -1007,7 +1325,7 @@
      ('validated_flag', 'boolean', 0)]
     
         Note:  for boolean searches, the operator must be 'boolean'
    -    (case-insensitive) and the value must be 1 or 0. 
    +    (case-insensitive) and the value must be 1 or 0.
     
     [('parent_oid', 'in',
       ['admin.1086874967.03', 'admin.1086874967.16',
    @@ -1020,20 +1338,20 @@
     
    -
    -

    The PGEF GUI: PanGalaxian

    +
    +

    The PGEF GUI: PanGalaxian

    This section describes the PanGalactic GUI, PanGalaxian. PanGalaxian is a wxPython application, and is designed to be the desktop "control center" for a PanGalactic Node.

    -
    -

    Global State

    +
    +

    Global State

    State in PanGalaxian is persisted in the PanGalactic UberORB -- see that section for more information.

    -
    -

    User Preferences

    +
    +

    User Preferences

    User preferences in PanGalaxian are persisted in the PanGalactic -UberORB as a module-level dictionary, pangalactic.node.uberorb.prefs. +UberORB as a module-level dictionary (pangalactic.node.uberorb.prefs). The contents of the prefs dictionary include:

      @@ -1063,8 +1381,8 @@
    -
    -

    PanGalaxianObject

    +
    +

    PanGalaxianObject

    PanGalaxianObject is the late-bound viewer/editor for PanGalactic Domain Objects (in the PanGalactic Ontology, subclasses of pgef:PanGalacticObject). Each time a PanGalaxianObject instance is @@ -1574,8 +1892,8 @@

    -
    -

    Building a self-extracting executable of PanGalaxian

    +
    +

    Building a self-extracting executable of PanGalaxian

    Build the executable on a Windows W2K machine.

    You must have the following software installed in order to build an executable:

    @@ -1654,8 +1972,8 @@
    -
    -

    Test Driving PanGalaxian

    +
    +

    Test Driving PanGalaxian

    Before you start this simple walk-through, make sure you have removed any client data and the state file (in the pangalactic/node dir, execute rm data/* and rm state.json).

    @@ -1734,7 +2052,7 @@

    [TODO: Reference PanGalactic/pangalactic/node/kb/pgef.owl as the PanGalactic Ontology. ]

    -

    $Id: PgefManual.html,v 1.28 2006/01/09 06:42:35 waterbug Exp $

    +

    $Id: PgefManual.html,v 1.29 2006/07/17 05:37:37 waterbug Exp $

    Index: PanGalactic/doc/PgefManual.txt diff -u PanGalactic/doc/PgefManual.txt:1.36 PanGalactic/doc/PgefManual.txt:1.37 --- PanGalactic/doc/PgefManual.txt:1.36 Thu Jan 12 16:22:14 2006 +++ PanGalactic/doc/PgefManual.txt Mon Jul 17 01:37:38 2006 @@ -7,8 +7,8 @@ :Author: Stephen Waterbury :Author: Ginny Keech -:Version: $Revision: 1.36 $ -:Date: $Date: 2006/01/12 21:22:14 $ +:Version: $Revision: 1.37 $ +:Date: $Date: 2006/07/17 05:37:38 $ .. contents:: Table of Contents @@ -56,7 +56,7 @@ The **PanGalactic** architecture is built upon an eclectic set of open source software, including `Python`_ (a flexible object-oriented language), -`wxPython`_ (a cross-platform GUI toolkit), `Twisted`_ (a Python framework for +`wxPython`_ (a cross-platform GUI toolkit), Twisted_ (a Python framework for asynchronous network protocols), and `PostgreSQL`_ (a robust relational database), among others. @@ -253,15 +253,22 @@ [see `Repository Services: The PanGalactic Entropy Reverser (PGER)`_, for more detail.] - - provides a logical interface layer above the object-relational - hyperdatabase (the `Chronosynclastic Infundibulum`_) + - provides a logical interface layer above two services: DB/KB (`The + Chronosynclastic Infundibulum`_) and versioning system (backend: + `Subversion`_). Features: + + - file and object store + - file and object versioning + - transactional updates + - knowledgebase (objects + free-form statements/facts) + - simple and complex searches, queries - contains a Registry in which lives the `PanGalactic Core Ontology`_ and any application-specific ontologies - - is implemented as a Twisted "MultiService" + - is implemented as a Twisted_ "MultiService" - - drives all external interfaces (XML-RPC, SOAP, etc.) + - drives all external interfaces (XML-RPC, etc.) - PgerXmlrpcService_ -- the PGER_ XML-RPC Service interface @@ -273,21 +280,22 @@ + implements the XML-RPC representation of the PGER_ API -* **The Chronosynclastic Infudibulum** -- **An Object-Relational HyperDatabase** +* **The Chronosynclastic Infudibulum** -- **Object-Relational** + **HyperDatabase and KnowledgeBase** - [see `O-R Mapping: The Chronosynclastic Infundibulum`_, for more - detail.] + [see `The Chronosynclastic Infundibulum`_, for more detail.] - - uses Twisted's adbapi, which provides a non-blocking database API - that returns "deferred" place-holders that are called back with - results when they become available. + Unified API layer above two linked services: - - generates its database schema from the application ontology. The - default schema is generated from the `PanGalactic Core Ontology`_, - which applications can extend by adding other ontologies and/or - ontological classes). + - O-R database: postgresql (later: sqlite?) backend, auto-generated schema - - provides a flexible O-R mapping + - handles object requests, simple (e.g., single-join) searches + - schema generated from ontology (-ies) and other models + + - Knowledgebase: `Proximity`_ (MonetDB backend) + + - synced from database; adds free-form knowledge (statements) + - handles complex searches, analytical queries * **PanGalaxian** -- **The PGEF Node GUI** @@ -879,8 +887,21 @@ is the `Chronosynclastic Infundibulum`_. -O-R Mapping: The `Chronosynclastic Infundibulum`_ -================================================== +The `Chronosynclastic Infundibulum`_ +==================================== + +Features: + + - uses Twisted_ adbapi, which provides a non-blocking database API + that returns "deferred" place-holders that are called back with + results when they become available. + + - generates its database schema from the application ontology. The + default schema is generated from the `PanGalactic Core Ontology`_, + which applications can extend by adding other ontologies and/or + ontological classes). + + - provides a flexible O-R mapping The O-R Mapping used by PGER_ is implemented in the `Chronosynclastic Infundibulum` (the `pangalactic.repo.chronosynclastic` module). @@ -1627,9 +1648,11 @@ .. _PgerXmlrpcService: http://ned.gsfc.nasa.gov/pangalapidoc/pangalactic.repo.pgerxmlrpc.PgerXmlrpcService.html .. _PostgreSQL: http://www.postgresql.org .. _PgefProperty: http://ned.gsfc.nasa.gov/pangalapidoc/pangalactic.meta.pgefproperty.PgefProperty.html +.. _Proximity: http://kdl.cs.umass.edu/proximity/index.html .. _Python: http://python.org .. _ReportLab: http://www.reportlab.org .. _SciPy: http://www.scipy.org +.. _Subversion: http://subversion.tigris.org/ .. _Twisted: http://twistedmatrix.com .. _The Wiki: http://c2.com/cgi/wiki .. _UberORB: `The PanGalactic UberORB`_ @@ -1637,4 +1660,4 @@ .. _Interfaces: http://www.zope.org/Wikis/Interfaces/FrontPage .. _Interface: Interfaces_ -$Id: PgefManual.txt,v 1.36 2006/01/12 21:22:14 waterbug Exp $ +$Id: PgefManual.txt,v 1.37 2006/07/17 05:37:38 waterbug Exp $ From waterbug at step.nasa.gov Mon Jul 17 09:48:26 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Mon Jul 17 09:48:30 2006 Subject: [pangalactic-commits] Minor edits. Message-ID: <200607171348.k6HDmQ9k025059@ned.gsfc.nasa.gov> Modified files: PanGalactic/TODO 1.48 1.49 Log message: Minor edits. Index: PanGalactic/TODO diff -u PanGalactic/TODO:1.48 PanGalactic/TODO:1.49 --- PanGalactic/TODO:1.48 Wed Jun 14 15:25:27 2006 +++ PanGalactic/TODO Mon Jul 17 09:48:24 2006 @@ -14,6 +14,9 @@ [*] define a place where user ontologies/models (in OWL files for now -- later, UML) can be put, so that they can be imported and used along with the PanGalactic ontology to define application objects. +[-] fix some funky things in the pgef ontology: (1) weird artifacts in + 'organization' (name[1-5], street_address[1-2], etc.), (2) look at how SUMO + would fit in (some pgef, some pgef_meta). [-] if a type does not have a default display map in p.n.gui.utils.defaults, then it will use the display map for PanGalacticObject as its default, which is definitely not optimal, and also violates the law of least astonishment. @@ -29,6 +32,7 @@ [-] Express schema import (XML and text) [see: ~/STEP/express/part28_e2/*] [-] Part 21 import [-] implement Open Document Format for docs +[-] use Python "eggs" for plugin architecture --------------------------------------------------- @@ -192,5 +196,5 @@ [+] one-many (aggregate attrs) -------------------------------------------------------------------------- -# $Id: TODO,v 1.48 2006/06/14 19:25:27 waterbug Exp $ +# $Id: TODO,v 1.49 2006/07/17 13:48:24 waterbug Exp $ From waterbug at step.nasa.gov Mon Jul 17 15:27:39 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Mon Jul 17 15:27:42 2006 Subject: [pangalactic-commits] Mostly cosmetic: wrap line in owlport and fix registry report. Message-ID: <200607171927.k6HJRdwL032440@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/meta/registry.py 1.95 1.96 PanGalactic/pangalactic/node/io/owlport.py 1.15 1.16 Log message: Mostly cosmetic: wrap line in owlport and fix registry report. Index: PanGalactic/pangalactic/meta/registry.py diff -u PanGalactic/pangalactic/meta/registry.py:1.95 PanGalactic/pangalactic/meta/registry.py:1.96 --- PanGalactic/pangalactic/meta/registry.py:1.95 Mon Jan 9 19:30:29 2006 +++ PanGalactic/pangalactic/meta/registry.py Mon Jul 17 15:27:36 2006 @@ -1,9 +1,9 @@ -# $Id: registry.py,v 1.95 2006/01/10 00:30:29 waterbug Exp $ +# $Id: registry.py,v 1.96 2006/07/17 19:27:36 waterbug Exp $ """ Pan Galactic Meta Object Registry -@version: $Revision: 1.95 $ +@version: $Revision: 1.96 $ The C{PanGalacticRegistry} maintains an in-memory cache of the PanGalactic core ontology (the C{Interface} instances that are the C{_schema}s of the PanGalactic @@ -12,7 +12,7 @@ L{pangalactic.node.uberorb.URB} to deserialize domain objects in a PanGalactic application. """ -__version__ = "$Revision: 1.95 $"[11:-2] +__version__ = "$Revision: 1.96 $"[11:-2] import imp import os @@ -582,9 +582,9 @@ for name in self.interface_base_order: interface = self.interfaces[name] bases = interface.__bases__ - output += '\nInterface:\n' + output += '\nClass:\n' output += '%s
    \n' % (name) - output += 'Base Interface(s): %s
    \n' % ( + output += 'Base Class(s): %s
    \n' % ( str([getattr(b, '__name__', 'None') for b in bases]) ) Index: PanGalactic/pangalactic/node/io/owlport.py diff -u PanGalactic/pangalactic/node/io/owlport.py:1.15 PanGalactic/pangalactic/node/io/owlport.py:1.16 --- PanGalactic/pangalactic/node/io/owlport.py:1.15 Thu Jan 5 01:03:59 2006 +++ PanGalactic/pangalactic/node/io/owlport.py Mon Jul 17 15:27:37 2006 @@ -1,12 +1,12 @@ -# $Id: owlport.py,v 1.15 2006/01/05 06:03:59 waterbug Exp $ +# $Id: owlport.py,v 1.16 2006/07/17 19:27:37 waterbug Exp $ """ OWL import/export module. Reads and writes OWL graphs. Such graphs are sets of statements (known in RDF as "triples": node-arc-node or subject-predicate-object). -@version: $Revision: 1.15 $ +@version: $Revision: 1.16 $ """ -__version__ = "$Revision: 1.15 $"[11:-2] +__version__ = "$Revision: 1.16 $"[11:-2] # Python modules import base64 @@ -104,7 +104,8 @@ # gDay # gMonth # hexBinary - 'http://www.w3.org/2001/XMLSchema#base64Binary': (base64.decodestring, lambda i:base64.encodestring(i)[:-1]), + 'http://www.w3.org/2001/XMLSchema#base64Binary': (base64.decodestring, + lambda i:base64.encodestring(i)[:-1]), 'http://www.w3.org/2001/XMLSchema#anyURI': ('str', str), } From waterbug at step.nasa.gov Sun Jul 23 14:51:27 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Sun Jul 23 14:51:28 2006 Subject: [pangalactic-commits] Add plugins directory. Message-ID: <200607231851.k6NIpR9N030115@ned.gsfc.nasa.gov> Modified files: PanGalactic/installpger 1.2 1.3 Log message: Add plugins directory. Index: PanGalactic/installpger diff -u PanGalactic/installpger:1.2 PanGalactic/installpger:1.3 --- PanGalactic/installpger:1.2 Thu Dec 15 04:16:23 2005 +++ PanGalactic/installpger Sun Jul 23 14:51:25 2006 @@ -1,5 +1,5 @@ #!/bin/bash -# $Id: installpger,v 1.2 2005/12/15 09:16:23 waterbug Exp $ +# $Id: installpger,v 1.3 2006/07/23 18:51:25 waterbug Exp $ # This script installs some directories and files needed by PGER @@ -35,7 +35,11 @@ echo echo "Setting up PGEFHOME directories/files in $dir ..." cd pangalactic/node -for subdir in bin kb logs ssl vault web +# create local directories +# note: don't need to create 'data' or 'registry' directories here because they +# are created by the cache (ZODB datastore) and the registry, respectively. +# TODO: probably 'pger' should create the 'vault' directory, as needed. +for subdir in bin kb logs plugins ssl vault web do mkdir $dir/${subdir} cp -r ${subdir}/* $dir/${subdir} From waterbug at step.nasa.gov Sun Jul 23 23:38:03 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Sun Jul 23 23:38:05 2006 Subject: [pangalactic-commits] Not a good place for this -- it's just test data! Message-ID: <200607240338.k6O3c3Yo032221@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/node/kb/space_mission.owl 1.1 None Log message: Not a good place for this -- it's just test data! From waterbug at step.nasa.gov Mon Jul 24 00:12:58 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Mon Jul 24 00:12:59 2006 Subject: [pangalactic-commits] Don't need the whole registry report spewed out every time. Message-ID: <200607240412.k6O4Cwfo000379@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/test/test_registry.py 1.15 1.16 Log message: Don't need the whole registry report spewed out every time. Index: PanGalactic/pangalactic/test/test_registry.py diff -u PanGalactic/pangalactic/test/test_registry.py:1.15 PanGalactic/pangalactic/test/test_registry.py:1.16 --- PanGalactic/pangalactic/test/test_registry.py:1.15 Fri Nov 11 03:12:35 2005 +++ PanGalactic/pangalactic/test/test_registry.py Mon Jul 24 00:12:56 2006 @@ -7,7 +7,6 @@ from pangalactic.meta.registry import PanGalacticRegistry r = PanGalacticRegistry() -print r.report() f = open('registry.html', 'w') print >> f, r.reportHtml() f.close() From waterbug at step.nasa.gov Mon Jul 24 00:44:50 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Mon Jul 24 00:44:52 2006 Subject: [pangalactic-commits] Progress toward integrating "application ontologies". Message-ID: <200607240444.k6O4ioCj001038@ned.gsfc.nasa.gov> Modified files: PanGalactic/TODO 1.49 1.50 PanGalactic/installpger 1.3 1.4 PanGalactic/pangalactic/meta/registry.py 1.97 1.98 PanGalactic/pangalactic/node/io/owlport.py 1.16 1.17 Log message: Progress toward integrating "application ontologies". Index: PanGalactic/installpger diff -u PanGalactic/installpger:1.3 PanGalactic/installpger:1.4 --- PanGalactic/installpger:1.3 Sun Jul 23 14:51:25 2006 +++ PanGalactic/installpger Mon Jul 24 00:44:47 2006 @@ -1,5 +1,5 @@ #!/bin/bash -# $Id: installpger,v 1.3 2006/07/23 18:51:25 waterbug Exp $ +# $Id: installpger,v 1.4 2006/07/24 04:44:47 waterbug Exp $ # This script installs some directories and files needed by PGER @@ -42,7 +42,9 @@ for subdir in bin kb logs plugins ssl vault web do mkdir $dir/${subdir} - cp -r ${subdir}/* $dir/${subdir} + if [[ -d $subdir ]]; then + cp -r ${subdir}/* $dir/${subdir} + fi done find $dir -name 'CVS' -exec rm -r {} ';' echo "Done." Index: PanGalactic/pangalactic/meta/registry.py diff -u PanGalactic/pangalactic/meta/registry.py:1.97 PanGalactic/pangalactic/meta/registry.py:1.98 --- PanGalactic/pangalactic/meta/registry.py:1.97 Sun Jul 23 14:27:56 2006 +++ PanGalactic/pangalactic/meta/registry.py Mon Jul 24 00:44:47 2006 @@ -1,9 +1,9 @@ -# $Id: registry.py,v 1.97 2006/07/23 18:27:56 waterbug Exp $ +# $Id: registry.py,v 1.98 2006/07/24 04:44:47 waterbug Exp $ """ Pan Galactic Meta Object Registry -@version: $Revision: 1.97 $ +@version: $Revision: 1.98 $ The C{PanGalacticRegistry} maintains an in-memory cache of the PanGalactic ('pgef') core ontology (the C{Interface} instances that are the C{_schema}s of @@ -12,8 +12,9 @@ L{pangalactic.node.uberorb.URB} to deserialize domain objects in a PanGalactic application. """ -__version__ = "$Revision: 1.97 $"[11:-2] +__version__ = "$Revision: 1.98 $"[11:-2] +import glob import imp import os import re @@ -105,16 +106,30 @@ else: # if not, build 'pgef' interfaces from the OWL files in the node/kb # directory - self.kb = KB() + kbpath = os.path.join(PGEFHOME, 'kb') + self.kb = KB(kbpath) self.interfaces = {} self.properties = {} self.extracts = {} - self.importInterfaces(self.kb, 'pgef') + self.buildInterfaces(self.kb, 'pgef') # add in application-specific ontologies, if any are found in the # plugins/ontologies directory ... - # app_i, app_p, app_e = self.importInterfaces(self.kb, - # 'space_mission') + # TODO: the addition of owl files should be supported by a GUI dialog + # that allows them to be selected, does some simple validation of the + # contents, then adds the ontology to the PGEF runtime (building + # interfaces, adding tables to the repository, etc. ... yeehah! :). + app_kb_dir = os.path.join(PGEFHOME, 'plugins', 'owl') + app_owl_filepaths = glob.glob(os.path.join(app_kb_dir, '*.owl')) + if app_owl_filepaths: + # build app-specific interfaces + print ' -> [registry] aha, found an owl file!' + # TODO: figure out how to get the app ontology name (namespace) -- + # maybe interactively? e.g.: show the namespaces KB finds in the + # OWL or RDF file and let user select the one they want? Hard-code + # it for now ... + app_ontology_name = 'space_mission' + self.addInterfaces(KB(app_kb_dir), app_ontology_name) # self.read_only = list(READ_ONLY) # DELETE -- not used! for p in self.properties: @@ -334,7 +349,7 @@ self.properties = properties self.extracts = extracts - def importInterfaces(self, source, nsprefix, module=None): + def buildInterfaces(self, source, nsprefix, module=None): """ Build a dictionary of C{Interface} instances corresponding to the set of named, schema-like data structures in a specified namespace contained @@ -360,6 +375,10 @@ properties = {} extracts = {} module_name = module or 'pangalactic.meta.names' + # note that base_order is only deterministic to the extent of requiring + # that in the list, a given Interface's bases appear before the + # Interface -- obviously this allows more than one ordering to be valid. + # That's okay for our purposes. base_order = ['Thing', 'Class', 'Property'] cnames = source.getClassNames(nsprefix) # print 'cnames:', cnames @@ -376,7 +395,7 @@ # print ' base cnames:', Set( # source.getBaseNames(nsprefix, cname)) # print ' ... base order unchanged:', base_order - if not Set(cnames).difference(Set(base_order)): + if Set(cnames).issubset(Set(base_order)): break base_order.remove('Thing') base_order.remove('Class') @@ -482,6 +501,52 @@ self.properties.update(properties) self.extracts.update(extracts) + def addInterfaces(self, source, nsprefix, module=None): + """ + Add C{Interface} instances corresponding to the set of named, + schema-like data structures in the application's namespace -- the + application's data structures will be read from the 'plugins' directory + (for now, just from any OWL files found in the 'owl' subdirectory). + + @param source: an object that provides the C{ISchemaSource} interface, + and that contains a collection of schema-like data structures + @type source: doesn't matter, but it must provide the + L{pangalactic.meta.interfaces.ISchemaSource} interface. + + @param nsprefix: the name (a.k.a. "prefix") of a namespace + @type nsprefix: C{str} or C{unicode} + + @param module: a name to be used as the C{__module__} attribute for the + C{Interface} instances that will be created + @type module: C{str} + + @return: a dictionary mapping names to C{Interface} instances + @rtype: C{dict} of L{zope.interface.Interface} instances + """ + base_order = ['Thing', 'Class', 'Property'] + base_order.extend(self.interface_base_order) + cnames = source.getClassNames(nsprefix) + # print 'cnames:', cnames + # print '... finding base_order of cnames ...' + while 1: + for cname in cnames: + # print ' - cname:', cname + if (Set(source.getBaseNames(nsprefix, cname)).issubset( + Set(base_order)) + and cname not in base_order): + base_order.append(cname) + # print ' ... appended.' + # else: + # print ' base cnames:', Set( + # source.getBaseNames(nsprefix, cname)) + # print ' ... base order unchanged:', base_order + if Set(cnames).issubset(Set(base_order)): + break + base_order.remove('Thing') + base_order.remove('Class') + base_order.remove('Property') + print base_order + def registerInterface(self, interface): """ Make an C{Interface} known to the registry. Index: PanGalactic/TODO diff -u PanGalactic/TODO:1.49 PanGalactic/TODO:1.50 --- PanGalactic/TODO:1.49 Mon Jul 17 09:48:24 2006 +++ PanGalactic/TODO Mon Jul 24 00:44:47 2006 @@ -68,6 +68,10 @@ PGEF objects and store them in PGER, along with appropriate DataSet collection objects to identify the source and target data sets. [*] create a test set-up script that populates test data, etc. +[-] re-write tests as real python unit tests, and make sure that the test + environment is self-contained, returns itself to initial state, etc. +[-] more unit tests, integration tests, and stress tests +[-] twisted-style unit tests for services, using 'trial' [-] create a 'demo mode' that creates a sandbox for the user to play in [-] write up and test demo scenario(s), runnable by users [-] p21 file upload / EE map / show assembly @@ -95,10 +99,8 @@ [-] set up regular 'ANALYZE' process for Chronosynclastic [-] admin interface (user management, db ops, etc.) [-] new demo script(s) -[-] twisted-style unit tests for services, using 'trial' [*] searches, gets w/ refd objs (may be different) [-] Pixies for XSL-FO (maybe) -[-] more unit tests, integration tests, and stress tests -------------------------------------------- To Do After Release (in no particular order) @@ -196,5 +198,5 @@ [+] one-many (aggregate attrs) -------------------------------------------------------------------------- -# $Id: TODO,v 1.49 2006/07/17 13:48:24 waterbug Exp $ +# $Id: TODO,v 1.50 2006/07/24 04:44:47 waterbug Exp $ Index: PanGalactic/pangalactic/node/io/owlport.py diff -u PanGalactic/pangalactic/node/io/owlport.py:1.16 PanGalactic/pangalactic/node/io/owlport.py:1.17 --- PanGalactic/pangalactic/node/io/owlport.py:1.16 Mon Jul 17 15:27:37 2006 +++ PanGalactic/pangalactic/node/io/owlport.py Mon Jul 24 00:44:48 2006 @@ -1,12 +1,12 @@ -# $Id: owlport.py,v 1.16 2006/07/17 19:27:37 waterbug Exp $ +# $Id: owlport.py,v 1.17 2006/07/24 04:44:48 waterbug Exp $ """ OWL import/export module. Reads and writes OWL graphs. Such graphs are sets of statements (known in RDF as "triples": node-arc-node or subject-predicate-object). -@version: $Revision: 1.16 $ +@version: $Revision: 1.17 $ """ -__version__ = "$Revision: 1.16 $"[11:-2] +__version__ = "$Revision: 1.17 $"[11:-2] # Python modules import base64 @@ -162,19 +162,22 @@ Property node to the corresponding node. """ - def __init__(self): + def __init__(self, kbpath): """ Create a KB instance. + + @param kbpath: path to a directory containing RDF and/or OWL files. + @type kbpath: C{str} """ TripleStore.__init__(self) # read in RDF files from current knowledgebase (kb) - kbpath = os.path.join( - os.path.split(pangalactic.node.__file__)[0], - 'kb') self.rdfpath = os.path.join(kbpath, '*.rdf') self.owlpath = os.path.join(kbpath, '*.owl') + f = open('test.log', 'w') for filepath in glob.glob(self.rdfpath)+glob.glob(self.owlpath): + f.write('reading kb file: %s\n' % str(filepath)) self.readRdf(filepath) + f.close() def readRdf(self, filepath, name=''): """ @@ -183,11 +186,11 @@ from its Class and Property nodes. @param filepath: path to an RDF/XML file. - @type filepath: str + @type filepath: C{str} @param name: name of the graph (default is the base name of the RDF/XML file) - @type name: str + @type name: C{str} """ graph = TripleStore() if not name: From waterbug at step.nasa.gov Tue Jul 25 01:10:12 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Tue Jul 25 01:10:14 2006 Subject: [pangalactic-commits] Got domain ontologies! Yay! Message-ID: <200607250510.k6P5ACZI018604@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/meta/registry.py 1.98 1.99 Log message: Got domain ontologies! Yay! However, not getting 'bases' for domain Classes or the correct ranges for domain Properties. Eh, details! Index: PanGalactic/pangalactic/meta/registry.py diff -u PanGalactic/pangalactic/meta/registry.py:1.98 PanGalactic/pangalactic/meta/registry.py:1.99 --- PanGalactic/pangalactic/meta/registry.py:1.98 Mon Jul 24 00:44:47 2006 +++ PanGalactic/pangalactic/meta/registry.py Tue Jul 25 01:10:10 2006 @@ -1,9 +1,9 @@ -# $Id: registry.py,v 1.98 2006/07/24 04:44:47 waterbug Exp $ +# $Id: registry.py,v 1.99 2006/07/25 05:10:10 waterbug Exp $ """ Pan Galactic Meta Object Registry -@version: $Revision: 1.98 $ +@version: $Revision: 1.99 $ The C{PanGalacticRegistry} maintains an in-memory cache of the PanGalactic ('pgef') core ontology (the C{Interface} instances that are the C{_schema}s of @@ -12,7 +12,7 @@ L{pangalactic.node.uberorb.URB} to deserialize domain objects in a PanGalactic application. """ -__version__ = "$Revision: 1.98 $"[11:-2] +__version__ = "$Revision: 1.99 $"[11:-2] import glob import imp @@ -40,6 +40,7 @@ from pangalactic.meta.utils import getDefault from pangalactic.node.io.owlport import KB from pangalactic.utils.safe import safe_eval +from pangalactic.utils.pgefexceptions import RequiredDataError PGEFHOME = os.environ.get('PGEFHOME', '') @@ -97,7 +98,11 @@ # add to repository for metaclasses self.allspace = allspace self.allprefix = allprefix - # check whether there is a saved set of interfaces + # Check whether there is a cached set of interfaces: the core 'pgef' + # interfaces will only be rebuilt if the cache (i.e., the 'registry' + # subdirectory) does not exist. Domain interfaces (built from any OWL + # files found in the 'plugins/owl' subdirectory) will be rebuilt whether + # they have been cached or not. (TODO: make this user-selectable.) if os.path.exists(os.path.join(PGEFHOME, 'registry', 'Classes', @@ -124,13 +129,10 @@ if app_owl_filepaths: # build app-specific interfaces print ' -> [registry] aha, found an owl file!' - # TODO: figure out how to get the app ontology name (namespace) -- - # maybe interactively? e.g.: show the namespaces KB finds in the - # OWL or RDF file and let user select the one they want? Hard-code - # it for now ... - app_ontology_name = 'space_mission' - self.addInterfaces(KB(app_kb_dir), app_ontology_name) - + # NOTE: if OWL file(s) are found in 'plugins/owl', the domain + # interfaces will always be rebuilt. (TODO: make this + # user-selectable.) + self.addInterfaces(KB(app_kb_dir)) # self.read_only = list(READ_ONLY) # DELETE -- not used! for p in self.properties: # TODO: READ_ONLY -- the list of Properties that are computed, for @@ -332,16 +334,16 @@ del td['_schema_name'] del td['bases'] interface_attrs[TAGGED_DATA] = td - module_name = module or 'pangalactic.meta.names' # construct the Interface - interfaces[name] = InterfaceClass(name, - __module__=module_name, - bases=interface_bases, - attrs=interface_attrs - ) + interfaces[name] = InterfaceClass( + name, + __module__='pangalactic.meta.names', + bases=interface_bases, + attrs=interface_attrs + ) # try to fudge sys.modules so that PgefObject instances are # picklable - setattr(sys.modules[module_name], name, + setattr(sys.modules['pangalactic.meta.names'], name, interfaces[name]) extracts = dict(interface_extracts) extracts.update(property_extracts) @@ -349,7 +351,7 @@ self.properties = properties self.extracts = extracts - def buildInterfaces(self, source, nsprefix, module=None): + def buildInterfaces(self, source, nsprefix): """ Build a dictionary of C{Interface} instances corresponding to the set of named, schema-like data structures in a specified namespace contained @@ -363,10 +365,6 @@ @param nsprefix: the name (a.k.a. "prefix") of a namespace @type nsprefix: C{str} or C{unicode} - @param module: a name to be used as the C{__module__} attribute for the - C{Interface} instances that will be created - @type module: C{str} - @return: a dictionary mapping names to C{Interface} instances @rtype: C{dict} of L{zope.interface.Interface} instances """ @@ -374,7 +372,6 @@ interfaces = {} properties = {} extracts = {} - module_name = module or 'pangalactic.meta.names' # note that base_order is only deterministic to the extent of requiring # that in the list, a given Interface's bases appear before the # Interface -- obviously this allows more than one ordering to be valid. @@ -397,27 +394,17 @@ # print ' ... base order unchanged:', base_order if Set(cnames).issubset(Set(base_order)): break - base_order.remove('Thing') - base_order.remove('Class') - base_order.remove('Property') + # lose 'Thing', 'Class', and 'Property' + feh = lambda x: x not in ['Thing', 'Class', 'Property'] + base_order = filter(feh, base_order) # print base_order - pnames = source.getPropertyNames(nsprefix) # create registry cache directories if not os.path.exists(os.path.join(PGEFHOME, 'registry')): os.mkdir(os.path.join(PGEFHOME, 'registry'), 0755) - if not os.path.exists(os.path.join(PGEFHOME, - 'registry', - 'Namespaces')): - os.mkdir(os.path.join(PGEFHOME, 'registry', 'Namespaces'), 0755) - if not os.path.exists(os.path.join(PGEFHOME, - 'registry', - 'Classes')): - os.mkdir(os.path.join(PGEFHOME, 'registry', 'Classes'), 0755) - if not os.path.exists(os.path.join(PGEFHOME, - 'registry', - 'Properties')): - os.mkdir(os.path.join(PGEFHOME, 'registry', 'Properties'), 0755) + for subdir in ['Namespaces', 'Classes', 'Properties']: + os.mkdir(os.path.join(PGEFHOME, 'registry', subdir), 0755) + pnames = source.getPropertyNames(nsprefix) for pname in pnames: kw = source.getPropertyAttrs(nsprefix, pname) if kw['domain'] == 'Thing': @@ -429,13 +416,7 @@ extracts[pname] = extr for cname in base_order: # print '- constructing interface for', cname - base_names = source.getBaseNames(nsprefix, cname) - if 'Thing' in base_names: - base_names.remove('Thing') - if 'Class' in base_names: - base_names.remove('Class') - if 'Property' in base_names: - base_names.remove('Property') + base_names = filter(feh, source.getBaseNames(nsprefix, cname)) interface_bases = [interfaces[bn] for bn in base_names] # print ' bases ...', interface_bases interface_props = filter(lambda p: p.domain == cname, @@ -456,20 +437,17 @@ extr['bases'] = base_names extracts[cname] = extr # construct the Interface - interfaces[cname] = InterfaceClass(cname, - __module__=module_name, - bases=interface_bases, - attrs=interface_attrs - ) + interfaces[cname] = InterfaceClass( + cname, + __module__='pangalactic.meta.names', + bases=interface_bases, + attrs=interface_attrs + ) # try to fudge sys.modules so that PgefObject instances are # picklable setattr(sys.modules['pangalactic.meta.names'], cname, interfaces[cname]) - # save Interface and Property extracts; note that if there are any - # reused 'pgef' Interface or Property names in an application ontology, - # the pgef versions will be overridden by them. - # FIXME: There need to be some checks to make sure essential 'pgef' - # Interfaces and Properties are not overridden. + # save 'pgef' Interface and Property extracts for i in interfaces: f = open(os.path.join(PGEFHOME, 'registry', 'Classes', i), 'w') pprint(extracts[i], f) @@ -501,7 +479,7 @@ self.properties.update(properties) self.extracts.update(extracts) - def addInterfaces(self, source, nsprefix, module=None): + def addInterfaces(self, source, domain_prefix=None, module=None): """ Add C{Interface} instances corresponding to the set of named, schema-like data structures in the application's namespace -- the @@ -513,8 +491,9 @@ @type source: doesn't matter, but it must provide the L{pangalactic.meta.interfaces.ISchemaSource} interface. - @param nsprefix: the name (a.k.a. "prefix") of a namespace - @type nsprefix: C{str} or C{unicode} + @param domain_prefix: the short name (a.k.a. "prefix") of the domain + ontology for which interfaces are being added + @type domain_prefix: C{str} or C{unicode} @param module: a name to be used as the C{__module__} attribute for the C{Interface} instances that will be created @@ -523,29 +502,133 @@ @return: a dictionary mapping names to C{Interface} instances @rtype: C{dict} of L{zope.interface.Interface} instances """ + # check whether the pgef ontology has been cached; if not, raise an + # error + if not os.path.exists(os.path.join(PGEFHOME, + 'registry', + 'Classes', + 'PanGalacticObject')): + raise RequiredDataError, 'pgef ontology must be built first.' + # TODO: figure out how to get the app ontology name (namespace) -- + # maybe interactively? e.g.: show the namespaces KB finds in the + # OWL or RDF file and let user select the one they want? Hard-code + # it to use the 'space_mission' test case for now ... + domain_prefix = domain_prefix or 'space_mission' base_order = ['Thing', 'Class', 'Property'] base_order.extend(self.interface_base_order) - cnames = source.getClassNames(nsprefix) + cnames = source.getClassNames(domain_prefix) # print 'cnames:', cnames # print '... finding base_order of cnames ...' while 1: for cname in cnames: # print ' - cname:', cname - if (Set(source.getBaseNames(nsprefix, cname)).issubset( + if (Set(source.getBaseNames(domain_prefix, cname)).issubset( Set(base_order)) and cname not in base_order): base_order.append(cname) # print ' ... appended.' # else: # print ' base cnames:', Set( - # source.getBaseNames(nsprefix, cname)) + # source.getBaseNames(domain_prefix, cname)) # print ' ... base order unchanged:', base_order if Set(cnames).issubset(Set(base_order)): break - base_order.remove('Thing') - base_order.remove('Class') - base_order.remove('Property') + # lose 'Thing', 'Class', and 'Property' + feh = lambda x: x not in ['Thing', 'Class', 'Property'] + base_order = filter(feh, base_order) print base_order + namespaces = {} + interfaces = {} + properties = {} + extracts = {} + pnames = source.getPropertyNames(domain_prefix) + for pname in pnames: + kw = source.getPropertyAttrs(domain_prefix, pname) + if kw['domain'] == 'Thing': + kw['domain'] = 'Identifiable' + p = PgefProperty(**kw) + properties[pname] = p + extr = p.extract() + extr['_schema_name'] = 'PanGalacticProperty' + extracts[pname] = extr + for cname in base_order[len(self.interface_base_order):]: + print '- constructing interface for', cname + base_names = filter(feh, source.getBaseNames(domain_prefix, cname)) + interface_bases = [interfaces[bn] for bn in base_names] + # print ' bases ...', interface_bases + interface_props = filter(lambda p: p.domain == cname, + properties.values()) + # print ' properties:' + # for p in interface_props: + # print ' - %s (%s), range: %s' % (p.id, type(p.id), + # p.range) + # for a in p._schema: + # print ' + %s ... %s (%s)' % (a, getattr(p, a), + # type(getattr(p, a))) + interface_attrs = dict([(p.id, p) for p in interface_props]) + interface_attrs[TAGGED_DATA] = source.getSchemaAttrs(domain_prefix, + cname) + # create an extract of the Interface + extr = dict(interface_attrs[TAGGED_DATA]) + extr['_schema_name'] = 'PanGalacticInterface' + extr['bases'] = base_names + extracts[cname] = extr + # construct the Interface + interfaces[cname] = InterfaceClass( + cname, + __module__='pangalactic.meta.names', + bases=interface_bases, + attrs=interface_attrs + ) + # try to fudge sys.modules so that PgefObject instances are + # picklable + setattr(sys.modules['pangalactic.meta.names'], cname, + interfaces[cname]) + # save Interface and Property extracts; note that if there are any + # reused 'pgef' Interface or Property names in an application ontology, + # the pgef versions will be overridden by them. + # FIXME: There need to be some checks to make sure essential 'pgef' + # Interfaces and Properties are not overridden. + + # *** BEWARE! *** + # everything from here to the end is copied/pasted from buildInterfaces! + # CHECK IT CAREFULLY!! + + # save Interface and Property extracts (even though they are not used + # for anything at the moment, since the domain interfaces are rebuilt + # every time the registry starts up ... it's nice to see the serialized + # extracts there, anyway :). + for i in interfaces: + f = open(os.path.join(PGEFHOME, 'registry', 'Classes', i), 'w') + pprint(extracts[i], f) + f.close() + for p in properties: + f = open(os.path.join(PGEFHOME, 'registry', 'Properties', p), 'w') + pprint(extracts[p], f) + f.close() + # save namespaces as extracts of PanGalacticNamespace objects + for n, ns in allspace.items(): + complete = False + # ignore local namespace + if n: + if n == domain_prefix: + complete = True + pgns = PgefObject( + _schema=self.interfaces['PanGalacticNamespace'], + id=str(ns.id), uri=str(ns.uri), + names=[str(nom) for nom in ns.names], + complete=complete) + nsextr = pgns.extract() + f = open(os.path.join(PGEFHOME, + 'registry', + 'Namespaces', + str(n)), + 'w') + pprint(nsextr, f) + f.close() + self.interfaces.update(interfaces) + self.properties.update(properties) + self.extracts.update(extracts) def registerInterface(self, interface): """ From waterbug at step.nasa.gov Wed Jul 26 00:23:58 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Wed Jul 26 00:24:00 2006 Subject: [pangalactic-commits] Valid OWL test data file. Message-ID: <200607260423.k6Q4Nw72001279@ned.gsfc.nasa.gov> Modified files: PanGalactic/sandbox/onto/space_mission.owl None 1.1 Log message: Valid OWL test data file. From waterbug at step.nasa.gov Wed Jul 26 02:34:13 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Wed Jul 26 02:34:14 2006 Subject: [pangalactic-commits] PanGalaxian can create Spacecraft and Instrument ... Message-ID: <200607260634.k6Q6YDiN001594@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/meta/registry.py 1.99 1.100 PanGalactic/pangalactic/meta/utils.py 1.16 1.17 Log message: PanGalaxian can create Spacecraft and Instrument ... however, PanGalaxianObject doesn't display them correctly. This will require some work on handling of Properties (mass is a 'float' -- which is foreign to most of PanGalactic's property-handling code right now). Need to make property support more flexible / extensible. Index: PanGalactic/pangalactic/meta/registry.py diff -u PanGalactic/pangalactic/meta/registry.py:1.99 PanGalactic/pangalactic/meta/registry.py:1.100 --- PanGalactic/pangalactic/meta/registry.py:1.99 Tue Jul 25 01:10:10 2006 +++ PanGalactic/pangalactic/meta/registry.py Wed Jul 26 02:34:11 2006 @@ -1,9 +1,9 @@ -# $Id: registry.py,v 1.99 2006/07/25 05:10:10 waterbug Exp $ +# $Id: registry.py,v 1.100 2006/07/26 06:34:11 waterbug Exp $ """ Pan Galactic Meta Object Registry -@version: $Revision: 1.99 $ +@version: $Revision: 1.100 $ The C{PanGalacticRegistry} maintains an in-memory cache of the PanGalactic ('pgef') core ontology (the C{Interface} instances that are the C{_schema}s of @@ -12,7 +12,7 @@ L{pangalactic.node.uberorb.URB} to deserialize domain objects in a PanGalactic application. """ -__version__ = "$Revision: 1.99 $"[11:-2] +__version__ = "$Revision: 1.100 $"[11:-2] import glob import imp @@ -128,7 +128,7 @@ app_owl_filepaths = glob.glob(os.path.join(app_kb_dir, '*.owl')) if app_owl_filepaths: # build app-specific interfaces - print ' -> [registry] aha, found an owl file!' + # print ' -> [registry] aha, found an owl file!' # NOTE: if OWL file(s) are found in 'plugins/owl', the domain # interfaces will always be rebuilt. (TODO: make this # user-selectable.) @@ -518,7 +518,7 @@ base_order.extend(self.interface_base_order) cnames = source.getClassNames(domain_prefix) # print 'cnames:', cnames - # print '... finding base_order of cnames ...' + # print '... finding base_order of <%s> cnames ...' % domain_prefix while 1: for cname in cnames: # print ' - cname:', cname @@ -536,7 +536,7 @@ # lose 'Thing', 'Class', and 'Property' feh = lambda x: x not in ['Thing', 'Class', 'Property'] base_order = filter(feh, base_order) - print base_order + # print base_order namespaces = {} interfaces = {} properties = {} @@ -552,9 +552,10 @@ extr['_schema_name'] = 'PanGalacticProperty' extracts[pname] = extr for cname in base_order[len(self.interface_base_order):]: - print '- constructing interface for', cname + # print '- constructing interface for', cname base_names = filter(feh, source.getBaseNames(domain_prefix, cname)) - interface_bases = [interfaces[bn] for bn in base_names] + print 'base_names:', base_names + interface_bases = [self.interfaces[bn] for bn in base_names] # print ' bases ...', interface_bases interface_props = filter(lambda p: p.domain == cname, properties.values()) @@ -563,8 +564,8 @@ # print ' - %s (%s), range: %s' % (p.id, type(p.id), # p.range) # for a in p._schema: - # print ' + %s ... %s (%s)' % (a, getattr(p, a), - # type(getattr(p, a))) + # print ' + %s ... %s (%s)' % (a, getattr(p, a), + # type(getattr(p, a))) interface_attrs = dict([(p.id, p) for p in interface_props]) interface_attrs[TAGGED_DATA] = source.getSchemaAttrs(domain_prefix, cname) Index: PanGalactic/pangalactic/meta/utils.py diff -u PanGalactic/pangalactic/meta/utils.py:1.16 PanGalactic/pangalactic/meta/utils.py:1.17 --- PanGalactic/pangalactic/meta/utils.py:1.16 Mon Dec 5 16:39:49 2005 +++ PanGalactic/pangalactic/meta/utils.py Wed Jul 26 02:34:11 2006 @@ -2,7 +2,7 @@ PGEF meta utilities """ -# $Id: utils.py,v 1.16 2005/12/05 21:39:49 waterbug Exp $ +# $Id: utils.py,v 1.17 2006/07/26 06:34:11 waterbug Exp $ def getDefault(prop): @@ -13,6 +13,7 @@ values must be stored 'encoded' in one particular datatype (strings are used), so they will have to be cast to the correct datatype. """ + # TODO: man, this *really* needs to be completely redesigned!! if type(prop) is dict: if prop.get('functional', True): if prop['range'] == 'str': @@ -22,6 +23,11 @@ retval = int(prop['default']) else: retval = 0 + elif prop['range'] == 'float': + if prop.get('default'): + retval = float(prop['default']) + else: + retval = 0.0 elif prop['range'] == 'bool': retval = bool(prop.get('default', '')) elif prop['range'] == 'datetime': @@ -35,7 +41,7 @@ e = 'Unknown range: %s' % prop['range'] raise ValueError, e else: - if (prop['range'] not in ['str', 'int', 'bool', 'datetime'] + if (prop['range'] not in ['str', 'int', 'float', 'bool', 'datetime'] and prop.get('property_type', 'datatype') != 'object'): msg = 'Unknown range: %s' % prop['range'] raise ValueError, msg @@ -51,6 +57,11 @@ retval = int(prop.__dict__['default']) else: retval = 0 + elif prop.range == 'float': + if prop.__dict__.get('default'): + retval = float(prop.__dict__['default']) + else: + retval = 0.0 elif prop.range == 'bool': if prop.__dict__.get('default'): if prop.__dict__['default'] in ['False', 'false', '0']: @@ -68,7 +79,7 @@ else: raise ValueError, 'Unknown Property range' else: - if (prop.range not in ['str', 'int', 'bool', 'datetime'] + if (prop.range not in ['str', 'int', 'float', 'bool', 'datetime'] and prop.__dict__.get('property_type', 'datatype') != 'object'): raise ValueError, 'Unknown Property range' else: From waterbug at step.nasa.gov Thu Jul 27 09:58:34 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Thu Jul 27 09:58:36 2006 Subject: [pangalactic-commits] Some mods to pgxnobject for testing purposes. Message-ID: <200607271358.k6RDwYE0018825@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py 1.87 1.88 Log message: Some mods to pgxnobject for testing purposes. Index: PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py diff -u PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py:1.87 PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py:1.88 --- PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py:1.87 Mon Jan 30 02:47:23 2006 +++ PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py Thu Jul 27 09:58:32 2006 @@ -1,10 +1,10 @@ -# $Id: pgxnobject.py,v 1.87 2006/01/30 07:47:23 waterbug Exp $ +# $Id: pgxnobject.py,v 1.88 2006/07/27 13:58:32 waterbug Exp $ """ PanGalaxianObject (a C{PgefObject} viewer/editor) -@version: $Revision: 1.87 $ +@version: $Revision: 1.88 $ """ -__version__ = "$Revision: 1.87 $"[11:-2] +__version__ = "$Revision: 1.88 $"[11:-2] from pprint import pprint @@ -284,8 +284,8 @@ _icon.CopyFromBitmap(toolkitimages.getPanGalacticon16Bitmap()) self.SetIcon(_icon) self.groups = display_maps[self.obj._schema.__name__]['groups'] - # print ' - groups are:' - # pprint(self.groups) + print ' - groups are:' + pprint(self.groups) self.notebook = PgxnPropertybook(self) self.initPropertybook() vbox = wx.BoxSizer(wx.VERTICAL) @@ -689,7 +689,7 @@ if __name__ == '__main__': - p = PgefObject(_schema=URB.interfaces['PanGalacticObject']) + p = PgefObject(_schema=URB.interfaces['Spacecraft']) # id='Test-1') app = wx.App() frame = PanGalaxianObject(parent=None, obj=p) From waterbug at step.nasa.gov Thu Jul 27 15:43:26 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Thu Jul 27 15:43:27 2006 Subject: [pangalactic-commits] Add Product, Process, and Activity to the pgef ontology. Message-ID: <200607271943.k6RJhQxn026087@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/node/kb/pgef.owl 1.25 1.26 Log message: Add Product, Process, and Activity to the pgef ontology. Index: PanGalactic/pangalactic/node/kb/pgef.owl diff -u PanGalactic/pangalactic/node/kb/pgef.owl:1.25 PanGalactic/pangalactic/node/kb/pgef.owl:1.26 --- PanGalactic/pangalactic/node/kb/pgef.owl:1.25 Thu Jun 15 11:55:41 2006 +++ PanGalactic/pangalactic/node/kb/pgef.owl Thu Jul 27 15:43:24 2006 @@ -4,9 +4,8 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" - xmlns="http://pangalactic.us/pgef/" xml:base="http://pangalactic.us/pgef/"> - + @@ -17,10 +16,10 @@ An activity that has the purpose of producing and/or maintaining something, and which involves contributions from Persons and Organizations. - + - + @@ -34,11 +33,11 @@ >A Relationship that assigns a Role (the "parent") to an Actor (the "child"). - A Relationship between a PanGalacticObject and a Document. + A Relationship between a PanGalacticObject and a Document. Able to have access to it restricted to a specifiable set of individuals. - + The mother of all specific PanGalactic Fu (aspects and behaviors). Note that PanGalactic Fu are meta-level agnostic. To PanGalactic Fu, all is Fu. - + >The output of a process or activity. + + + @@ -89,28 +90,24 @@ A PhysicalObject that is purported to be a physical realization of a Part. - - - - + The common ancestor of all Versionable descendents of PanGalacticObject. - - - + >The mother of all specific PanGalactic Fu (aspects and behaviors). Note that PanGalactic Fu are meta-level agnostic. To PanGalactic Fu, all is Fu. + - + - + An entity that is a collection of measurable stuff. + >A configuration-manageable structure composed of one or more linked Activity definitions, which is applied systematically to realise a business objective or policy goal, normally within the context of an organisational structure defining functional roles and relationships. [Based on the WfMC definition of "Business Process"] Synonyms: Business Process, Process Definition. - + + Multi-purpose Internet Mail Extension (MIME) types. + >The common ancestor of all Versionable descendents of PanGalacticObject. - + @@ -126,6 +123,20 @@ pgef:Part maps to the combination of STEP (ISO 10303) 'product' and 'product_definition_formation'. STEP 'frame_of_reference' (-> product_context.id) is not represented within the PGEF ontology. STEP 'description' maps to description. + + + + + An entity that is a collection of measurable stuff. + + + Multi-purpose Internet Mail Extension (MIME) types. + + + + - The name (type) of a Relationship that can be assigned to an Actor within a context. The context will typically be an Organization or a Project. A Role will typically have an associated set of privileges. + The name (type) of a Relationship that can be assigned to an Actor within a context. The context will typically be an Organization or a Project. A Role will typically have an associated set of privileges. @@ -178,6 +189,12 @@ + + + A Relationship between a Role with an Organization context and a Person. + + @@ -185,23 +202,17 @@ A well-defined and identifiable connection between PanGalacticObjects. - - - A Relationship between a Role with an Organization context and a Person. - - The class of file-like PanGalacticObjects. - - - + + + @@ -229,12 +240,12 @@ Quantified Assembly Component Usage represents some number of instances or some measured quantity of a PanGalacticObject used in the assembly of another PanGalacticObject. - - A documented collection of parts and related information. Parts Lists occur in various contexts in the product life cycle, e.g.: to document component technology research, to document candidate parts for assemblies, to document Parts used in Model development, to track Parts procurement information, to document Part stocks and inventory, etc. + - + + A piece of work with an input, an output, resources, and controls, that forms one logical unit. An activity's definition may or may not be configuration managed. If its definition is under configuration management, its definition is contained in a Process (which see). An activity may be a manual activity, which does not involve computer automation, or a workflow (automated) activity. A workflow activity requires human and/or machine resources(s) to support process execution; where human resource is required an activity is allocated to a workflow participant. [Based on WfMC definition] Synonyms: step, node, task, work element, process element, operation, instruction. @@ -243,6 +254,13 @@ A PartsListItem is a Document that is a component of a PartsList, and represents a single line or item on its parent PartsList. The PartsListItem references an Acu (a usage of one or more PanGalacticObject instances in the assembly of another PanGalacticObject). + + A documented collection of parts and related information. Parts Lists occur in various contexts in the product life cycle, e.g.: to document component technology research, to document candidate parts for assemblies, to document Parts used in Model development, to track Parts procurement information, to document Part stocks and inventory, etc. + + + + An identifier for a PartsListItem within the context of its PartsList. - + @@ -449,13 +467,6 @@ The third of a possible 5 segments of an Organization's name. (From the CAGE data structure.) - - - The purpose or meaning of this Representation -- e.g. "publication", "presentation", "exchange", etc. The semantics of this Property are heavily context-dependent. - - - @@ -463,6 +474,13 @@ A Person's last name (surname). + + + The purpose or meaning of this Representation -- e.g. "publication", "presentation", "exchange", etc. The semantics of this Property are heavily context-dependent. + + + A Person's first name (given name). @@ -514,9 +532,16 @@ + The CAGE type code. (From the CAGE data structure.) + + + + + The identifier for a screening specification that applies to a Part. @@ -527,13 +552,6 @@ pgef:frame_of_reference maps directly to STEP "product_definition.frame_of_reference.application". In STEP, f_o_r points to an application_context, which refers to the general application domain that defined the data ... the values recommended in the STEP PDM Schema Usage Guide are: "digital mock up" "assembly study" "process planning" "electrical design" "mechanical design", but a set of values meaningful within the context of a specific Project or Organization should be defined for this attribute to be useful. - - - - - The identifier for a screening specification that applies to a Part. - The number of instances or measured quantity of the component object(s) used. - + The state of a PartsList relative to some possibly extensible set of standard states, e.g. 'in-process', 'reviewed', etc. The set of standard states should be agreed upon by the Project(s) or Organization(s) using the PartsList. @@ -573,8 +591,8 @@ The Federal Supply Classification code for a Part (this is also the first four digits of the NSN). - + @@ -591,9 +609,9 @@ + An identifier assigned by a manufacturer to a specific PhysicalPart. - @@ -628,9 +646,9 @@ + An integer code: 1=U.S., 2=Foreign, 3=Canada (From the CAGE data structure.) - A narrative about the characteristics and identifying features of an object. - + The name of the attribute within the context of which the Sequence attribute is meaningful. If the value of the Sequence Context attribute is 'role', and the value of Role is 'attachment', then Sequence is the position of this file within the set of files that have a Role of 'attachment'. @@ -657,8 +675,8 @@ A Person's middle initial or name. - + - The URI of the namespace to which an object's name belongs. + @@ -703,19 +721,12 @@ + The size of a file in bytes. - - - The Identifiable entity that owns an object. - - - - @@ -727,15 +738,15 @@ The Identifiable entity that owns an object. - + - - + The identifier for a Part's 'Model', a somewhat arbitrary identifier usually specified by the manufacturer. + @@ -781,9 +792,9 @@ + A capsule summary of the Document's content. - @@ -825,8 +836,8 @@ The version of the software application that was used to produce a DataSet. - + @@ -859,8 +870,8 @@ The manufacturer's identifier for a Part. - + @@ -900,10 +911,10 @@ + The MIME type of the value of the 'content' attribute. (This does not imply that a Document has an intrinsic MIME type. In general, each representation of the Document will have a MIME type, and they may all be different.) - @@ -915,9 +926,9 @@ + The second of a possible 2 segments of an Organization's Street Address. (From the CAGE data structure.) - @@ -1008,8 +1019,8 @@ - + Date (and time, if relevant) a Document was published. From waterbug at step.nasa.gov Fri Jul 28 09:33:10 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Fri Jul 28 09:33:12 2006 Subject: [pangalactic-commits] Begin modifying display map implementation ... Message-ID: <200607281333.k6SDXA5x032558@ned.gsfc.nasa.gov> Modified files: PanGalactic/TODO 1.50 1.51 PanGalactic/pangalactic/node/gui/utils/defaults.py 1.4 1.5 PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py 1.88 1.89 PanGalactic/pangalactic/node/kb/pgef.owl 1.26 1.27 Log message: Begin modifying display map implementation ... also, added "Accessible PanGalactic" items to TODO list, and some minor tweaking of pgef.owl. Index: PanGalactic/TODO diff -u PanGalactic/TODO:1.50 PanGalactic/TODO:1.51 --- PanGalactic/TODO:1.50 Mon Jul 24 00:44:47 2006 +++ PanGalactic/TODO Fri Jul 28 09:33:06 2006 @@ -38,6 +38,34 @@ --------------------------------------------------- To Do Before Release (in rough order of precedence) --------------------------------------------------- +[-] Create "Accessible PanGalactic" (web site, installer[s], docs) + [*] PanGalactic home page that says what PanGalactic is, lists some + features, and points to a page with more info. There is a reasonable + number of relevant links, all clearly laid out on a page that is not too + busy. Words on the front page invite them to download and try the + software. + [-] the download link goes to a friendly page that offers a binary install + package for the current version of the software for their machine (and + others, but they don't care about that). It also offers instructions + for installing the package on their platform. For platforms like Red + Hat and Debian Linux, the instructions say what lines to add to yum.conf + or its Debian equivalent, though the option to download the binary + package directly also exists. The instructions end with: + * digital signature explanation (how to check validity of the package) + * how to configure (if necessary, hopefully not), + * how to test the install, + * where to go for help if the install failed, + * a pointer to a "Getting Started With PanGalactic" document. + They follow the instructions and it installs fine. + [*] They read the "Getting Started" document, which is about 20 pages + and contains: + a. A brief (1/2 page) description of SciPy's key characteristics + from a new user's point of view + b. A get-your-feet-wet tutorial + c. The basic (non-programming) Python syntax + d. A statement on the current state of the software + e. Sources of further information and support, both in the + downloaded package and on the web. [*] PanGalaxianObject (late-bound viewer/editor) [*] provide field display/order customization (similar to PgefObjectGrid, but separate) -- including GUI dialogs to define new tabs, which @@ -198,5 +226,5 @@ [+] one-many (aggregate attrs) -------------------------------------------------------------------------- -# $Id: TODO,v 1.50 2006/07/24 04:44:47 waterbug Exp $ +# $Id: TODO,v 1.51 2006/07/28 13:33:06 waterbug Exp $ Index: PanGalactic/pangalactic/node/gui/utils/defaults.py diff -u PanGalactic/pangalactic/node/gui/utils/defaults.py:1.4 PanGalactic/pangalactic/node/gui/utils/defaults.py:1.5 --- PanGalactic/pangalactic/node/gui/utils/defaults.py:1.4 Fri Dec 23 11:52:43 2005 +++ PanGalactic/pangalactic/node/gui/utils/defaults.py Fri Jul 28 09:33:07 2006 @@ -1,8 +1,8 @@ -# $Id: defaults.py,v 1.4 2005/12/23 16:52:43 waterbug Exp $ +# $Id: defaults.py,v 1.5 2006/07/28 13:33:07 waterbug Exp $ """ Pan Galactic default GUI characteristics """ -__version__ = "$Revision: 1.4 $"[11:-2] +__version__ = "$Revision: 1.5 $"[11:-2] # special attributes of Versionable, not editable directly VERSION_CONTROLS = ['base_id', @@ -12,6 +12,19 @@ 'is_head'] # default display characteristics of PanGalactic Interfaces and Attributes +DEFAULT_ADMIN_PROPS = ['oid', + 'security_mask', + 'record_owner', + 'record_creator', + 'record_create_datetime', + 'record_modifier', + 'record_mod_datetime', + 'owner', + 'creator', + 'create_datetime', + 'modifier', + 'mod_datetime'] + DISPLAY_MAPS = { 'Actor': { 'columns': ['id', Index: PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py diff -u PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py:1.88 PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py:1.89 --- PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py:1.88 Thu Jul 27 09:58:32 2006 +++ PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py Fri Jul 28 09:33:07 2006 @@ -1,10 +1,10 @@ -# $Id: pgxnobject.py,v 1.88 2006/07/27 13:58:32 waterbug Exp $ +# $Id: pgxnobject.py,v 1.89 2006/07/28 13:33:07 waterbug Exp $ """ PanGalaxianObject (a C{PgefObject} viewer/editor) -@version: $Revision: 1.88 $ +@version: $Revision: 1.89 $ """ -__version__ = "$Revision: 1.88 $"[11:-2] +__version__ = "$Revision: 1.89 $"[11:-2] from pprint import pprint @@ -689,7 +689,7 @@ if __name__ == '__main__': - p = PgefObject(_schema=URB.interfaces['Spacecraft']) + p = PgefObject(_schema=URB.interfaces['Part']) # id='Test-1') app = wx.App() frame = PanGalaxianObject(parent=None, obj=p) Index: PanGalactic/pangalactic/node/kb/pgef.owl diff -u PanGalactic/pangalactic/node/kb/pgef.owl:1.26 PanGalactic/pangalactic/node/kb/pgef.owl:1.27 --- PanGalactic/pangalactic/node/kb/pgef.owl:1.26 Thu Jul 27 15:43:24 2006 +++ PanGalactic/pangalactic/node/kb/pgef.owl Fri Jul 28 09:33:08 2006 @@ -2,10 +2,11 @@ - + From waterbug at step.nasa.gov Fri Jul 28 14:40:34 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Fri Jul 28 14:40:36 2006 Subject: [pangalactic-commits] This shouldn't be in CVS -- it's generated from PgefManual.txt. Message-ID: <200607281840.k6SIeYCo004123@ned.gsfc.nasa.gov> Modified files: PanGalactic/doc/PgefManual.html 1.29 None Log message: This shouldn't be in CVS -- it's generated from PgefManual.txt. From waterbug at step.nasa.gov Fri Jul 28 14:46:09 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Fri Jul 28 14:46:10 2006 Subject: [pangalactic-commits] Instructions for docs. Message-ID: <200607281846.k6SIk9mS004228@ned.gsfc.nasa.gov> Modified files: PanGalactic/doc/README 1.5 1.6 Log message: Instructions for docs. Index: PanGalactic/doc/README diff -u /dev/null PanGalactic/doc/README:1.6 --- /dev/null Fri Jul 28 14:46:09 2006 +++ PanGalactic/doc/README Fri Jul 28 14:46:07 2006 @@ -0,0 +1,8 @@ +PgefManual.txt is formatted in reStructured Text. + +Use docutils scripts to create other formats -- e.g., use 'rst2html' to create +PgefManual.html. + +Docutils is here: +http://docutils.sourceforge.net/ + From waterbug at step.nasa.gov Fri Jul 28 15:29:54 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Fri Jul 28 15:29:56 2006 Subject: [pangalactic-commits] Rename p.n.g.u.defaults to display_maps ... Message-ID: <200607281929.k6SJTsAw004818@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/node/gui/utils/display_maps.py None 1.1 PanGalactic/pangalactic/node/gui/utils/defaults.py 1.5 None Log message: Rename p.n.g.u.defaults to display_maps ... which is all it's about anyway, and it needed some serious work! Eventually there will be a dialog in which display map prefs can be set by the user, and later on an admin interface for managing the default settings for an app or domain. From waterbug at step.nasa.gov Fri Jul 28 15:35:00 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Fri Jul 28 15:35:01 2006 Subject: [pangalactic-commits] Change references to p.n.g.u.defaults to display_maps. Message-ID: <200607281935.k6SJZ0ED004842@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/node/uberorb.py 1.67 1.68 PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py 1.17 1.18 Log message: Change references to p.n.g.u.defaults to display_maps. Index: PanGalactic/pangalactic/node/uberorb.py diff -u PanGalactic/pangalactic/node/uberorb.py:1.67 PanGalactic/pangalactic/node/uberorb.py:1.68 --- PanGalactic/pangalactic/node/uberorb.py:1.67 Sun Jan 29 07:23:14 2006 +++ PanGalactic/pangalactic/node/uberorb.py Fri Jul 28 15:34:58 2006 @@ -1,11 +1,11 @@ -# $Id: uberorb.py,v 1.67 2006/01/29 12:23:14 waterbug Exp $ +# $Id: uberorb.py,v 1.68 2006/07/28 19:34:58 waterbug Exp $ # -*- test-case-name: pangalactic.test.test_uberorb -*- """ A PanGalaxian node's UberORB -@version: $Revision: 1.67 $ +@version: $Revision: 1.68 $ """ -__version__ = "$Revision: 1.67 $"[11:-2] +__version__ = "$Revision: 1.68 $"[11:-2] import codecs import mimetypes @@ -22,18 +22,18 @@ from zope.interface import implements # PanGalactic imports -from pangalactic.core.pgefobject import PgefObject -from pangalactic.meta.defaults import READ_ONLY_NS -from pangalactic.meta.registry import PanGalacticRegistry -from pangalactic.meta.interfaces import IMofFactory -from pangalactic.node.gui.utils.defaults import DISPLAY_MAPS -from pangalactic.node.gui.utils.defaults import VERSION_CONTROLS -from pangalactic.node.objectcache import ObjectCache -from pangalactic.utils.httpupload import upload -from pangalactic.utils.pgefexceptions import LocalStorageError -from pangalactic.utils.safe import safe_eval -from pangalactic.utils.toolbox import isAString -from pangalactic.utils.xmlrpcinterface import XmlrpcInterface +from pangalactic.core.pgefobject import PgefObject +from pangalactic.meta.defaults import READ_ONLY_NS +from pangalactic.meta.registry import PanGalacticRegistry +from pangalactic.meta.interfaces import IMofFactory +from pangalactic.node.gui.utils.display_maps import DISPLAY_MAPS +from pangalactic.node.gui.utils.display_maps import VERSION_CONTROLS +from pangalactic.node.objectcache import ObjectCache +from pangalactic.utils.httpupload import upload +from pangalactic.utils.pgefexceptions import LocalStorageError +from pangalactic.utils.safe import safe_eval +from pangalactic.utils.toolbox import isAString +from pangalactic.utils.xmlrpcinterface import XmlrpcInterface class _UberORB(PanGalacticRegistry): # do not import me! Index: PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py diff -u PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py:1.17 PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py:1.18 --- PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py:1.17 Tue Jan 10 21:52:34 2006 +++ PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py Fri Jul 28 15:34:58 2006 @@ -1,10 +1,10 @@ -# $Id: pgxnobjectgrid.py,v 1.17 2006/01/11 02:52:34 waterbug Exp $ +# $Id: pgxnobjectgrid.py,v 1.18 2006/07/28 19:34:58 waterbug Exp $ """ A table-based, late-bound, configurable object grid -@version: $Revision: 1.17 $ +@version: $Revision: 1.18 $ """ -__version__ = "$Revision: 1.17 $"[11:-2] +__version__ = "$Revision: 1.18 $"[11:-2] from pprint import pprint @@ -14,7 +14,7 @@ from pangalactic.node.images import toolkitimages from pangalactic.node.gui.widgets.pgxnobject import PanGalaxianObject -from pangalactic.node.gui.utils.defaults import DISPLAY_MAPS +from pangalactic.node.gui.utils.display_maps import DISPLAY_MAPS from pangalactic.node.uberorb import state, prefs, display_maps from pangalactic.node.uberorb import URB from pangalactic.utils.toolbox import curry From waterbug at step.nasa.gov Fri Jul 28 16:30:19 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Fri Jul 28 16:30:20 2006 Subject: [pangalactic-commits] Begin automation of display map generation. Message-ID: <200607282030.k6SKUJ3q005305@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/node/gui/utils/display_maps.py 1.1 1.2 Log message: Begin automation of display map generation. Index: PanGalactic/pangalactic/node/gui/utils/display_maps.py diff -u PanGalactic/pangalactic/node/gui/utils/display_maps.py:1.1 PanGalactic/pangalactic/node/gui/utils/display_maps.py:1.2 --- PanGalactic/pangalactic/node/gui/utils/display_maps.py:1.1 Fri Jul 28 15:29:53 2006 +++ PanGalactic/pangalactic/node/gui/utils/display_maps.py Fri Jul 28 16:30:17 2006 @@ -1,8 +1,14 @@ -# $Id: display_maps.py,v 1.1 2006/07/28 19:29:53 waterbug Exp $ +# $Id: display_maps.py,v 1.2 2006/07/28 20:30:17 waterbug Exp $ """ -Pan Galactic default GUI characteristics +Determines the default display characteristics (display names, sets of displayed +Properties, ordering and grouping of Properties, etc.) of PGEF objects in tables +(C{PanGalaxianObjectGrid}s) and as "naked objects" (C{PanGalaxianObject}s). + +This is automated as much as possible, based on the attributes of the registered +C{PgefInterfaces} (i.e., the contents of +L{pangalactic.node.uberorb.URB.interfaces}). """ -__version__ = "$Revision: 1.1 $"[11:-2] +__version__ = "$Revision: 1.2 $"[11:-2] # special attributes of Versionable, not editable directly VERSION_CONTROLS = ['base_id', @@ -25,6 +31,213 @@ 'modifier', 'mod_datetime'] +# This is the only special case, so far, where an Interface's main group +# required "manual intervention" to split it into more manageable chunks. +# TODO: develop an algorithm to split an Interface's 'main' group logically if +# it gets too big, so this kind of thing can be automated. +Organization_groups = {'admin': ['oid', + 'security_mask', + 'record_owner', + 'record_creator', + 'record_create_datetime', + 'record_modifier', + 'record_mod_datetime', + 'owner', + 'creator', + 'create_datetime', + 'modifier', + 'mod_datetime'], + 'main': ['id', + 'id_ns', + 'org_name_code', + 'name', + 'parent_organization', + 'description', + 'comment', + 'phone', + 'status_code', + 'type_code', + 'replacement_cage', + 'sic_code1', + 'sic_code2', + 'sic_code3', + 'sic_code4'], + 'address': [ + 'name1', + 'name2', + 'name3', + 'name4', + 'name5', + 'country_code', + 'street_address1', + 'street_address2', + 'city', + 'state_or_country', + 'zip_or_postal_zone']} + +# The default 'main' Property group for an object -- which will also serve as +# the default set of columns for its tabular display -- will include all of its +# Properties that do not appear in either the ADMIN_CONTROLS or VERSION_CONTROLS +# Property groups. + +def generateDisplayMap(iface): + """ + Generate the default display characteristics for a PanGalacticInterface -- + i.e., the display names, sets of displayed Properties, ordering and grouping + of Properties, etc.) of PGEF objects that implement the interface, in tables + (C{PanGalaxianObjectGrid}s) and as "naked objects" (C{PanGalaxianObject}s). + This function is intended to be used in the definition of 'display_map' as a + Python property of PgefObject. + """ + pass + + +COLUMN_MAPS = { + 'Actor': { + 'columns': ['id', + 'name', + 'fname', + 'mi_or_name', + 'lname']}, + 'Acu': { + 'columns': ['id', + 'name', + 'parent', + 'child', + 'ref_designator']}, + 'DataPackage': { + 'columns': ['id', + 'name', + 'version', + 'cm_authority', + 'publish_datetime']}, + 'DataSet': { + 'columns': ['id', + 'name', + 'version', + 'cm_authority', + 'publish_datetime']}, + 'Document': { + 'columns': ['id', + 'name', + 'version', + 'cm_authority', + 'publish_datetime']}, + 'FileLink': { + 'columns': ['id', + 'name', + 'file_role', + 'file_sequence', + 'file_sequence_context', + 'user_file_name', + 'bytes', + 'mime_type']}, + 'Mime': { + 'columns': ['id', 'name']}, + 'Model': { + 'columns': ['id', 'name', 'version', 'cm_authority']}, + 'ObjectDocument': { + 'columns': ['id', + 'name', + 'parent', + 'child', + 'documentation_purpose']}, + 'PanGalacticOntology': { + 'columns': ['id', + 'id_ns', + 'name', + 'version', + 'cm_authority', + 'uri']}, + 'OrgPerson': { + 'columns': ['id', 'name', 'parent', 'child']}, + 'Organization': { + 'columns': ['id', + 'name', + 'city', + 'state_or_country', + 'parent_organization']}, + 'Part': { + 'columns': ['id', + 'name', + 'version', + 'cm_authority', + 'part_number_spec', + 'part_number_generic', + 'fsc_code']}, + 'PartModel': { + 'columns': ['id', + 'name', + 'parent', + 'child', + 'part_model_purpose']}, + 'PartsList': { + 'columns': ['id', + 'name', + 'version', + 'cm_authority', + 'publish_datetime', + 'pl_type']}, + 'PartsListItem': { + 'columns': ['id', + 'name', + 'parent', + 'child']}, + 'Person': { + 'columns': ['id', + 'name', + 'fname', + 'mi_or_name', + 'lname']}, + 'PanGalacticObject': { + 'columns': ['id', 'name']}, + 'PhysicalObject': { + 'columns': ['id', 'name']}, + 'PhysicalPart': { + 'columns': ['id', + 'name', + 'part', + 'part_mfr']}, + 'Project': { + 'columns': ['id', 'name']}, + 'ProjectPerson': { + 'columns': ['id', + 'name', + 'parent', + 'child']}, + 'PanGalacticProperty': { + 'columns': ['id', + 'id_ns', + 'cm_authority', + 'domain', + 'range']}, + 'Qacu': { + 'columns': ['id', + 'name', + 'parent', + 'child', + 'component_quantity']}, + 'Relationship': { + 'columns': ['id', + 'name', + 'parent', + 'child']}, + 'RoleAssignment': { + 'columns': ['id', + 'name', + 'parent', + 'child']}, + 'Representation': { + 'columns': ['id', + 'name', + 'rep_purpose', + 'is_generable', + 'is_composable', + 'is_object_source']}, + 'Role': { + 'columns': ['id', 'name', 'context']} + } + DISPLAY_MAPS = { 'Actor': { 'columns': ['id', From waterbug at step.nasa.gov Sat Jul 29 12:31:47 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Sat Jul 29 12:31:49 2006 Subject: [pangalactic-commits] Fixed broken administrative "change password for user". Message-ID: <200607291631.k6TGVli6009281@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/meta/registry.py 1.100 1.101 PanGalactic/pangalactic/node/uberorb.py 1.68 1.69 PanGalactic/pangalactic/node/gui/dialogs/useradmin.py 1.10 1.11 PanGalactic/pangalactic/node/gui/utils/display_maps.py 1.2 1.3 PanGalactic/pangalactic/node/io/owlport.py 1.17 1.18 Log message: Fixed broken administrative "change password for user". Index: PanGalactic/pangalactic/meta/registry.py diff -u PanGalactic/pangalactic/meta/registry.py:1.100 PanGalactic/pangalactic/meta/registry.py:1.101 --- PanGalactic/pangalactic/meta/registry.py:1.100 Wed Jul 26 02:34:11 2006 +++ PanGalactic/pangalactic/meta/registry.py Sat Jul 29 12:31:42 2006 @@ -1,9 +1,9 @@ -# $Id: registry.py,v 1.100 2006/07/26 06:34:11 waterbug Exp $ +# $Id: registry.py,v 1.101 2006/07/29 16:31:42 waterbug Exp $ """ Pan Galactic Meta Object Registry -@version: $Revision: 1.100 $ +@version: $Revision: 1.101 $ The C{PanGalacticRegistry} maintains an in-memory cache of the PanGalactic ('pgef') core ontology (the C{Interface} instances that are the C{_schema}s of @@ -12,7 +12,7 @@ L{pangalactic.node.uberorb.URB} to deserialize domain objects in a PanGalactic application. """ -__version__ = "$Revision: 1.100 $"[11:-2] +__version__ = "$Revision: 1.101 $"[11:-2] import glob import imp @@ -27,7 +27,6 @@ from twisted.python.reflect import allYourBase # Zope Interface -from zope.interface import Interface from zope.interface.interface import InterfaceClass, TAGGED_DATA # PanGalactic Index: PanGalactic/pangalactic/node/gui/utils/display_maps.py diff -u PanGalactic/pangalactic/node/gui/utils/display_maps.py:1.2 PanGalactic/pangalactic/node/gui/utils/display_maps.py:1.3 --- PanGalactic/pangalactic/node/gui/utils/display_maps.py:1.2 Fri Jul 28 16:30:17 2006 +++ PanGalactic/pangalactic/node/gui/utils/display_maps.py Sat Jul 29 12:31:44 2006 @@ -1,4 +1,4 @@ -# $Id: display_maps.py,v 1.2 2006/07/28 20:30:17 waterbug Exp $ +# $Id: display_maps.py,v 1.3 2006/07/29 16:31:44 waterbug Exp $ """ Determines the default display characteristics (display names, sets of displayed Properties, ordering and grouping of Properties, etc.) of PGEF objects in tables @@ -8,7 +8,7 @@ C{PgefInterfaces} (i.e., the contents of L{pangalactic.node.uberorb.URB.interfaces}). """ -__version__ = "$Revision: 1.2 $"[11:-2] +__version__ = "$Revision: 1.3 $"[11:-2] # special attributes of Versionable, not editable directly VERSION_CONTROLS = ['base_id', @@ -31,8 +31,8 @@ 'modifier', 'mod_datetime'] -# This is the only special case, so far, where an Interface's main group -# required "manual intervention" to split it into more manageable chunks. +# This is the only special case so far, where an Interface's main group +# requires "manual intervention" to split it into more manageable chunks. # TODO: develop an algorithm to split an Interface's 'main' group logically if # it gets too big, so this kind of thing can be automated. Organization_groups = {'admin': ['oid', @@ -88,8 +88,11 @@ (C{PanGalaxianObjectGrid}s) and as "naked objects" (C{PanGalaxianObject}s). This function is intended to be used in the definition of 'display_map' as a Python property of PgefObject. + + @param iface: a PGEF Interface + @type iface: L{zope.interface.Interface} """ - pass + COLUMN_MAPS = { Index: PanGalactic/pangalactic/node/gui/dialogs/useradmin.py diff -u PanGalactic/pangalactic/node/gui/dialogs/useradmin.py:1.10 PanGalactic/pangalactic/node/gui/dialogs/useradmin.py:1.11 --- PanGalactic/pangalactic/node/gui/dialogs/useradmin.py:1.10 Mon Dec 5 21:16:52 2005 +++ PanGalactic/pangalactic/node/gui/dialogs/useradmin.py Sat Jul 29 12:31:43 2006 @@ -2,9 +2,9 @@ A dialog to enable the admin user to add, modify, or delete users for a PGER Node. -@version: $Revision: 1.10 $ +@version: $Revision: 1.11 $ """ -__version__ = "$Revision: 1.10 $"[11:-2] +__version__ = "$Revision: 1.11 $"[11:-2] # allow Python 2.3 ('sets' module) or 2.4 ('set' built-in) try: set @@ -137,12 +137,17 @@ self.person_projects.items = [] def onSetPasswd(self, event): + print ' - onSetPasswd' passwd = self.passwdctrl.GetValue() + # self.person is set by selection (see onSelectPerson) userid = self.person.oid - if userid == 'admin': - URB.changePassword(URB.passwd, passwd, userid) - else: - URB.changeUserPassword(passwd, userid) + print ' userid =', userid + if userid != 'admin' and URB.userid == 'admin': + print ' URB.changePasswordForUser called' + URB.changePasswordForUser(passwd, userid) + elif userid == self.userid: + print ' URB.changePassword called' + URB.changePassword(passwd, userid) self.passwdctrl.Clear() def onAddProjectPerson(self, event): Index: PanGalactic/pangalactic/node/uberorb.py diff -u PanGalactic/pangalactic/node/uberorb.py:1.68 PanGalactic/pangalactic/node/uberorb.py:1.69 --- PanGalactic/pangalactic/node/uberorb.py:1.68 Fri Jul 28 15:34:58 2006 +++ PanGalactic/pangalactic/node/uberorb.py Sat Jul 29 12:31:43 2006 @@ -1,11 +1,11 @@ -# $Id: uberorb.py,v 1.68 2006/07/28 19:34:58 waterbug Exp $ +# $Id: uberorb.py,v 1.69 2006/07/29 16:31:43 waterbug Exp $ # -*- test-case-name: pangalactic.test.test_uberorb -*- """ A PanGalaxian node's UberORB -@version: $Revision: 1.68 $ +@version: $Revision: 1.69 $ """ -__version__ = "$Revision: 1.68 $"[11:-2] +__version__ = "$Revision: 1.69 $"[11:-2] import codecs import mimetypes @@ -129,7 +129,7 @@ server_port = property(getServerPort, setServerPort, delServerPort, 'server_port') - def _initXmlrpcInterface(self, username, password, secure=1): + def _initXmlrpcInterface(self, username, password, secure=True): """ Initialize a server proxy. """ @@ -144,16 +144,45 @@ password=password, secure=secure) - def changePassword(self, login_pwd, new_pwd, userid, secure=1): + def changePassword(self, new_passwd, userid, secure=True): + """ + Change the password of the current user for the current service (assumes + the user is logged in to a service). + + @param new_passwd: the new password + @type new_passwd: C{str} + + @param userid: the current userid + @type userid: C{str} + + @param secure: flag indicating whether the connection is secure (SSL, + in this case) + @type userid: C{bool} + """ # print "URB.changePassword" if state['loggedin']: - self.xmlrpc.changePassword(new_pwd, userid) - self.login(userid, new_pwd, secure=secure) + self.xmlrpc.changePassword(new_passwd, userid) + self.login(userid, new_passwd, secure=secure) - def changeUserPassword(self, new_pwd, userid, secure=1): + def changePasswordForUser(self, new_passwd, userid, secure=True): + """ + Change the password for a specified user for the current service + (assumes the user is logged in to a service and has administrative + privileges for that service). + + @param new_passwd: the new password + @type new_passwd: C{str} + + @param userid: the current userid + @type userid: C{str} + + @param secure: flag indicating whether the connection is secure (SSL, + in this case) + @type userid: C{bool} + """ # print "URB.changePassword" if state['loggedin']: - self.xmlrpc.changePassword(new_pwd, userid) + self.xmlrpc.changePassword(new_passwd, userid) def getDict(self, name): """ @@ -168,7 +197,7 @@ def getUser(self, userid): return self.getObject(userid) - def login(self, userid, password, secure=1): + def login(self, userid, password, secure=True): """ Oversees the login process and the loading of project data. """ @@ -179,6 +208,7 @@ except xmlrpclib.ProtocolError, e: print " - Exception:", e return False + self.userid = userid self.passwd = password return True @@ -491,7 +521,7 @@ srvpath = "/upload", userid = userid, passwd = passwd, - secure = 1, + secure = True, useragent = "", oid = obj_oid, mimetype = ctype) Index: PanGalactic/pangalactic/node/io/owlport.py diff -u PanGalactic/pangalactic/node/io/owlport.py:1.17 PanGalactic/pangalactic/node/io/owlport.py:1.18 --- PanGalactic/pangalactic/node/io/owlport.py:1.17 Mon Jul 24 00:44:48 2006 +++ PanGalactic/pangalactic/node/io/owlport.py Sat Jul 29 12:31:45 2006 @@ -1,12 +1,12 @@ -# $Id: owlport.py,v 1.17 2006/07/24 04:44:48 waterbug Exp $ +# $Id: owlport.py,v 1.18 2006/07/29 16:31:45 waterbug Exp $ """ OWL import/export module. Reads and writes OWL graphs. Such graphs are sets of statements (known in RDF as "triples": node-arc-node or subject-predicate-object). -@version: $Revision: 1.17 $ +@version: $Revision: 1.18 $ """ -__version__ = "$Revision: 1.17 $"[11:-2] +__version__ = "$Revision: 1.18 $"[11:-2] # Python modules import base64 @@ -173,11 +173,11 @@ # read in RDF files from current knowledgebase (kb) self.rdfpath = os.path.join(kbpath, '*.rdf') self.owlpath = os.path.join(kbpath, '*.owl') - f = open('test.log', 'w') + # f = open('test.log', 'w') for filepath in glob.glob(self.rdfpath)+glob.glob(self.owlpath): - f.write('reading kb file: %s\n' % str(filepath)) + # f.write('reading kb file: %s\n' % str(filepath)) self.readRdf(filepath) - f.close() + # f.close() def readRdf(self, filepath, name=''): """ From waterbug at step.nasa.gov Sat Jul 29 15:12:08 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Sat Jul 29 15:12:09 2006 Subject: [pangalactic-commits] Mainly fixes to bugs in table creation ... Message-ID: <200607291912.k6TJC88A009483@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/meta/registry.py 1.101 1.102 PanGalactic/pangalactic/node/pangalaxian.py 1.104 1.105 PanGalactic/pangalactic/node/uberorb.py 1.69 1.70 PanGalactic/pangalactic/node/gui/dialogs/useradmin.py 1.11 1.12 PanGalactic/pangalactic/node/gui/widgets/toolframe.py 1.6 1.7 PanGalactic/pangalactic/node/kb/pgef.owl 1.27 1.28 PanGalactic/pangalactic/repo/chronosynclastic.py 1.84 1.85 PanGalactic/pangalactic/repo/pger.py 1.123 1.124 PanGalactic/pangalactic/test/test_chronosynclastic_searchWithDistinct.py 1.2 1.3 PanGalactic/pangalactic/test/test_uberorb.py 1.2 1.3 PanGalactic/pangalactic/utils/xmlrpcinterface.py 1.106 1.107 PanGalactic/src/sql/insertTestData.sql 1.24 1.25 Log message: Mainly fixes to bugs in table creation ... plus some naming consistency issues, docstrings, etc. Index: PanGalactic/pangalactic/test/test_chronosynclastic_searchWithDistinct.py diff -u PanGalactic/pangalactic/test/test_chronosynclastic_searchWithDistinct.py:1.2 PanGalactic/pangalactic/test/test_chronosynclastic_searchWithDistinct.py:1.3 --- PanGalactic/pangalactic/test/test_chronosynclastic_searchWithDistinct.py:1.2 Fri Jan 20 17:23:56 2006 +++ PanGalactic/pangalactic/test/test_chronosynclastic_searchWithDistinct.py Sat Jul 29 15:12:04 2006 @@ -1,4 +1,4 @@ -# $Id: test_chronosynclastic_searchWithDistinct.py,v 1.2 2006/01/20 22:23:56 waterbug Exp $ +# $Id: test_chronosynclastic_searchWithDistinct.py,v 1.3 2006/07/29 19:12:04 waterbug Exp $ """ Functional test for pangalactic.repo.chronosynclastic module @@ -25,7 +25,7 @@ fum = Fum() res = fum.search(requestor='test', - schema_name='PanGalacticVersionable', + schema_name='VersionableProduct', refs=False, subtypes=True, distinct=True, Index: PanGalactic/pangalactic/node/gui/dialogs/useradmin.py diff -u PanGalactic/pangalactic/node/gui/dialogs/useradmin.py:1.11 PanGalactic/pangalactic/node/gui/dialogs/useradmin.py:1.12 --- PanGalactic/pangalactic/node/gui/dialogs/useradmin.py:1.11 Sat Jul 29 12:31:43 2006 +++ PanGalactic/pangalactic/node/gui/dialogs/useradmin.py Sat Jul 29 15:12:01 2006 @@ -2,9 +2,9 @@ A dialog to enable the admin user to add, modify, or delete users for a PGER Node. -@version: $Revision: 1.11 $ +@version: $Revision: 1.12 $ """ -__version__ = "$Revision: 1.11 $"[11:-2] +__version__ = "$Revision: 1.12 $"[11:-2] # allow Python 2.3 ('sets' module) or 2.4 ('set' built-in) try: set @@ -138,16 +138,16 @@ def onSetPasswd(self, event): print ' - onSetPasswd' - passwd = self.passwdctrl.GetValue() + new_passwd = self.passwdctrl.GetValue() # self.person is set by selection (see onSelectPerson) userid = self.person.oid print ' userid =', userid if userid != 'admin' and URB.userid == 'admin': print ' URB.changePasswordForUser called' - URB.changePasswordForUser(passwd, userid) + URB.changePasswordForUser(new_passwd, userid) elif userid == self.userid: print ' URB.changePassword called' - URB.changePassword(passwd, userid) + URB.changePassword(new_passwd) self.passwdctrl.Clear() def onAddProjectPerson(self, event): Index: PanGalactic/src/sql/insertTestData.sql diff -u PanGalactic/src/sql/insertTestData.sql:1.24 PanGalactic/src/sql/insertTestData.sql:1.25 --- PanGalactic/src/sql/insertTestData.sql:1.24 Fri Jan 20 16:01:11 2006 +++ PanGalactic/src/sql/insertTestData.sql Sat Jul 29 15:12:05 2006 @@ -1,7 +1,7 @@ /* Test data initialization script. * */ -/* $Id: insertTestData.sql,v 1.24 2006/01/20 21:01:11 waterbug Exp $ */ +/* $Id: insertTestData.sql,v 1.25 2006/07/29 19:12:05 waterbug Exp $ */ /* TODO: Add the following 'Roles' and assign them ... 'Just Some Guy' @@ -118,6 +118,15 @@ '0' ); +INSERT INTO _passwd +( + _oid +) +VALUES +( + 'Fester.Bestertester@earth.milkyway.univ' +); + INSERT INTO _person ( _oid, @@ -165,7 +174,7 @@ ) VALUES ( - 'Fester.Bestertester@earth.milkyway.univ' + 'zaphod@hog.univ' ); INSERT INTO _person Index: PanGalactic/pangalactic/meta/registry.py diff -u PanGalactic/pangalactic/meta/registry.py:1.101 PanGalactic/pangalactic/meta/registry.py:1.102 --- PanGalactic/pangalactic/meta/registry.py:1.101 Sat Jul 29 12:31:42 2006 +++ PanGalactic/pangalactic/meta/registry.py Sat Jul 29 15:12:00 2006 @@ -1,9 +1,9 @@ -# $Id: registry.py,v 1.101 2006/07/29 16:31:42 waterbug Exp $ +# $Id: registry.py,v 1.102 2006/07/29 19:12:00 waterbug Exp $ """ Pan Galactic Meta Object Registry -@version: $Revision: 1.101 $ +@version: $Revision: 1.102 $ The C{PanGalacticRegistry} maintains an in-memory cache of the PanGalactic ('pgef') core ontology (the C{Interface} instances that are the C{_schema}s of @@ -12,7 +12,7 @@ L{pangalactic.node.uberorb.URB} to deserialize domain objects in a PanGalactic application. """ -__version__ = "$Revision: 1.101 $"[11:-2] +__version__ = "$Revision: 1.102 $"[11:-2] import glob import imp @@ -193,16 +193,16 @@ def getPersistables(self): """ - Get a list of the names of registered interfaces for which tables will - be created in PGER. + Get a list of the names of all registered interfaces for which tables + will be created in PGER. """ - core = filter((lambda x: self.interfaces['PanGalacticObject'] - in allYourBase(self.interfaces[x])), - list(self.interfaces)) + domain = filter((lambda x: self.interfaces['PanGalacticObject'] + in allYourBase(self.interfaces[x])), + list(self.interface_base_order)) meta = filter((lambda x: self.interfaces['PanGalacticMetaObject'] in allYourBase(self.interfaces[x])), list(self.interfaces)) - interfaces = core + meta + interfaces = domain + meta interfaces.insert(0, 'PanGalacticObject') interfaces.insert(0, 'PanGalacticMetaObject') interfaces.insert(0, 'Identifiable') Index: PanGalactic/pangalactic/repo/chronosynclastic.py diff -u PanGalactic/pangalactic/repo/chronosynclastic.py:1.84 PanGalactic/pangalactic/repo/chronosynclastic.py:1.85 --- PanGalactic/pangalactic/repo/chronosynclastic.py:1.84 Fri Jan 20 17:23:55 2006 +++ PanGalactic/pangalactic/repo/chronosynclastic.py Sat Jul 29 15:12:03 2006 @@ -1,12 +1,12 @@ -# $Id: chronosynclastic.py,v 1.84 2006/01/20 22:23:55 waterbug Exp $ +# $Id: chronosynclastic.py,v 1.85 2006/07/29 19:12:03 waterbug Exp $ """ The Chronosynclastic Infundibulum: an asynchronous, ontology-driven object-relational mapping and database interface. -@version: $Revision: 1.84 $ +@version: $Revision: 1.85 $ """ -__version__ = "$Revision: 1.84 $"[11:-2] +__version__ = "$Revision: 1.85 $"[11:-2] import re import string @@ -155,14 +155,13 @@ self.createTable('Identifiable') self.createTable('PanGalacticObject') self.createTable('PanGalacticMetaObject') - for schema_name in URB.interface_base_order: - current_tables = self._getTableNames() - if (self._tableNameForSchemaName(schema_name) not in current_tables - and ((URB.interfaces['PanGalacticObject'] in - allYourBase(URB.interfaces[schema_name])) - or URB.interfaces['PanGalacticMetaObject'] in - allYourBase(URB.interfaces[schema_name]))): - self.createTable(schema_name) + current_tables = self._getTableNames() + persistables = URB.persistables + for schema in URB.interface_base_order: + if (schema in persistables and + self._tableNameForSchemaName(schema) + not in current_tables): + self.createTable(schema) # special case: _passwd table create_passwd_table = '\n'.join([ " CREATE TABLE _passwd", @@ -178,7 +177,7 @@ curs.execute(create_passwd_table) return conn.commit() - def createTable(self, schema_name): + def createTable(self, schema): """ Create a database table that will accomodate objects with the specified object schema. In order to create a table for a given @@ -188,8 +187,8 @@ function takes care of that. Basically, it finds the "closure" of the object schema within the PGEF core ontology. :) - @param schema_name: the __name__ of a Zope C{Interface} - @type schema_name: C{str} + @param schema: the __name__ of a Zope C{Interface} + @type schema: C{str} """ # Implementation of object schema inheritance of object properties # (i.e., object-object relationships) as FK relationships between @@ -198,12 +197,12 @@ # (1) create a dict of ALTER TABLE commands by table/schema # (2) when a new table is created, get the ALTER TABLE commands of # all its bases and modify them to apply to the new table - schema = URB.interfaces[schema_name] - tname = self._tableNameForSchemaName(schema.__name__) + iface = URB.interfaces[schema] + tname = self._tableNameForSchemaName(iface.__name__) current_tables = self._getTableNames() if tname in current_tables: return - required = Set([schema_name]) + required = Set([schema]) # first check for other schemas referenced by this one, and those # referenced by the referenced schemas, etc. ... newstuff = Set() @@ -217,10 +216,10 @@ creates = [] required_order = filter(lambda x: x in required, URB.interface_base_order) - for schema_name in required_order: - if self._tableNameForSchemaName(schema_name) not in current_tables: - obj_schema = URB.interfaces[schema_name] - create = self._genCreateTableCommands(obj_schema) + for ifname in required_order: + if self._tableNameForSchemaName(ifname) not in current_tables: + iface = URB.interfaces[ifname] + create = self._genCreateTableCommands(iface) creates.append(create) begin = 'BEGIN TRANSACTION;' middle = '\n\n'.join(creates) Index: PanGalactic/pangalactic/node/pangalaxian.py diff -u PanGalactic/pangalactic/node/pangalaxian.py:1.104 PanGalactic/pangalactic/node/pangalaxian.py:1.105 --- PanGalactic/pangalactic/node/pangalaxian.py:1.104 Fri Mar 3 23:50:25 2006 +++ PanGalactic/pangalactic/node/pangalaxian.py Sat Jul 29 15:12:00 2006 @@ -2,16 +2,16 @@ # -*- coding: ANSI_X3.4-1968 -*- # generated by wxGlade 0.3.5.1 on Tue Feb 1 00:19:02 2005 -# $Id: pangalaxian.py,v 1.104 2006/03/04 04:50:25 waterbug Exp $ +# $Id: pangalaxian.py,v 1.105 2006/07/29 19:12:00 waterbug Exp $ """ Main application module for PanGalaxian, the PGEF desktop client. WE ARE THE PANGALAXIANS! :) -@version: $Revision: 1.104 $ +@version: $Revision: 1.105 $ """ -__version__ = "$Revision: 1.104 $"[11:-2] +__version__ = "$Revision: 1.105 $"[11:-2] # Python import sys @@ -242,8 +242,9 @@ sizer = wx.BoxSizer(wx.VERTICAL) label = wx.StaticText(dlg, -1, "Username:") sizer.Add(label, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT|wx.RIGHT, 5) - username = wx.TextCtrl(dlg, -1, "", size=(180,-1)) - sizer.Add(username, 1, wx.ALIGN_LEFT|wx.BOTTOM|wx.LEFT|wx.RIGHT, 5) + userid_widget = wx.TextCtrl(dlg, -1, "", size=(180,-1)) + sizer.Add(userid_widget, 1, + wx.ALIGN_LEFT|wx.BOTTOM|wx.LEFT|wx.RIGHT, 5) label = wx.StaticText(dlg, -1, "Email:") sizer.Add(label, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT|wx.RIGHT, 5) email = wx.TextCtrl(dlg, -1, "", size=(180,-1)) @@ -260,7 +261,7 @@ sizer.Fit(dlg) dlg.CentreOnParent() if dlg.ShowModal() == wx.ID_OK: - prefs['userid'] = username.GetValue() + prefs['userid'] = userid_widget.GetValue() prefs['email'] = email.GetValue() dlg.Destroy() useroid = prefs.get('email', Index: PanGalactic/pangalactic/node/uberorb.py diff -u PanGalactic/pangalactic/node/uberorb.py:1.69 PanGalactic/pangalactic/node/uberorb.py:1.70 --- PanGalactic/pangalactic/node/uberorb.py:1.69 Sat Jul 29 12:31:43 2006 +++ PanGalactic/pangalactic/node/uberorb.py Sat Jul 29 15:12:01 2006 @@ -1,11 +1,11 @@ -# $Id: uberorb.py,v 1.69 2006/07/29 16:31:43 waterbug Exp $ +# $Id: uberorb.py,v 1.70 2006/07/29 19:12:01 waterbug Exp $ # -*- test-case-name: pangalactic.test.test_uberorb -*- """ A PanGalaxian node's UberORB -@version: $Revision: 1.69 $ +@version: $Revision: 1.70 $ """ -__version__ = "$Revision: 1.69 $"[11:-2] +__version__ = "$Revision: 1.70 $"[11:-2] import codecs import mimetypes @@ -129,9 +129,9 @@ server_port = property(getServerPort, setServerPort, delServerPort, 'server_port') - def _initXmlrpcInterface(self, username, password, secure=True): + def _initXmlrpcInterface(self, userid, passwd, secure=True): """ - Initialize a server proxy. + Initialize a server proxy for the pre-set host and port. """ # TODO: implement HTTP proxy handling # print 'URB._initXmlrpcInterface creating XmlrpcInterface' @@ -140,47 +140,62 @@ return XmlrpcInterface(urb=self, host=self.server_host, port=self.server_port, - username=username, - password=password, + userid=userid, + passwd=passwd, secure=secure) - def changePassword(self, new_passwd, userid, secure=True): + def login(self, userid, passwd, secure=True): """ - Change the password of the current user for the current service (assumes - the user is logged in to a service). - - @param new_passwd: the new password - @type new_passwd: C{str} + Login to a service on the pre-set host and port. - @param userid: the current userid + @param userid: the user's userid (the oid of their Person object) @type userid: C{str} + @param passwd: the user's password + @type passwd: C{str} + @param secure: flag indicating whether the connection is secure (SSL, in this case) @type userid: C{bool} """ - # print "URB.changePassword" + # print "URB.login" + self.xmlrpc = self._initXmlrpcInterface(userid, passwd, secure=secure) + try: + self.xmlrpc.yo() + except xmlrpclib.ProtocolError, e: + print " - Exception:", e + return False + self.userid = userid + self.passwd = passwd + self.secure = secure + return True + + def changePassword(self, new_passwd): + """ + Change the password of the current user for the current service (assumes + the user is logged in to a service). + + @param new_passwd: the new password + @type new_passwd: C{str} + """ + # print " - URB.changePassword" if state['loggedin']: - self.xmlrpc.changePassword(new_passwd, userid) - self.login(userid, new_passwd, secure=secure) + self.xmlrpc.changePassword(new_passwd, URB.userid) + self.login(URB.userid, new_passwd, secure=self.secure) - def changePasswordForUser(self, new_passwd, userid, secure=True): + def changePasswordForUser(self, new_passwd, userid): """ - Change the password for a specified user for the current service - (assumes the user is logged in to a service and has administrative - privileges for that service). + Change the password for a specified userid for the current service + (assumes that the client is logged in to a service and that the current + userid, self.userid, has administrative privileges for that service). @param new_passwd: the new password @type new_passwd: C{str} - @param userid: the current userid + @param userid: the userid whose password is to be changed @type userid: C{str} - - @param secure: flag indicating whether the connection is secure (SSL, - in this case) - @type userid: C{bool} """ - # print "URB.changePassword" + # print " - URB.changePassword" if state['loggedin']: self.xmlrpc.changePassword(new_passwd, userid) @@ -197,21 +212,6 @@ def getUser(self, userid): return self.getObject(userid) - def login(self, userid, password, secure=True): - """ - Oversees the login process and the loading of project data. - """ - # print "URB.login" - self.xmlrpc = self._initXmlrpcInterface(userid, password, secure=secure) - try: - self.xmlrpc.yo() - except xmlrpclib.ProtocolError, e: - print " - Exception:", e - return False - self.userid = userid - self.passwd = password - return True - def getObjectsByProject(self, project): """ Retrieve the latest versions of all Versionable objects managed by a @@ -521,7 +521,7 @@ srvpath = "/upload", userid = userid, passwd = passwd, - secure = True, + secure = self.secure, useragent = "", oid = obj_oid, mimetype = ctype) Index: PanGalactic/pangalactic/repo/pger.py diff -u PanGalactic/pangalactic/repo/pger.py:1.123 PanGalactic/pangalactic/repo/pger.py:1.124 --- PanGalactic/pangalactic/repo/pger.py:1.123 Sun Jan 29 07:23:15 2006 +++ PanGalactic/pangalactic/repo/pger.py Sat Jul 29 15:12:03 2006 @@ -1,10 +1,10 @@ -# $Id: pger.py,v 1.123 2006/01/29 12:23:15 waterbug Exp $ +# $Id: pger.py,v 1.124 2006/07/29 19:12:03 waterbug Exp $ """ Pan Galactic Entropy Reverser module -@version: $Revision: 1.123 $ +@version: $Revision: 1.124 $ """ -__version__ = "$Revision: 1.123 $"[11:-2] +__version__ = "$Revision: 1.124 $"[11:-2] import base64 import sys @@ -607,7 +607,7 @@ """ Get all base_ids currently registered for the specified namespace. """ - res = self.search(requestor, 'PanGalacticVersionable', refs=False, + res = self.search(requestor, 'VersionableProduct', refs=False, subtypes=True, spec=['base_id'], distinct=True, args=[('id_ns', '=', ns)]) res.addCallback(lambda x: [r[0] for r in x]) Index: PanGalactic/pangalactic/node/gui/widgets/toolframe.py diff -u PanGalactic/pangalactic/node/gui/widgets/toolframe.py:1.6 PanGalactic/pangalactic/node/gui/widgets/toolframe.py:1.7 --- PanGalactic/pangalactic/node/gui/widgets/toolframe.py:1.6 Tue Jan 10 06:28:25 2006 +++ PanGalactic/pangalactic/node/gui/widgets/toolframe.py Sat Jul 29 15:12:02 2006 @@ -1,10 +1,10 @@ -# $Id: toolframe.py,v 1.6 2006/01/10 11:28:25 waterbug Exp $ +# $Id: toolframe.py,v 1.7 2006/07/29 19:12:02 waterbug Exp $ """ Generic Frame subclass for auxiliary windows -@version: $Revision: 1.6 $ +@version: $Revision: 1.7 $ """ -__version__ = "$Revision: 1.6 $"[11:-2] +__version__ = "$Revision: 1.7 $"[11:-2] import wx from pangalactic.node.gui.widgets.aboutbox import AboutBox @@ -39,8 +39,8 @@ def ClearField(self, field): self.SetStatusText("", field) - def SetUser(self, username): - self.SetStatusText(" User: " + username, 2) + def SetUser(self, userid): + self.SetStatusText(" User: " + userid, 2) def ClearUser(self): self.SetStatusText(" User: Not Logged In", 2) Index: PanGalactic/pangalactic/utils/xmlrpcinterface.py diff -u PanGalactic/pangalactic/utils/xmlrpcinterface.py:1.106 PanGalactic/pangalactic/utils/xmlrpcinterface.py:1.107 --- PanGalactic/pangalactic/utils/xmlrpcinterface.py:1.106 Fri Jan 20 17:23:56 2006 +++ PanGalactic/pangalactic/utils/xmlrpcinterface.py Sat Jul 29 15:12:05 2006 @@ -1,11 +1,11 @@ -# $Id: xmlrpcinterface.py,v 1.106 2006/01/20 22:23:56 waterbug Exp $ +# $Id: xmlrpcinterface.py,v 1.107 2006/07/29 19:12:05 waterbug Exp $ """ PanGalactic Client XML-RPC Interfaces -@version: $Revision: 1.106 $ +@version: $Revision: 1.107 $ """ -__version__ = "$Revision: 1.106 $"[11:-2] +__version__ = "$Revision: 1.107 $"[11:-2] import base64 import xmlrpclib @@ -21,9 +21,9 @@ (Thanks to Amos's Zope Page for this code. :) """ - def __init__(self, username=None, password=None): - self.username=username - self.password=password + def __init__(self, userid=None, passwd=None): + self.userid=userid + self.passwd=passwd self.verbose = 0 def request(self, host, handler, request_body, verbose=0): @@ -37,9 +37,9 @@ h.putheader("Content-Type", "text/xml") h.putheader("Content-Length", str(len(request_body))) # basic auth - if self.username is not None and self.password is not None: + if self.userid is not None and self.passwd is not None: h.putheader("AUTHORIZATION", "Basic %s" % string.replace( - base64.encodestring("%s:%s" % (self.username, self.password)), + base64.encodestring("%s:%s" % (self.userid, self.passwd)), "\012", "")) h.endheaders() if request_body: @@ -60,9 +60,9 @@ (Thanks to Amos's Zope Page for this code. :) """ - def __init__(self, username=None, password=None): - self.username=username - self.password=password + def __init__(self, userid=None, passwd=None): + self.userid=userid + self.passwd=passwd self.verbose = 0 def request(self, host, handler, request_body, verbose=0): @@ -76,9 +76,9 @@ h.putheader("Content-Type", "text/xml") h.putheader("Content-Length", str(len(request_body))) # basic auth - if self.username is not None and self.password is not None: + if self.userid is not None and self.passwd is not None: h.putheader("AUTHORIZATION", "Basic %s" % string.replace( - base64.encodestring("%s:%s" % (self.username, self.password)), + base64.encodestring("%s:%s" % (self.userid, self.passwd)), "\012", "")) h.endheaders() if request_body: @@ -98,7 +98,7 @@ XML-RPC API to PGER """ - def __init__(self, urb, host, port, username='', password='', secure=1): + def __init__(self, urb, host, port, userid='', passwd='', secure=1): # proxyhost=None, proxyport=None ... # (we'll worry about proxies later :) self.urb = urb @@ -109,17 +109,17 @@ conns = 'http://' conns = conns + host + ':' + str(port) print 'XmlrpcInterface: connection string is', conns - if username and password: - self.username = username + if userid and passwd: + self.userid = userid if secure: self._RPC = xmlrpclib.ServerProxy \ (conns, - SafeBasicAuthTransport(username, - password)) + SafeBasicAuthTransport(userid, + passwd)) else: self._RPC = xmlrpclib.ServerProxy(conns, - BasicAuthTransport(username, - password)) + BasicAuthTransport(userid, + passwd)) else: self._RPC = xmlrpclib.ServerProxy(conns) @@ -129,12 +129,12 @@ def openPodBayDoor(self): return self._RPC.openPodBayDoor() - def changePassword(self, password, username=''): - if not username: - username = self.username - elif username != self.username and self.username != 'admin': + def changePassword(self, passwd, userid=''): + if not userid: + userid = self.userid + elif userid != self.userid and self.userid != 'admin': raise ValueError, "Only admin can change others' passwords." - return self._RPC.changePassword(password, username) + return self._RPC.changePassword(passwd, userid) def addObjects(self, objs): """ Index: PanGalactic/pangalactic/test/test_uberorb.py diff -u PanGalactic/pangalactic/test/test_uberorb.py:1.2 PanGalactic/pangalactic/test/test_uberorb.py:1.3 --- PanGalactic/pangalactic/test/test_uberorb.py:1.2 Sun Nov 27 00:47:03 2005 +++ PanGalactic/pangalactic/test/test_uberorb.py Sat Jul 29 15:12:04 2006 @@ -1,4 +1,4 @@ -# $Id: test_uberorb.py,v 1.2 2005/11/27 05:47:03 waterbug Exp $ +# $Id: test_uberorb.py,v 1.3 2006/07/29 19:12:04 waterbug Exp $ """ Unit tests for pangalactic.node.uberorb @@ -20,7 +20,7 @@ # self.assertEquals(expected, cmd) test_onStateChange.todo = 'not done.' - def test_private_createServer(self, username, password, secure=1): + def test_private_createServer(self, userid, passwd, secure=1): """CASE: _createServer""" pass test_private_createServer.todo = 'not done.' Index: PanGalactic/pangalactic/node/kb/pgef.owl diff -u PanGalactic/pangalactic/node/kb/pgef.owl:1.27 PanGalactic/pangalactic/node/kb/pgef.owl:1.28 --- PanGalactic/pangalactic/node/kb/pgef.owl:1.27 Fri Jul 28 09:33:08 2006 +++ PanGalactic/pangalactic/node/kb/pgef.owl Sat Jul 29 15:12:03 2006 @@ -5,7 +5,7 @@ xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" - xml:base="http://pangalactic.us/pgef/"> + xml:base="http://www.owl-ontologies.com/unnamed.owl"> @@ -49,7 +49,7 @@ - + @@ -98,15 +98,15 @@ - + A configuration-manageable structure composed of one or more linked Activity definitions, which is applied systematically to realise a business objective or policy goal, normally within the context of an organisational structure defining functional roles and relationships. [Based on the WfMC definition of "Business Process"] Synonyms: Business Process, Process Definition. - + The common ancestor of all Versionable descendents of PanGalacticObject. + >The common ancestor of all Versionable objects. @@ -118,11 +118,11 @@ + A concept that has some functionality that can be realized in a product or thing that is physically sensible and measurable (the PhysicalPart). pgef:Part maps to the combination of STEP (ISO 10303) 'product' and 'product_definition_formation'. STEP 'frame_of_reference' (-> product_context.id) is not represented within the PGEF ontology. STEP 'description' maps to description. - @@ -190,12 +190,6 @@ - - - A Relationship between a Role with an Organization context and a Person. - - @@ -203,6 +197,12 @@ A well-defined and identifiable connection between PanGalacticObjects. + + + A Relationship between a Role with an Organization context and a Person. + + A readable thing. - + @@ -411,8 +411,8 @@ >Other equivalent identifiers for a Part. - + The purpose of a Model of a Part. @@ -505,9 +505,9 @@ - An Organization's zip code (if in the U.S.) or postal zone. (From the CAGE data structure.) + @@ -533,9 +533,9 @@ - The CAGE type code. (From the CAGE data structure.) + @@ -592,8 +592,8 @@ The Federal Supply Classification code for a Part (this is also the first four digits of the NSN). - + @@ -638,10 +638,10 @@ - + The date and time of last modification of an object. - + @@ -666,8 +666,8 @@ >A narrative about the characteristics and identifying features of an object. - + The name of the attribute within the context of which the Sequence attribute is meaningful. If the value of the Sequence Context attribute is 'role', and the value of Role is 'attachment', then Sequence is the position of this file within the set of files that have a Role of 'attachment'. @@ -676,8 +676,8 @@ A Person's middle initial or name. - + - The URI of the namespace to which an object's name belongs. + The URI of the namespace to which an object's name belongs. @@ -722,11 +722,11 @@ - The size of a file in bytes. - + + @@ -772,8 +772,8 @@ - + The person who authorized creation of the Data Set. @@ -793,9 +793,9 @@ - A capsule summary of the Document's content. + @@ -871,8 +871,8 @@ The manufacturer's identifier for a Part. - + @@ -912,10 +912,10 @@ - The MIME type of the value of the 'content' attribute. (This does not imply that a Document has an intrinsic MIME type. In general, each representation of the Document will have a MIME type, and they may all be different.) + @@ -985,8 +985,8 @@ - + The identifier of the specification document that applies to a Part. @@ -1008,9 +1008,9 @@ - An Organization's state (if in the U.S.) or country. (From the CAGE data structure.) + - + From waterbug at step.nasa.gov Sun Jul 30 19:39:00 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Sun Jul 30 19:39:02 2006 Subject: [pangalactic-commits] New methods for computing default display maps. Message-ID: <200607302339.k6UNd07o029830@ned.gsfc.nasa.gov> Modified files: PanGalactic/TODO 1.51 1.52 PanGalactic/pangalactic/core/pgefobject.py 1.51 1.52 PanGalactic/pangalactic/node/uberorb.py 1.70 1.71 PanGalactic/pangalactic/node/gui/utils/display_maps.py 1.3 1.4 Log message: New methods for computing default display maps. Index: PanGalactic/pangalactic/node/uberorb.py diff -u PanGalactic/pangalactic/node/uberorb.py:1.70 PanGalactic/pangalactic/node/uberorb.py:1.71 --- PanGalactic/pangalactic/node/uberorb.py:1.70 Sat Jul 29 15:12:01 2006 +++ PanGalactic/pangalactic/node/uberorb.py Sun Jul 30 19:38:57 2006 @@ -1,11 +1,11 @@ -# $Id: uberorb.py,v 1.70 2006/07/29 19:12:01 waterbug Exp $ +# $Id: uberorb.py,v 1.71 2006/07/30 23:38:57 waterbug Exp $ # -*- test-case-name: pangalactic.test.test_uberorb -*- """ A PanGalaxian node's UberORB -@version: $Revision: 1.70 $ +@version: $Revision: 1.71 $ """ -__version__ = "$Revision: 1.70 $"[11:-2] +__version__ = "$Revision: 1.71 $"[11:-2] import codecs import mimetypes @@ -26,8 +26,10 @@ from pangalactic.meta.defaults import READ_ONLY_NS from pangalactic.meta.registry import PanGalacticRegistry from pangalactic.meta.interfaces import IMofFactory -from pangalactic.node.gui.utils.display_maps import DISPLAY_MAPS -from pangalactic.node.gui.utils.display_maps import VERSION_CONTROLS +from pangalactic.node.gui.utils.display_maps import ADMIN_PROPERTIES +from pangalactic.node.gui.utils.display_maps import VERSION_PROPERTIES +from pangalactic.node.gui.utils.display_maps import SPECIAL_GROUPS +from pangalactic.node.gui.utils.display_maps import PROPERTY_DEFAULTS from pangalactic.node.objectcache import ObjectCache from pangalactic.utils.httpupload import upload from pangalactic.utils.pgefexceptions import LocalStorageError @@ -76,6 +78,79 @@ def register(self, receiver, signal, **kw): dispatcher.connect(receiver, signal, **kw) + def getDefaultDisplayMap(self, iface_id): + """ + Generate the default display characteristics for PgefObjects that have + the specified Interface. Display maps specify the columns, names, + ordering, and grouping of Properties to be displayed, whether in tabular + format (e.g. C{PanGalaxianObjectGrid}s) or in forms (e.g. the "naked + objects" format of C{PanGalaxianObject}s). + + @param iface_id: a Interface name that is currently registered with the + URB (i.e., one that occurs in self.interfaces) + @type iface_id: C{str} + + @return: a dictionary of the form: + C{{'columns : [list of property ids], + 'groups' : { + group1 : [list of property ids], + group2 : [list of property ids], + ...}} + """ + # The Property groups for an Interface are 'admin' (specified by + # ADMIN_PROPERTIES), plus any special groups defined in SPECIAL_GROUPS, + # plus 'main', which is defined as whatever is left after subtracting + # (ADMIN_PROPERTIES, VERSION_PROPERTIES, and any Properties in special + # groups) from the Interface's complete list of Properties. + # TODO: exception handling (e.g., if Interface is not registered) + iface = self.interfaces[iface_id] + special_groups = SPECIAL_GROUPS.get(iface_id, {}) + special_props = [] + if special_groups: + special_props = reduce(lambda x,y: x.extend(y), + [SPECIAL_GROUPS[iface_id][g] + for g in special_groups]) + excluded = (Set(ADMIN_PROPERTIES) | + Set(VERSION_PROPERTIES) | + Set(special_props)) + included = filter(lambda x: x not in excluded, list(iface)) + main = filter(lambda x: x in included, PROPERTY_DEFAULTS['order']) + dm = {'columns' : main, + 'groups' : {'admin' : ADMIN_PROPERTIES, + 'main' : main}} + dm['groups'].update(special_groups) + return dm + + def getDefaultDisplayMaps(self): + """ + Generate a dictionary containing the default display maps of all + Interfaces and Properties currently registered with the URB. + + @return: a dictionary of the form: + C{{iface_id : {'columns : [list of property ids], + 'groups' : { + group1 : [list of property ids], + group2 : [list of property ids], + ...} + 'display_names' : {property id : display name, ...}, + 'display_styles' : {property id : display style, ...}, + 'order' : [list of property ids]}} + """ + dmaps = {} + for i in self.interfaces: + dmaps[i] = self.getDefaultDisplayMap(i) + pmaps = PROPERTY_DEFAULTS + # set defaults for any Properties not included in PROPERTY_DEFAULTS + for p in URB.properties: + if not pmaps['display_names'].get(p): + pmaps['display_names'][p] = ' '.join(p.split('_')).title() + if not pmaps['display_styles'].get(p): + pmaps['display_styles'][p] = '' + if p not in pmaps['order']: + pmaps['order'].append(p) + dmaps.update(pmaps) + return dmaps + # property: cache def getCache(self): @@ -736,7 +811,8 @@ if not state.get('prefs'): state['prefs'] = {} prefs = state['prefs'] -# user's preferred display maps for objects +# check for user's preferred display maps for objects; if none, initialize as an +# empty dict if not prefs.get('display_maps'): prefs['display_maps'] = {} # user's preferred projects, keyed on the repository servers that host them @@ -746,24 +822,16 @@ # TODO: should make 'projects', and any additional prefs, configurable for # applications (by the admin and/or developer) -# current state of display maps for objects +# set the state's display maps, honoring any that are specified in the current +# state, otherwise using the default +default_display_maps = URB.getDefaultDisplayMaps() if not state.get('display_maps'): - state['display_maps'] = DISPLAY_MAPS -# make sure there is a display_map for each Interface ... -for i in URB.interfaces: - if not state['display_maps'].get(i): - state['display_maps'][i] = state['display_maps']['PanGalacticObject'] -# ... and for each Property -for p in URB.properties: - if not state['display_maps']['display_names'].get(p): - state['display_maps'][ - 'display_names'][p] = ' '.join(p.split('_')).title() - if not state['display_maps']['display_styles'].get(p): - state['display_maps'][ - 'display_styles'][p] = '' + state['display_maps'] = default_display_maps +else: + state['display_maps'] = default_display_maps.update(state['display_maps']) display_maps = state['display_maps'] -URB.version_controls = VERSION_CONTROLS +URB.version_controls = VERSION_PROPERTIES def writeState(): """ Index: PanGalactic/TODO diff -u PanGalactic/TODO:1.51 PanGalactic/TODO:1.52 --- PanGalactic/TODO:1.51 Fri Jul 28 09:33:06 2006 +++ PanGalactic/TODO Sun Jul 30 19:38:56 2006 @@ -166,6 +166,8 @@ [-] edit parts list in grid in PartsList object [-] replace (or, more likely, augment) ZODB with SQLite in PanGalaxian [-] check out Monet DB (probably more optimal for chronosynclastic) +[-] look at incorporating IndexedCatalog (ZODB indexing/querying) into + PanGalaxian ---- DONE @@ -226,5 +228,5 @@ [+] one-many (aggregate attrs) -------------------------------------------------------------------------- -# $Id: TODO,v 1.51 2006/07/28 13:33:06 waterbug Exp $ +# $Id: TODO,v 1.52 2006/07/30 23:38:56 waterbug Exp $ Index: PanGalactic/pangalactic/core/pgefobject.py diff -u PanGalactic/pangalactic/core/pgefobject.py:1.51 PanGalactic/pangalactic/core/pgefobject.py:1.52 --- PanGalactic/pangalactic/core/pgefobject.py:1.51 Mon Jun 26 14:50:10 2006 +++ PanGalactic/pangalactic/core/pgefobject.py Sun Jul 30 19:38:56 2006 @@ -1,4 +1,4 @@ -# $Id: pgefobject.py,v 1.51 2006/06/26 18:50:10 waterbug Exp $ +# $Id: pgefobject.py,v 1.52 2006/07/30 23:38:56 waterbug Exp $ """ C{PgefObject} is the Python class that instantiates all PanGalactic "domain @@ -26,12 +26,12 @@ * validate themselves -Note that C{PgefObject} does not (yet) implement all of these -characteristics, but that is its ultimate goal. +Note that C{PgefObject} does not (yet) implement all of these characteristics, +but that is its ultimate goal. -@version: $Revision: 1.51 $ +@version: $Revision: 1.52 $ """ -__version__ = "$Revision: 1.51 $"[11:-2] +__version__ = "$Revision: 1.52 $"[11:-2] # Python from datetime import datetime Index: PanGalactic/pangalactic/node/gui/utils/display_maps.py diff -u PanGalactic/pangalactic/node/gui/utils/display_maps.py:1.3 PanGalactic/pangalactic/node/gui/utils/display_maps.py:1.4 --- PanGalactic/pangalactic/node/gui/utils/display_maps.py:1.3 Sat Jul 29 12:31:44 2006 +++ PanGalactic/pangalactic/node/gui/utils/display_maps.py Sun Jul 30 19:38:58 2006 @@ -1,4 +1,4 @@ -# $Id: display_maps.py,v 1.3 2006/07/29 16:31:44 waterbug Exp $ +# $Id: display_maps.py,v 1.4 2006/07/30 23:38:58 waterbug Exp $ """ Determines the default display characteristics (display names, sets of displayed Properties, ordering and grouping of Properties, etc.) of PGEF objects in tables @@ -8,238 +8,264 @@ C{PgefInterfaces} (i.e., the contents of L{pangalactic.node.uberorb.URB.interfaces}). """ -__version__ = "$Revision: 1.3 $"[11:-2] +__version__ = "$Revision: 1.4 $"[11:-2] # special attributes of Versionable, not editable directly -VERSION_CONTROLS = ['base_id', - 'iteration', - 'version', - 'version_sequence', - 'is_head'] +VERSION_PROPERTIES = ['base_id', + 'iteration', + 'version', + 'version_sequence', + 'is_head'] # default administrative group Properties -ADMIN_CONTROLS = ['oid', - 'security_mask', - 'record_owner', - 'record_creator', - 'record_create_datetime', - 'record_modifier', - 'record_mod_datetime', - 'owner', - 'creator', - 'create_datetime', - 'modifier', - 'mod_datetime'] +ADMIN_PROPERTIES = ['oid', + 'security_mask', + 'owner', + 'creator', + 'create_datetime', + 'modifier', + 'mod_datetime', + 'record_owner', + 'record_creator', + 'record_create_datetime', + 'record_modifier', + 'record_mod_datetime' + ] -# This is the only special case so far, where an Interface's main group -# requires "manual intervention" to split it into more manageable chunks. +# 'Organization' is the only special case so far, where an Interface's main +# group requires "manual intervention" to split it into more manageable chunks. # TODO: develop an algorithm to split an Interface's 'main' group logically if # it gets too big, so this kind of thing can be automated. -Organization_groups = {'admin': ['oid', - 'security_mask', - 'record_owner', - 'record_creator', - 'record_create_datetime', - 'record_modifier', - 'record_mod_datetime', - 'owner', - 'creator', - 'create_datetime', - 'modifier', - 'mod_datetime'], - 'main': ['id', - 'id_ns', - 'org_name_code', - 'name', - 'parent_organization', - 'description', - 'comment', - 'phone', - 'status_code', - 'type_code', - 'replacement_cage', - 'sic_code1', - 'sic_code2', - 'sic_code3', - 'sic_code4'], - 'address': [ - 'name1', - 'name2', - 'name3', - 'name4', - 'name5', - 'country_code', - 'street_address1', - 'street_address2', - 'city', - 'state_or_country', - 'zip_or_postal_zone']} - -# The default 'main' Property group for an object -- which will also serve as -# the default set of columns for its tabular display -- will include all of its -# Properties that do not appear in either the ADMIN_CONTROLS or VERSION_CONTROLS -# Property groups. - -def generateDisplayMap(iface): - """ - Generate the default display characteristics for a PanGalacticInterface -- - i.e., the display names, sets of displayed Properties, ordering and grouping - of Properties, etc.) of PGEF objects that implement the interface, in tables - (C{PanGalaxianObjectGrid}s) and as "naked objects" (C{PanGalaxianObject}s). - This function is intended to be used in the definition of 'display_map' as a - Python property of PgefObject. +SPECIAL_GROUPS = {'Organization' : + {'address': [ + 'name1', + 'name2', + 'name3', + 'name4', + 'name5', + 'country_code', + 'street_address1', + 'street_address2', + 'city', + 'state_or_country', + 'zip_or_postal_zone']}} - @param iface: a PGEF Interface - @type iface: L{zope.interface.Interface} - """ - +# Non-standard default display characteristics for some 'pgef' Properties, and +# 'order' -- the default sequence for lists of Properties or columns in tabular +# displays. +PROPERTY_DEFAULTS = { + 'display_names': { + 'create_datetime': 'Create Date-Time', + 'id': 'ID', + 'id_ns': 'ID Namespace', + 'mod_datetime': 'Last Mod Date-Time', + 'oid': 'OID', + 'record_create_datetime': 'Record Create Date-Time', + 'record_mod_datetime': 'Record Last Mod Date-Time', + 'org': 'Organization', + 'ref_designator': 'Reference Designator', + 'base_id': 'Base ID', + 'is_head': 'HEAD', + 'cm_authority': 'CM Auth', + 'publish_datetime': 'Published', + 'version_sequence': 'Ver. Seq.', + 'dataset_object_ids': 'Object IDs', + 'dataset_schema_id': 'DataSet Schema', + 'is_secured': 'Secured', + 'mime_type': 'MIME Type', + 'uri': 'URI', + 'org_email': 'Email', + 'org_phone': 'Phone', + 'name1': 'Name 1', + 'name2': 'Name 2', + 'name3': 'Name 3', + 'name4': 'Name 4', + 'name5': 'Name 5', + 'org_name_code': 'Organization Name Code', + 'replacement_cage': 'Replacement CAGE', + 'sic_code1': 'SIC Code 1', + 'sic_code2': 'SIC Code 2', + 'sic_code3': 'SIC Code 3', + 'sic_code4': 'SIC Code 4', + 'state_or_country': 'State or Country', + 'street_address1': 'Street Address 1', + 'street_address2': 'Street Address 2', + 'zip_or_postal_zone': 'Zip or Postal Zone', + 'fsc_code': 'FSC Code', + 'is_validated': 'Validated', + 'part_number_model': 'Model Number', + 'part_number_drawing': 'Drawing Number', + 'part_number_generic': 'Generic Part Number', + 'part_number_mfr': 'Manufacturer Part Number', + 'part_number_nsn': 'National Stock Number', + 'part_number_spec': 'Specification Part Number', + 'specification_military': 'Military Specification', + 'specification_screening': 'Screening Specification', + 'part_model_purpose': 'Purpose', + 'pl_items': 'Parts List Items', + 'pl_type': 'Type', + 'pl_status': 'PL Status', + 'status': 'Status', + 'is_validated': 'Validated', + 'pli_id': 'Item ID', + 'pli_component_usage': 'Parts', + 'fname': 'First Name', + 'god': 'god', + 'lname': 'Last Name', + 'mi_or_name': 'Middle Initial or Name', + 'lot_date_code': 'LDC', + 'part_mfr': 'Mfr', + 'part_vendor': 'Vendor', + 'serial_number': 'SN', + 'abbrev': 'Abbreviation', + 'base': 'Base Property', + 'default': 'Default Value', + 'inverse_functional': 'InverseFunctional', + 'max_cardinality': 'Maximum Cardinality', + 'min_cardinality': 'Minimum Cardinality', + 'ontology': 'Ontology', + 'component_quantity': 'Quantity', + 'is_composable': 'Composable', + 'is_generable': 'Generable', + 'rep_purpose': 'Representation Purpose'}, + 'display_styles': { + 'comment': 'narrative', + 'description': 'narrative', + 'abstract': 'narrative', + 'content': 'narrative' + }, + 'order': [ + 'oid', + 'id', + 'id_ns', + 'name', + 'description', + 'comment', + 'security_mask', + 'owner', + 'creator', + 'create_datetime', + 'modifier', + 'mod_datetime', + 'record_create_datetime', + 'record_creator', + 'record_mod_datetime', + 'record_modifier', + 'record_owner', + 'rep_purpose', + 'context', + 'email', + 'alt_emails', + 'files', + 'org', + 'phone', + 'child', + 'parent', + 'ref_designator', + 'abstract', + 'authorization', + 'is_composable', + 'is_generable', + 'is_object_source', + 'content', + 'content_mime_type', + 'datasets', + 'originating_system', + 'processor_version', + 'cm_authority', + 'publish_datetime', + 'representations', + 'structural_role', + 'dataset_object_ids', + 'dataset_schema_id', + 'bytes', + 'is_secured', + 'location', + 'mime_type', + 'file_role', + 'file_sequence', + 'file_sequence_context', + 'user_file_name', + 'media_subtype', + 'media_type', + 'definition_context', + 'frame_of_reference', + 'life_cycle_stage', + 'documentation_purpose', + 'includes', + 'classes', + 'uri', + 'org_email', + 'org_phone', + 'city', + 'country_code', + 'name1', + 'name2', + 'name3', + 'name4', + 'name5', + 'org_name_code', + 'parent_organization', + 'phone', + 'replacement_cage', + 'sic_code1', + 'sic_code2', + 'sic_code3', + 'sic_code4', + 'state_or_country', + 'status_code', + 'street_address1', + 'street_address2', + 'type_code', + 'zip_or_postal_zone', + 'fsc_code', + 'is_validated', + 'part_number_drawing', + 'part_number_generic', + 'part_number_mfr', + 'part_number_model', + 'part_number_nsn', + 'part_number_spec', + 'part_number_aliases', + 'specification', + 'specification_screening', + 'specification_military', + 'part_model_purpose', + 'pl_type', + 'status', + 'is_validated', + 'pli_id', + 'pli_component_usage', + 'lot_date_code', + 'part', + 'part_mfr', + 'part_vendor', + 'serial_number', + 'abbrev', + 'base', + 'default', + 'default_display', + 'default_style', + 'definition', + 'display_group', + 'display_name', + 'domain', + 'functional', + 'inverse_functional', + 'known_aliases', + 'max_cardinality', + 'min_cardinality', + 'ontology', + 'property_type', + 'range', + 'component_quantity', + 'ref_designator' + ] + } -COLUMN_MAPS = { - 'Actor': { - 'columns': ['id', - 'name', - 'fname', - 'mi_or_name', - 'lname']}, - 'Acu': { - 'columns': ['id', - 'name', - 'parent', - 'child', - 'ref_designator']}, - 'DataPackage': { - 'columns': ['id', - 'name', - 'version', - 'cm_authority', - 'publish_datetime']}, - 'DataSet': { - 'columns': ['id', - 'name', - 'version', - 'cm_authority', - 'publish_datetime']}, - 'Document': { - 'columns': ['id', - 'name', - 'version', - 'cm_authority', - 'publish_datetime']}, - 'FileLink': { - 'columns': ['id', - 'name', - 'file_role', - 'file_sequence', - 'file_sequence_context', - 'user_file_name', - 'bytes', - 'mime_type']}, - 'Mime': { - 'columns': ['id', 'name']}, - 'Model': { - 'columns': ['id', 'name', 'version', 'cm_authority']}, - 'ObjectDocument': { - 'columns': ['id', - 'name', - 'parent', - 'child', - 'documentation_purpose']}, - 'PanGalacticOntology': { - 'columns': ['id', - 'id_ns', - 'name', - 'version', - 'cm_authority', - 'uri']}, - 'OrgPerson': { - 'columns': ['id', 'name', 'parent', 'child']}, - 'Organization': { - 'columns': ['id', - 'name', - 'city', - 'state_or_country', - 'parent_organization']}, - 'Part': { - 'columns': ['id', - 'name', - 'version', - 'cm_authority', - 'part_number_spec', - 'part_number_generic', - 'fsc_code']}, - 'PartModel': { - 'columns': ['id', - 'name', - 'parent', - 'child', - 'part_model_purpose']}, - 'PartsList': { - 'columns': ['id', - 'name', - 'version', - 'cm_authority', - 'publish_datetime', - 'pl_type']}, - 'PartsListItem': { - 'columns': ['id', - 'name', - 'parent', - 'child']}, - 'Person': { - 'columns': ['id', - 'name', - 'fname', - 'mi_or_name', - 'lname']}, - 'PanGalacticObject': { - 'columns': ['id', 'name']}, - 'PhysicalObject': { - 'columns': ['id', 'name']}, - 'PhysicalPart': { - 'columns': ['id', - 'name', - 'part', - 'part_mfr']}, - 'Project': { - 'columns': ['id', 'name']}, - 'ProjectPerson': { - 'columns': ['id', - 'name', - 'parent', - 'child']}, - 'PanGalacticProperty': { - 'columns': ['id', - 'id_ns', - 'cm_authority', - 'domain', - 'range']}, - 'Qacu': { - 'columns': ['id', - 'name', - 'parent', - 'child', - 'component_quantity']}, - 'Relationship': { - 'columns': ['id', - 'name', - 'parent', - 'child']}, - 'RoleAssignment': { - 'columns': ['id', - 'name', - 'parent', - 'child']}, - 'Representation': { - 'columns': ['id', - 'name', - 'rep_purpose', - 'is_generable', - 'is_composable', - 'is_object_source']}, - 'Role': { - 'columns': ['id', 'name', 'context']} - } +# Everything from here on is legacy, superceded by the new method for defining +# default display maps (see uberorb), and will be removed soon. DISPLAY_MAPS = { 'Actor': { From waterbug at step.nasa.gov Mon Jul 31 02:21:10 2006 From: waterbug at step.nasa.gov (waterbug CVS) Date: Mon Jul 31 02:21:12 2006 Subject: [pangalactic-commits] Display map machinery working nice now ... Message-ID: <200607310621.k6V6LAdb030412@ned.gsfc.nasa.gov> Modified files: PanGalactic/pangalactic/node/uberorb.py 1.71 1.72 PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py 1.89 1.90 PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py 1.18 1.19 PanGalactic/pangalactic/node/gui/widgets/pgxnproperty.py 1.30 1.31 Log message: Display map machinery working nice now ... next: more DataType Properties -- we need floats!! Index: PanGalactic/pangalactic/node/uberorb.py diff -u PanGalactic/pangalactic/node/uberorb.py:1.71 PanGalactic/pangalactic/node/uberorb.py:1.72 --- PanGalactic/pangalactic/node/uberorb.py:1.71 Sun Jul 30 19:38:57 2006 +++ PanGalactic/pangalactic/node/uberorb.py Mon Jul 31 02:21:07 2006 @@ -1,11 +1,11 @@ -# $Id: uberorb.py,v 1.71 2006/07/30 23:38:57 waterbug Exp $ +# $Id: uberorb.py,v 1.72 2006/07/31 06:21:07 waterbug Exp $ # -*- test-case-name: pangalactic.test.test_uberorb -*- """ A PanGalaxian node's UberORB -@version: $Revision: 1.71 $ +@version: $Revision: 1.72 $ """ -__version__ = "$Revision: 1.71 $"[11:-2] +__version__ = "$Revision: 1.72 $"[11:-2] import codecs import mimetypes @@ -822,14 +822,9 @@ # TODO: should make 'projects', and any additional prefs, configurable for # applications (by the admin and/or developer) -# set the state's display maps, honoring any that are specified in the current -# state, otherwise using the default -default_display_maps = URB.getDefaultDisplayMaps() +# if the state's display maps haven't been set, use the defaults if not state.get('display_maps'): - state['display_maps'] = default_display_maps -else: - state['display_maps'] = default_display_maps.update(state['display_maps']) -display_maps = state['display_maps'] + state['display_maps'] = URB.getDefaultDisplayMaps() URB.version_controls = VERSION_PROPERTIES Index: PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py diff -u PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py:1.89 PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py:1.90 --- PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py:1.89 Fri Jul 28 09:33:07 2006 +++ PanGalactic/pangalactic/node/gui/widgets/pgxnobject.py Mon Jul 31 02:21:08 2006 @@ -1,10 +1,10 @@ -# $Id: pgxnobject.py,v 1.89 2006/07/28 13:33:07 waterbug Exp $ +# $Id: pgxnobject.py,v 1.90 2006/07/31 06:21:08 waterbug Exp $ """ PanGalaxianObject (a C{PgefObject} viewer/editor) -@version: $Revision: 1.89 $ +@version: $Revision: 1.90 $ """ -__version__ = "$Revision: 1.89 $"[11:-2] +__version__ = "$Revision: 1.90 $"[11:-2] from pprint import pprint @@ -25,7 +25,7 @@ from pangalactic.node.gui.widgets.pgxnproperty import PanGalaxianProperty from pangalactic.node.gui.widgets.pgxnproperty import PGXN_PROPERTY_CLASSES from pangalactic.node.images import toolkitimages, icons -from pangalactic.node.uberorb import state, prefs, display_maps +from pangalactic.node.uberorb import state, prefs from pangalactic.node.uberorb import URB from pangalactic.utils.identity import generateOid from pangalactic.utils.toolbox import isAString @@ -283,7 +283,7 @@ _icon = wx.EmptyIcon() _icon.CopyFromBitmap(toolkitimages.getPanGalacticon16Bitmap()) self.SetIcon(_icon) - self.groups = display_maps[self.obj._schema.__name__]['groups'] + self.groups = state['display_maps'][self.obj._schema.__name__]['groups'] print ' - groups are:' pprint(self.groups) self.notebook = PgxnPropertybook(self) Index: PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py diff -u PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py:1.18 PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py:1.19 --- PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py:1.18 Fri Jul 28 15:34:58 2006 +++ PanGalactic/pangalactic/node/gui/widgets/pgxnobjectgrid.py Mon Jul 31 02:21:08 2006 @@ -1,10 +1,10 @@ -# $Id: pgxnobjectgrid.py,v 1.18 2006/07/28 19:34:58 waterbug Exp $ +# $Id: pgxnobjectgrid.py,v 1.19 2006/07/31 06:21:08 waterbug Exp $ """ A table-based, late-bound, configurable object grid -@version: $Revision: 1.18 $ +@version: $Revision: 1.19 $ """ -__version__ = "$Revision: 1.18 $"[11:-2] +__version__ = "$Revision: 1.19 $"[11:-2] from pprint import pprint @@ -14,8 +14,7 @@ from pangalactic.node.images import toolkitimages from pangalactic.node.gui.widgets.pgxnobject import PanGalaxianObject -from pangalactic.node.gui.utils.display_maps import DISPLAY_MAPS -from pangalactic.node.uberorb import state, prefs, display_maps +from pangalactic.node.uberorb import state, prefs from pangalactic.node.uberorb import URB from pangalactic.utils.toolbox import curry @@ -28,7 +27,7 @@ def __init__(self, objs=None): """ - Initialize a PanGalaxianDataTable. + Initialize a PanGalaxianObjectTable. @param objs: a collection (set or list) of instances of L{pangalactic.core.pgefobject.PgefObject}. For now, the @@ -36,8 +35,17 @@ (C{Interface}). @type objs: C{list or Set} """ + print ' - in PanGalaxianObjectTable.__init__' gridlib.PyGridTableBase.__init__(self) self.objs = objs or [] + if self.objs: + # assumption that all objs have the same schema (see TODO) + self.schema = self.objs[0]._schema + else: + self.schema = URB.interfaces['PanGalacticObject'] + print ' self.schema:', self.schema.__name__ + self.schema_id = self.schema.__name__ + print ' self.schema_id:', self.schema_id self.setup() self._rows = self.GetNumberRows() self._cols = self.GetNumberCols() @@ -46,23 +54,12 @@ """ Generate column labels and data based on the current set of objects. """ - # print '- in PanGalaxianObjectTable.setup' + print ' - in PanGalaxianObjectTable.setup' if self.objs: self.row_labels = [str(i) for i in range(1, len(self.objs)+1)] - # assumption that all objs have the same schema (see TODO) - self.schema = self.objs[0]._schema - # print ' self.schema:', self.schema.__name__ - # if there is a current display_map set for the schema, use it - self.display_map = display_maps[self.schema.__name__] - # print ' - self.display_map:' - # pprint(self.display_map) - else: - self.schema = None - # if no objects, use default display_map for PanGalacticObject - self.display_map = DISPLAY_MAPS['PanGalacticObject'] - self.identifiers = self.display_map['columns'] - # print ' - self.identifiers:', self.identifiers - self.col_labels = dict([(id, display_maps['display_names'][id]) + self.identifiers = state['display_maps'][self.schema_id]['columns'] + print ' - self.identifiers:', self.identifiers + self.col_labels = dict([(id, state['display_maps']['display_names'][id]) for id in self.identifiers]) # print ' - self.col_labels:' # pprint(self.col_labels) @@ -134,12 +131,14 @@ grid = self.GetView() if grid: # adjust the current display_map in display_maps - oldmap = self.display_map['columns'][frm] - del self.display_map['columns'][frm] + oldmap = state['display_maps'][self.schema_id]['columns'][frm] + del state['display_maps'][self.schema_id]['columns'][frm] if to > frm: - self.display_map['columns'].insert(to-1, oldmap) + state['display_maps'][self.schema_id]['columns'].insert( + to-1, oldmap) else: - self.display_map['columns'].insert(to, oldmap) + state['display_maps'][self.schema_id]['columns'].insert( + to, oldmap) self.setup() self.ResetView(grid) @@ -355,13 +354,14 @@ self.grid_menu.AppendMenu(-1, 'Visible Columns', self.visible_cols_menu, 'Select columns to be visible in grid') - labels = [display_maps['display_names'][i] for i in self.schema] + labels = [state['display_maps']['display_names'][i] + for i in self.schema] labels.sort() - label_ids = dict([(display_maps['display_names'][i], i) + label_ids = dict([(state['display_maps']['display_names'][i], i) for i in self.schema]) # first, set checked menu items for visible columns for id in self.identifiers: - label = display_maps['display_names'][id] + label = state['display_maps']['display_names'][id] # print ' - adding checked label:', label labels.remove(label) item = self.visible_cols_menu.Append(-1, label, @@ -422,7 +422,7 @@ selection. """ # print ' - onSetVisibleCols' - properties = dict([(display_maps['display_names'][a], + properties = dict([(state['display_maps']['display_names'][a], self.schema[a]) for a in self.schema]) # print ' selection is:', dn @@ -430,12 +430,13 @@ # print ' adding it to visible cols' # add its column to the end (okay, might be better at the # beginning ... we'll see what people say) - display_maps[self.schema.__name__]['columns'].append(properties[dn].id) + state['display_maps'][self.schema.__name__]['columns'].append( + properties[dn].id) else: # print ' deleting it from visible cols' for name in [self.col_labels[i] for i in self.identifiers]: if dn == name: - display_maps[self.schema.__name__][ + state['display_maps'][self.schema.__name__][ 'columns'].remove(properties[dn].id) def onSaveAsPrefDisplaymap(self, evt): @@ -443,7 +444,7 @@ Save the current display_map as the user's preferred display_map for the current object schema. """ - prefs['display_maps'][self.schema.__name__] = display_maps[ + prefs['display_maps'][self.schema.__name__] = state['display_maps'][ self.schema.__name__] def onResetPerPrefDisplaymap(self, evt): @@ -454,8 +455,9 @@ # print ' - onResetPerPrefDisplaymap' if (prefs.get('display_maps') and prefs['display_maps'].get(self.schema.__name__)): - display_maps[self.schema.__name__] = prefs['display_maps'][ - self.schema.__name__] + state['display_maps'][ + self.schema.__name__] = prefs['display_maps'][ + self.schema.__name__] def onResetPerDefaultDisplaymap(self, evt): """ @@ -463,7 +465,9 @@ current object schema. """ # print ' - onResetPerDefaultDisplaymap' - display_maps[self.schema.__name__] = DISPLAY_MAPS[self.schema.__name__] + state['display_maps'][ + self.schema.__name__] = URB.getDefaultDisplayMap( + self.schema.__name__) def getObject(self, index): """ Index: PanGalactic/pangalactic/node/gui/widgets/pgxnproperty.py diff -u PanGalactic/pangalactic/node/gui/widgets/pgxnproperty.py:1.30 PanGalactic/pangalactic/node/gui/widgets/pgxnproperty.py:1.31 --- PanGalactic/pangalactic/node/gui/widgets/pgxnproperty.py:1.30 Sat Dec 24 23:17:48 2005 +++ PanGalactic/pangalactic/node/gui/widgets/pgxnproperty.py Mon Jul 31 02:21:08 2006 @@ -1,10 +1,10 @@ -# $Id: pgxnproperty.py,v 1.30 2005/12/25 04:17:48 waterbug Exp $ +# $Id: pgxnproperty.py,v 1.31 2006/07/31 06:21:08 waterbug Exp $ """ PanGalaxianProperty (the Mother of all PanGalaxian Property widgets) -@version: $Revision: 1.30 $ +@version: $Revision: 1.31 $ """ -__version__ = "$Revision: 1.30 $"[11:-2] +__version__ = "$Revision: 1.31 $"[11:-2] from pprint import pprint import inspect @@ -21,8 +21,7 @@ from wx.lib.intctrl import IntCtrl, EVT_INT # PanGalactic -from pangalactic.node.uberorb import URB -from pangalactic.node.uberorb import state, display_maps +from pangalactic.node.uberorb import URB, state from pangalactic.utils.datetimes import str2dt, dt2str from pangalactic.utils.toolbox import curry, isAString @@ -63,10 +62,12 @@ """ self.prop = prop self.obj = obj - self.button = wx.Button(parent, - label=display_maps['display_names'][prop.id]+':', - size=(200, -1), - style=wx.NO_BORDER|wx.BU_RIGHT) + self.button = wx.Button( + parent, + label=state['display_maps'][ + 'display_names'][prop.id]+':', + size=(200, -1), + style=wx.NO_BORDER|wx.BU_RIGHT) self.button.Bind(wx.EVT_BUTTON, self.onHelp, self.button) def onHelp(self, event): @@ -134,7 +135,7 @@ def _onPush(self, event): if not self.value: helptext = '%s is empty.' % ( - display_maps['display_names'][self.prop.id]) + state['display_maps']['display_names'][self.prop.id]) helpwin = wx.TipWindow(self, helptext, 250) else: if isAString(self.value): @@ -237,7 +238,8 @@ # parent should be a PanGalaxianProperty instance -- so the # Button's actual parent is the view widget's grandparent: the # PanGalaxianObject - label = ''.join(['[', display_maps['display_names'][prop.id], ']']) + label = ''.join(['[', state['display_maps'][ + 'display_names'][prop.id], ']']) wx.Button.__init__(self, parent, label=label, size=(250, -1), style=wx.NO_BORDER) self.obj = obj @@ -271,7 +273,7 @@ # initialize widget # TODO: make 'height' (instead of simply 'narrative') a parameter # of 'display_style' ... - if display_maps['display_styles'][prop.id] == 'narrative': + if state['display_maps']['display_styles'][prop.id] == 'narrative': height = 100 else: height = 20 @@ -629,7 +631,7 @@ def _onPush(self, event): if not self.value: helptext = '%s is empty.' % ( - display_maps['display_names'][self.prop.id]) + state['display_maps']['display_names'][self.prop.id]) helpwin = wx.TipWindow(self.widget, helptext, 250) else: self.popupObjectMenu() @@ -695,8 +697,8 @@ label = '[None]' else: label = ''.join(['[', - display_maps['display_names'][self.prop.id], - ']']) + state['display_maps']['display_names'][self.prop.id], + ']']) self.widget.SetLabel(label) if label == '[None]': self.widget.SetForegroundColour(wx.RED) @@ -750,8 +752,8 @@ label = '[None]' else: label = ''.join(['[', - display_maps['display_names'][self.prop.id], - ']']) + state['display_maps']['display_names'][self.prop.id], + ']']) self.widget.SetLabel(label) if label == '[None]': self.widget.SetForegroundColour(wx.RED)