Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
[Log
in](https://unlimited.ethz.ch/login.action?os_destination=%2Fdisplay%2FopenBISDoc2010%2FJython%2BMaster%2BData%2BScripts)
Linked Applications
Loading…
[](/)
- [Spaces](/spacedirectory/view.action "Spaces")
- [Create ](# "Create from template")
- Hit enter to search
- [Help](# "Help")
- [Online
Help](https://docs.atlassian.com/confluence/docs-82/ "Visit the Confluence documentation home")
- [Keyboard Shortcuts](# "View available keyboard shortcuts")
- [Feed
Builder](/dashboard/configurerssfeed.action "Create your custom RSS feed.")
- [What’s
new](https://confluence.atlassian.com/display/DOC/Confluence+8.2+Release+Notes)
- [Available Gadgets](# "Browse gadgets provided by Confluence")
- [About
Confluence](/aboutconfluencepage.action "Get more information about Confluence")
-
-
-
- [Log
in](/login.action?os_destination=%2Fdisplay%2FopenBISDoc2010%2FJython%2BMaster%2BData%2BScripts)
[](/display/openBISDoc2010/openBIS+Documentation+Rel.+20.10+Home "openBIS Documentation Rel. 20.10")
[openBIS Documentation Rel.
20.10](/display/openBISDoc2010/openBIS+Documentation+Rel.+20.10+Home "openBIS Documentation Rel. 20.10")
- [Pages](/collector/pages.action?key=openBISDoc2010)
- [Blog](/pages/viewrecentblogposts.action?key=openBISDoc2010)
### Page tree
[](/collector/pages.action?key=openBISDoc2010)
Browse pages
ConfigureSpace tools
[](#)
- [ ](#)
- [ Attachments (0)
](/pages/viewpageattachments.action?pageId=53746018 "View Attachments")
- [ Page History
](/pages/viewpreviousversions.action?pageId=53746018)
- [ Page Information ](/pages/viewinfo.action?pageId=53746018)
- [ Resolved comments ](#)
- [ View in Hierarchy
](/pages/reorderpages.action?key=openBISDoc2010&openId=53746018#selectedPageInHierarchy)
- [ View Source
](/plugins/viewsource/viewpagesrc.action?pageId=53746018)
- [ Export to PDF
](/spaces/flyingpdf/pdfpageexport.action?pageId=53746018)
- [ Export to Word ](/exportword?pageId=53746018)
- [ View Visio File
](/plugins/lucidchart/selectVisio.action?contentId=53746018)
- [ Copy
](/pages/copypage.action?idOfPageToCopy=53746018&spaceKey=openBISDoc2010)
1. [Pages](/collector/pages.action?key=openBISDoc2010)
2. **…**
3. [openBIS Documentation Rel. 20.10
Home](/display/openBISDoc2010/openBIS+Documentation+Rel.+20.10+Home)
4. [openBIS 20.10
Documentation](/display/openBISDoc2010/openBIS+20.10+Documentation)
5. [Guides](/display/openBISDoc2010/Guides)
- []( "Unrestricted")
- [Jira links]()
[Jython Master Data Scripts](/display/openBISDoc2010/Jython+Master+Data+Scripts)
--------------------------------------------------------------------------------
- Created by [Fuentes Serna Juan Mariano
(ID)](%20%20%20%20/display/~juanf%0A), last modified by [Kovtun
Viktor (ID)](%20%20%20%20/display/~vkovtun%0A) on [Mar 10,
2023](/pages/diffpagesbyversion.action?pageId=53746018&selectedPageVersions=1&selectedPageVersions=2 "Show changes")
Introduction
------------
openBIS defines as "Master data" all metadata configurations needed
before the import of the real raw data. Master data includes
experiment/sample/data set/property/file types, vocabularies and
property assignments.
### API Basics
Similarly to the [Jython Dropbox
API](/pages/viewpage.action?pageId=53746029) the script can access a
global variable named `service`, which can be used to create
transactions.
transaction = service.transaction()
The transactions are a focal API concept offering to create new types
(e.g. `createNewSampleType`, `createNewDataSetType`) and new property
assignments (e.g. `assignPropertyType`).
The complete Javadoc for the API is available at
[TABLE]
### Simple example
import ch.systemsx.cisd.openbis.generic.client.jython.api.v1.DataType as DataType
tr = service.transaction()
expType = tr.createNewExperimentType('EXPERIMENT-TYPE')
expType.setDescription('Experiment type description.')
sampleType = tr.createNewSampleType('SAMPLE-TYPE')
sampleType.setDescription('Sample type description.')
sampleType.setSubcodeUnique(True)
sampleType.setAutoGeneratedCode(True)
sampleType.setGeneratedCodePrefix("G_");
dataSetType = tr.createNewDataSetType('DATA-SET-TYPE')
dataSetType.setContainerType(True)
dataSetType.setDescription('Data set type description.')
materialType = tr.createNewMaterialType('MATERIAL-TYPE')
materialType.setDescription('Material type description.')
stringPropertyType = tr.createNewPropertyType('VARCHAR-PROPERTY-TYPE', DataType.VARCHAR)
stringPropertyType.setDescription('Varchar property type description.')
stringPropertyType.setLabel('STRING')
materialPropertyType = tr.createNewPropertyType('MATERIAL-PROPERTY-TYPE', DataType.MATERIAL)
materialPropertyType.setDescription('Material property type description.')
materialPropertyType.setLabel('MATERIAL')
materialPropertyType.setMaterialType(materialType)
materialPropertyType.setManagedInternally(False)
# assigns the newly created property 'MATERIAL-PROPERTY-TYPE'
# as a mandatory property for 'SAMPLE-TYPE'
materialAssignment = tr.assignPropertyType(sampleType, materialPropertyType)
materialAssignment.setMandatory(True)
# assigns the newly created property 'VARCHAR-PROPERTY-TYPE'
# as an optional property for 'EXPERIMENT-TYPE' with default value 'FOO_BAR'
stringAssignement = tr.assignPropertyType(expType, stringPropertyType)
stringAssignement.setMandatory(False)
stringAssignement.setDefaultValue('FOO_BAR')
### Command line tools
#### Executing master data scripts
Make sure openBIS AS is up and running prior script execution. Go to the
openBIS AS installation folder. Assuming your script is
`/local/master-data-script.py` and openBIS AS is started on the URL
` http://localhost:8888/openbis ` execute the command
> cd /local0/openbis/servers/openBIS-server/jetty/bin
> /register-master-data.sh -s http://localhost:8888/openbis/openbis -f /local/master-data-script.py
You will be prompted for username/password before the script execution.
Please note that the second 'openbis' is needed in the server address,
so that you connect via the API.
#### Exporting master data
You can export the master data from a running openBIS system as script
by running the command
> cd /local0/openbis/servers/openBIS-server/jetty/bin
> /export-master-data.sh -s http://localhost:8888/openbis/openbis
This command will create a folder `exported-master-data-DATE` which will
contain the exported master data script - `master-data.py`
- No labels
Overview
Content Tools
Apps
- Powered by [Atlassian
Confluence](https://www.atlassian.com/software/confluence) 8.2.0
- Printed by Atlassian Confluence 8.2.0
- [Report a bug](https://support.atlassian.com/confluence-server/)
- [Atlassian News](https://www.atlassian.com/company)
[Atlassian](https://www.atlassian.com/)
{"serverDuration": 132, "requestCorrelationId": "dd6427c828fba420"}