2

I already found the resolveLocation() function to convert a logical location to a physical location. Does there also exist a function to convert a physical location to a logical location?

In that case, a location with for example "|project://...", would resolve in "|java+class:///...". I would then be able to use it in the readFileLines() function.

1 Answers1

1

You can look up the mapping in both directions in the m3 model with the .declarations field:

data M3(
    rel[loc name, loc src] declarations ...

To look up physical from logical:

mymodel.declarations[logicalURI]

A reverse lookup requires you to invert the relation first

mymodel.decls<src, name>[physicalURI]

By the way, if your m3 model is "registered" the readFile functions will do the resolution for you and just work on any URi. Registration happens by default as a side effect from the createM3FromEclipseProject function.

Jurgen Vinju
  • 6,393
  • 1
  • 15
  • 26