protected void storeEntitities()

in taverna-prov/src/main/java/org/apache/taverna/prov/W3ProvenanceExport.java [547:615]


    protected void storeEntitities(String dataBindingId, Individual activity,
            Direction direction, boolean isTopLevel) throws IOException {

        Map<Port, T2Reference> bindings = provenanceAccess
                .getDataBindings(dataBindingId);

        for (Entry<Port, T2Reference> binding : bindings.entrySet()) {
            Port port = binding.getKey();
            T2Reference t2Ref = binding.getValue();

            Individual entity = describeEntity(t2Ref);

            if (isTopLevel) {
                Path ports;
                if (direction == Direction.INPUTS) {
                    ports = DataBundles.getInputs(bundle);
                } else {
                    ports = DataBundles.getOutputs(bundle);
                }
                Path portPath = DataBundles.getPort(ports, port.getPortName());
                saveValue(t2Ref, portPath);
            } else if (!seenReference(t2Ref)) {
                saveIntermediate(t2Ref);
            }

            // String id = t2Ref.getLocalPart();
            // String prefix = id.substring(0, 2);
            Individual involvement;
            if (direction == Direction.INPUTS) {
                involvement = provModel.setUsedInput(activity, entity);
            } else {
                involvement = provModel.setWasOutputFrom(entity, activity);
            }

            String processorName = null;
            if (port.getProcessorId() != null) {
                // Not a workflow port
                ProvenanceProcessor p = provenanceAccess
                        .getProvenanceProcessor(port.getProcessorId());
                processorName = p.getProcessorName();
            }
            URI portURI = URI.create(uriGenerator.makePortURI(
                    port.getWorkflowId(), processorName, port.getPortName(),
                    port.isInputPort()));

            Individual portRole;
            if (port.isInputPort()) {
                portRole = provModel.createInputParameter(portURI);
            } else {
                portRole = provModel.createOutputParameter(portURI);
            }

            portRole.setLabel(port.getPortName(), "");
            if (processorName == null) {
                portRole.setComment(
                        "Workflow"
                                + (port.isInputPort() ? " input " : " output ")
                                + port.getPortName(), EN);
            } else {
                portRole.setComment(
                        processorName
                                + (port.isInputPort() ? " input " : " output ")
                                + port.getPortName(), EN);
            }
            provModel.setDescribedByParameter(entity, portRole, involvement);

        }

    }