Skip to content
Browse files

added namespace definitions and reworked Project class

  • Loading branch information...
nicholsn committed Mar 28, 2012
1 parent 0e6200b commit aacc17bc239733723562defc8aaf5d53e2c94906
Showing with 77 additions and 30 deletions.
  1. +36 −2 tools/pyxcede/
  2. +41 −28 tools/pyxcede/
@@ -39,5 +39,39 @@
# now that we have built up to hierarchy for a single project let's add it to the root XCEDE object
xcede = pyxcede.XCEDE(project=[projectA,])

# we can print out the project object to the terminal as xml by running this
# we can print out the project object to the terminal after adding a few namespaces
namespace = 'xmlns:prov="" '
namespace += 'xmlns:cu="" '
namespace += 'xmlns="" '
namespace += 'xmlns:xsi="" '
namespace += 'xsi:schemaLocation=" http://...xcede-2.1-core.xsd" '
namespace += 'xmlns:xcede2="" xcede2:version="version1"'

# and print it out
xcede.export(sys.stdout,0, namespacedef_= namespace)

<xcede2:XCEDE xmlns:prov="" xmlns:cu="" xmlns="" xmlns:xsi="" xsi:schemaLocation=" xcede-2.1.1-core.xsd" xmlns:xcede2="" xcede2:version="version1">
<xcede2:project termPath="" nomenclature="DOAP" abbreviation="proj-a" termID="Project" ID="projectA">
<xcede2:description>This is ProjectA</xcede2:description>
<xcede2:subjectGroup ID="groupA">
<xcede2:subjectGroup ID="groupB">
@@ -25,8 +25,7 @@

import xcede_bindings as supermod

class Project(object):
# This is a mess... need feedback. I should probably just subclass the project_t class rather than
class Project(supermod.XCEDE):
Project entity and associated setter/getter methods
The project entity can represent one or more projects, where each project consists of a
@@ -40,42 +39,56 @@ class Project(object):
Each level of the project hierarchy also has a set of attributes specific to the level
def __init__(self, ID=None, abbreviation=None, name=None, description=None, uri=None):
self.ID = ID
self.abbreviation = abbreviation = name
self.description = description
self.uri = uri
# create project level instances of the required datatypes
self._xcedeType = supermod.XCEDE()
def __init__(self, project=None):
super(Project, self).__init__(project)

# these are attributes from the INCF API for the Project entity
#self.ID = ID
#self.abbreviation = abbreviation = name
#self.description = description
#self.uri = uri
def get_project(self):
return self.project

def add_project(self, value):
value is a list of project_t instances

def insert_project(self, index, value):
index is an existing position in the project hierarchy, value is a project_t instance
self.project[index] = value

def delete_project(self, ID):
ID is the text of the projectID field
for i in range(len(self.project)):
if self.project[i].ID == ID:

def create_projectType(self):
self._projectType = supermod.project_t()

def create_projectInfoType(self):
self._projectInfoType = supermod.projectInfo_t()

def create_projectGroupListType(self):
self._subjectGroupListType = supermod.subjectGroupListType()

def create_subjectGroupType(self):
self._subjectGroupType = supermod.subjectGroup_t()

def set_ID(self,ID):
self.ID = self._projectType.get_ID()
def get_ID(self): return self.ID

def set_abbreviation(self,abbreviation): self._projectType.set_abbreviation(abbreviation)

def get_abbreviation(self): return self.abbreviation

def set_name(self):
def get_name(self):
def set_description(self):
def get_description(self):
def set_uri(self):
def get_uri(self):
self._resourceList = supermod.resourceListType()
self._resource = supermod.resource_t()
supermod.XCEDE.subclass = Project

etree_ = None
Verbose_import_ = False

0 comments on commit aacc17b

Please sign in to comment.
You can’t perform that action at this time.