diff --git a/app/controllers/ElementController.java b/app/controllers/ElementController.java index f3952f74..c146825b 100644 --- a/app/controllers/ElementController.java +++ b/app/controllers/ElementController.java @@ -38,6 +38,10 @@ public class ElementController extends Controller { @Inject private Environment environment; + private static final boolean INLINE_JSON_LD_CONTEXT_DEFAULT = true; + private static final boolean INLINE_JSON_LD_CONTEXT = Optional.ofNullable(System.getenv("INLINE_JSON_LD_CONTEXT")) + .map(Boolean::parseBoolean).orElse(INLINE_JSON_LD_CONTEXT_DEFAULT); + public Result byId(String id) { UUID uuid = UUID.fromString(id); Optional element = elementService.getById(uuid); @@ -95,7 +99,7 @@ static JsonLdMofObjectAdornment adornMofObject(MofObject mof, Http.Request reque return new JsonLdMofObjectAdornment(mof, metamodelProvider, environment, String.format("http://%s", request.host()), String.format("/projects/%s/commits/%s/elements/", projectId, commitId), - false + INLINE_JSON_LD_CONTEXT ); } diff --git a/app/jackson/JsonLdMofObjectAdornment.java b/app/jackson/JsonLdMofObjectAdornment.java index 9a8de3df..ba23406a 100644 --- a/app/jackson/JsonLdMofObjectAdornment.java +++ b/app/jackson/JsonLdMofObjectAdornment.java @@ -40,7 +40,7 @@ public JsonLdMofObjectAdornment(MofObject mof, MetamodelProvider metamodelProvid if (!(cachedContext instanceof ObjectNode)) { throw new IllegalStateException("context expected to be an ObjectNode"); } - contextObjectNode.setAll((ObjectNode) cachedContext); + contextObjectNode.setAll((ObjectNode) cachedContext.get("@context")); } else { contextObjectNode.put("@import", URI.create(host).resolve(String.format("/jsonld/%s.jsonld", type)).toString()); diff --git a/build.sbt b/build.sbt index 67d36c9e..98c4656e 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ name := """SysML-v2-API-Services""" organization := "org.omg" -version := "2020-07-rc1" +version := "2020-07-rc2" javacOptions ++= Seq("-source", "11", "-target", "11", "-Xlint")