Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] InterpreterUtil.areIsomorphic(graph1, graph2) not working

Dear Christian,

Thank you very much for your reply.

EcoreUtil.equals(..,..) also returns false for my models, although I compare a model file with it's own copy, so they are actually the same models. (Attached you can find an example model)

Here is the code that I use for loading and comparing the resources: (you can find some more explanations below)

    protected boolean matchProtocols(FSMProtocol requestedModel, FSMProtocol providedModel) {

        ResourceSet resourceSet = new ResourceSetImpl();

        //requested resource
        String tempRqstFilePath = requestedModel.eResource().getURI().trimSegments(1).toString() + "/tempRequested";
        Resource requestedResource = resourceSet.createResource(URI.createPlatformResourceURI(tempRqstFilePath, true));
        requestedResource.getContents().add(requestedModel);

        //provided resource
        String tempPrvdFilePath = providedModel.eResource().getURI().trimSegments(1).toString() + "/tempProvided";
        Resource providedResource = resourceSet.createResource(URI.createPlatformResourceURI(tempPrvdFilePath, true));
        providedResource.getContents().add(providedModel);
       
       
        EGraph rqstGraph = new EGraphImpl(requestedResource);
        EGraph prvdGraph = new EGraphImpl(providedResource);
       
        boolean matchingResult = InterpreterUtil.areIsomorphic(rqstGraph, prvdGraph);
        return matchingResult;

    }
  • Our models represent simple Finite State Machines.
  • FSMProtocol is the type of our models.
  • For creating a ResourceSet, here I have used the normal EMF mechanism, but I also have tried it with HenshinResourceSet, and the specific Resource Factory of our mode.
  • For comparing the models, I have tried the followings:
    • Creating EGraph, using the Reources (as above), and comparing the graphs,
    • Also, comparing the resources directly, without creating a graph.
  • Till now, the method InterpreterUtil.areIsomorphic(..., ...) have returned true, only in the case that I add empty models to the graphs.  >>> EGraph graph = new EGraphImpl(); graph.add(emptyModel);  <<<<

Thank you very much in advance for any help.

Best regards,

Faezeh




2014-03-19 19:02 GMT+01:00 Christian Krause <henshin.ck@xxxxxxxxx>:
Dear Faezeh,

I would need more information to find out what the problem is. Could you maybe provide the example models? Maybe also the code that you use for comparing them with Henshin?

What you can try out is whether EcoreUtil.equals(..,..) also returns false. In general, if EcoreUtil.equals() returns true, then InterpreterUtil.areIsomorphic() should also return true (but not necessarily in the opposite direction).

Cheers,
Christian 


2014-03-19 15:44 GMT+01:00 Faezeh Ghassemi <faezeh.ghassemi@xxxxxxxxx>:
Dear Henshin developers,

I am trying to use the method InterpreterUtil.areIsomorphic(graph1, graph2) for two models which I have previously created with EMF.

I load the models in two different resources, using EMF mechanism, and afterwards I transform the models into the Henshin format (EGraph), and then I compare them using the method areIsomorphic. But it returns false,
although the model files are exactly identical!

I would appreciate any help or guide in model comparison using Henshin :)

Best regards,
Faezeh Ghassemi

_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev


Attachment: universityManagement.sse_proto
Description: Binary data


Back to the top