I know this doesn't get directly at your question, but I thought it might help. This is something I put together to create a bunch of product systems using only the default provider. You have to paste it into the python developer tool within openLCA. Once the product systems are created in openLCA, you can use the IPC to loop through all of your systems. The systems won't show up in the UI until you close and open the database again.
#Most of these imports are probably unnecessary now - leftover from a previous script
import csv
from org.openlca.app import App
from org.openlca.app.components import FileChooser, ModelSelectionDialog
from org.openlca.app.db import Cache
from org.openlca.core.math import CalculationSetup, CalculationType, SystemCalculator
from org.openlca.core.matrix import ProductSystemBuilder
from org.openlca.core.model import ModelType, ProductSystem
from org.openlca.core.model.descriptors import Descriptors
from org.openlca.core.database import ImpactMethodDao, ProcessDao, ProductSystemDao, BaseDao, Daos, ExchangeDao
from org.openlca.core.matrix import LinkingConfig
from org.openlca.core.database.derby import DerbyDatabase
from org.eclipse.swt.widgets import Display
from java.lang import Long
from java.util import UUID
from java.io import File
from org.openlca.app.util import UI, Dialog
from org.openlca.app import App
from org.openlca.core.matrix.cache import MatrixCache
from org.openlca.core.matrix.LinkingConfig import DefaultProviders
from org.openlca.core.model import ProcessType
#Apparently db is global variable - maybe it comes in with import App above.
processDao = ProcessDao(db)
systemDao = ProductSystemDao(db)
methodDao = ImpactMethodDao(db)
def run(process):
log.trace("You have entered run")
log.trace(str(process.name))
log.trace("Building system for " + process.name)
linkingConfig = LinkingConfig()
log.trace("Made a new linking config!")
#I set this up to use default providers only. Options are
#IGNORE, PREFER, and ONLY.
#If you select PREFER or IGNORE you probably need the
#next line (options are LCI_RESULT or UNIT_PROCESS):
#linkingConfig.preferredType = ProcessType.UNIT_PROCESS
linkingConfig.providerLinking = DefaultProviders.ONLY
log.trace("Made it default providers only!")
dasCache=MatrixCache.createLazy(db)
log.trace("Got MatrixCache")
builder = ProductSystemBuilder(dasCache,linkingConfig)
log.trace("Created Builder")
system = builder.build(process)
log.trace("Completed auto-building product system")
ProductSystemDao(db).insert(system)
log.trace("Inserted system into database!")
def main():
log.trace("Here we go")
processes = list(ModelSelectionDialog.multiSelect(ModelType.PROCESS))
log.trace("You selected some processes, maybe " + str(len(processes)) + "?")
if processes is None or len(processes) is 0:
log.trace("No processes selected")
return
for descriptor in processes:
log.trace("You have entered the for loop")
log.trace(str(type(descriptor)))
log.trace(str(descriptor.id))
try:
process = processDao.getForId(descriptor.id)
log.trace("process was assigned")
run(process)
except:
log.trace("Well something went wrong")
Display.getDefault().asyncExec(main)