danionita / e3tools

e3tool is a Java GUI-based tool for constructing and evaluating e3value models. Includes the e3fraud fraud assessment extension
Other
3 stars 4 forks source link

Ghost Element issue #92

Closed bobismijnnaam closed 7 years ago

bobismijnnaam commented 7 years ago

Try to repro the steps (create model, convert to fraud model, add actor, collude it, export to rdf, try to find rdf description without e3_has_name), but did not succeed (each elem had an e3_has_name). @danionita?

bobismijnnaam commented 7 years ago

The error was here (RDFExport.java, line 409-435):

                ValueInterface viInfo = (ValueInterface) value;
                res.addProperty(RDF.type, E3value.value_interface);

                Base parentValue = (Base) graph.getModel().getValue(graph.getModel().getParent(cell));

                if (parentValue instanceof Actor) {
                    Actor acInfo = (Actor) parentValue;

                    if (acInfo.colluded) {
                        res.addProperty(E3value.vi_assigned_to_ac, colludedResource);
                    } else {
                        Resource parentRes = getResource(parentValue.SUID);
                        res.addProperty(E3value.vi_assigned_to_ac, parentRes);
                    }
                } else {
                    Resource parentRes = getResource(parentValue.SUID);
                    if (parentValue instanceof MarketSegment) {
                        res.addProperty(E3value.vi_assigned_to_ms, parentRes);
                    } else if (parentValue instanceof ValueActivity) {
                        res.addProperty(E3value.vi_assigned_to_va, parentRes);
                    } else {
                        String msg = "A ValueInterface has a parent not of type Actor, MarketSegment, or ValueActivity. "
                                + "RDFupport for this is not implemented.";
                        error = Optional.of(msg);
                        System.err.println(msg);
                        return;
                    }
                }

Before the getResource(parentValue.SUID) call was made at the beginning of the snippet. Then, in case of collusion, the result of this call was replaced by colludedResource. This caused multiple nameless resources to be created. Now, getResource is only called when the actor is not colluding, which makes sure no nameless resources will be created.