diff --git a/docs/use/rosetta/index.md b/docs/use/rosetta/index.md index 68d231ed..87314611 100644 --- a/docs/use/rosetta/index.md +++ b/docs/use/rosetta/index.md @@ -63,6 +63,15 @@ $ ./enola rosetta --no-file-loader --in test/picasso.ttl --out "docs/BUILT/picas ![Smaller Graph of Painters](../../BUILT/picasso-small.gv.svg) +### Graph Commons + +```bash cd ../.././.. +$ ./enola rosetta --in enola:TikaMediaTypes --out /tmp/TikaMediaTypes.graphcommons.json +... +``` + +produces a JSON which can be imported into [GraphCommons.com](https://graphcommons.com/). + ### GEXF ```bash cd ../.././.. diff --git a/java/dev/enola/cli/CommandWithIRI.java b/java/dev/enola/cli/CommandWithIRI.java index af6b5f0d..ab0c32e8 100644 --- a/java/dev/enola/cli/CommandWithIRI.java +++ b/java/dev/enola/cli/CommandWithIRI.java @@ -30,6 +30,7 @@ import dev.enola.core.view.EnolaMessages; import dev.enola.rdf.io.RdfWriterConverter; import dev.enola.rdf.proto.ProtoThingRdfConverter; +import dev.enola.thing.gen.graphcommons.GraphCommonsJsonGenerator; import dev.enola.thing.gen.graphviz.GraphvizGenerator; import dev.enola.thing.message.ProtoThings; import dev.enola.thing.metadata.ThingMetadataProvider; @@ -108,6 +109,12 @@ protected void write(Message thing) throws IOException { return; } + if (Format.GraphCommons.equals(format) && thing instanceof Things protoThings) { + var javaThings = ProtoThings.proto2java(protoThings.getThingsList()); + new GraphCommonsJsonGenerator().convertIntoOrThrow(javaThings, resource); + return; + } + // Otherwise new ProtoIO(typeRegistryWrapper.get()).write(thing, resource); } diff --git a/java/dev/enola/cli/Configuration.java b/java/dev/enola/cli/Configuration.java index 52983230..06e53cc3 100644 --- a/java/dev/enola/cli/Configuration.java +++ b/java/dev/enola/cli/Configuration.java @@ -29,6 +29,7 @@ import dev.enola.rdf.io.RdfMediaTypeYamlLd; import dev.enola.rdf.io.RdfMediaTypes; import dev.enola.thing.gen.gexf.GexfMediaType; +import dev.enola.thing.gen.graphcommons.GraphCommonsMediaType; import dev.enola.thing.gen.graphviz.GraphvizMediaType; import dev.enola.thing.io.ThingMediaTypes; @@ -46,6 +47,7 @@ class Configuration { new MarkdownMediaTypes(), new GraphvizMediaType(), new GexfMediaType(), + new GraphCommonsMediaType(), new DatalogMediaTypes(), new StandardMediaTypes(), new YamlMediaType(), diff --git a/java/dev/enola/cli/Format.java b/java/dev/enola/cli/Format.java index f7b523d2..3cb7e0a3 100644 --- a/java/dev/enola/cli/Format.java +++ b/java/dev/enola/cli/Format.java @@ -21,6 +21,7 @@ import dev.enola.common.protobuf.ProtobufMediaTypes; import dev.enola.rdf.io.RdfMediaTypes; +import dev.enola.thing.gen.graphcommons.GraphCommonsMediaType; import dev.enola.thing.gen.graphviz.GraphvizMediaType; public enum Format { @@ -30,6 +31,8 @@ public enum Format { Graphviz, + GraphCommons, + TextProto, ProtoYAML, @@ -43,6 +46,7 @@ MediaType toMediaType() { case Turtle -> RdfMediaTypes.TURTLE; case JSONLD -> RdfMediaTypes.JSON_LD; case Graphviz -> GraphvizMediaType.GV; + case GraphCommons -> GraphCommonsMediaType.GCJSON; case TextProto -> ProtobufMediaTypes.PROTOBUF_TEXTPROTO_UTF_8; case ProtoYAML -> ProtobufMediaTypes.PROTOBUF_YAML_UTF_8; diff --git a/java/dev/enola/common/context/Singleton.java b/java/dev/enola/common/context/Singleton.java index 7310713c..7a3c058e 100644 --- a/java/dev/enola/common/context/Singleton.java +++ b/java/dev/enola/common/context/Singleton.java @@ -56,7 +56,9 @@ public Singleton set(T value) { @Override public T get() { - if (value == null) throw new IllegalStateException(); + if (value == null) + throw new IllegalStateException( + getClass() + " was never set(); use SingletonRule in tests"); else return value; } diff --git a/java/dev/enola/common/io/resource/MediaTypeDetector.java b/java/dev/enola/common/io/resource/MediaTypeDetector.java index 14c1e5cb..2cc0b65d 100644 --- a/java/dev/enola/common/io/resource/MediaTypeDetector.java +++ b/java/dev/enola/common/io/resource/MediaTypeDetector.java @@ -58,7 +58,12 @@ class MediaTypeDetector { private static final Set TRY_FIXING = ImmutableSet.of( // raw.githubusercontent.com returns "text/plain" e.g. for *.yaml - MediaType.parse("text/plain")); + MediaType.parse("text/plain"), + // URLConnection assumes "application/json" for all *.json but we want "longest + // match" e.g. for ".graphcommons.json" + MediaType.parse("application/json"), + // URLConnection assumes "application/xml" instead of GexfMediaType + MediaType.parse("application/xml")); private static boolean isSpecial(MediaType mediaType) { var mediaTypeWithoutParameters = mediaType.withoutParameters(); diff --git a/java/dev/enola/common/io/resource/MemoryResourceTest.java b/java/dev/enola/common/io/resource/MemoryResourceTest.java index 140fdd14..cda55eb3 100644 --- a/java/dev/enola/common/io/resource/MemoryResourceTest.java +++ b/java/dev/enola/common/io/resource/MemoryResourceTest.java @@ -26,6 +26,7 @@ import dev.enola.common.context.testlib.SingletonRule; import dev.enola.common.io.mediatype.MediaTypeProviders; +import dev.enola.common.io.mediatype.YamlMediaType; import org.junit.Rule; import org.junit.Test; @@ -35,14 +36,15 @@ public class MemoryResourceTest { - public @Rule SingletonRule r = $(MediaTypeProviders.set()); + // The new YamlMediaType() is required for non-regression of the funkyYamlURL below + public @Rule SingletonRule r = $(MediaTypeProviders.set(new YamlMediaType())); private static final byte[] BYTES = new byte[] {1, 2, 3}; private static final String TEXT = "hello, world"; @Test public void testBinaryMemoryResource() throws IOException { - MemoryResource resource = new MemoryResource(OCTET_STREAM); + var resource = new MemoryResource(OCTET_STREAM); resource.byteSink().write(BYTES); assertThat(resource.byteSource().read()).isEqualTo(BYTES); @@ -52,16 +54,23 @@ public void testBinaryMemoryResource() throws IOException { @Test public void testTextMemoryResource() throws IOException { - MemoryResource resource = new MemoryResource(PLAIN_TEXT_UTF_8); + var resource = new MemoryResource(PLAIN_TEXT_UTF_8); resource.charSink().write(TEXT); assertThat(resource.charSource().read()).isEqualTo(TEXT); } @Test - public void testMediaTypePrecedence() throws IOException { - // This does not work for PLAIN_TEXT_UTF_8, because that's "special" + public void testMediaTypePrecedenceHTML_GZIP() { + // TODO Fix to also make this work for PLAIN_TEXT_UTF_8, which is "special" // (It's one of a few MediaTypes which MediaTypeDetector always overrides) - MemoryResource resource = new MemoryResource(URI.create("test.html"), GZIP); + var resource = new MemoryResource(URI.create("test.html"), GZIP); assertThat(resource.mediaType()).isEqualTo(GZIP); } + + @Test + public void testMediaTypePrecedenceYAML_JSON() { + var funkyYamlURL = "classpath:/picasso.yaml?context=classpath:/picasso-context.jsonld"; + var resource = new MemoryResource(URI.create(funkyYamlURL), JSON_UTF_8); + assertThat(resource.mediaType()).isEqualTo(JSON_UTF_8); + } } diff --git a/java/dev/enola/common/io/resource/ResourceProvider.java b/java/dev/enola/common/io/resource/ResourceProvider.java index 2610d77f..1b5fe4d1 100644 --- a/java/dev/enola/common/io/resource/ResourceProvider.java +++ b/java/dev/enola/common/io/resource/ResourceProvider.java @@ -36,6 +36,8 @@ */ public interface ResourceProvider extends ProviderFromIRI { + // TODO Rename all parameters from iri or uri to url - because that's what these are! + // TODO Change all @Nullable Resource to Optional... or, better, throw exception for // unknown schema diff --git a/java/dev/enola/core/rosetta/Rosetta.java b/java/dev/enola/core/rosetta/Rosetta.java index a6534818..af97b76c 100644 --- a/java/dev/enola/core/rosetta/Rosetta.java +++ b/java/dev/enola/core/rosetta/Rosetta.java @@ -38,6 +38,7 @@ import dev.enola.rdf.io.RdfResourceConverter; import dev.enola.thing.gen.gexf.GexfGenerator; import dev.enola.thing.gen.gexf.GexfResourceConverter; +import dev.enola.thing.gen.graphcommons.GraphCommonsResourceConverter; import dev.enola.thing.gen.graphviz.GraphvizGenerator; import dev.enola.thing.gen.graphviz.GraphvizResourceConverter; import dev.enola.thing.io.Loader; @@ -103,6 +104,7 @@ public Rosetta(ResourceProvider rp, Loader loader) { new YamlJsonResourceConverter(), new GraphvizResourceConverter(loader, new GraphvizGenerator(tmp)), new GexfResourceConverter(loader, new GexfGenerator(tmp)), + new GraphCommonsResourceConverter(loader), new XmlResourceConverter(rp), new CharResourceConverter())); // NOT new IdempotentCopyingResourceNonConverter() diff --git a/java/dev/enola/core/rosetta/RosettaTest.java b/java/dev/enola/core/rosetta/RosettaTest.java index 6b7e9dc2..86688f31 100644 --- a/java/dev/enola/core/rosetta/RosettaTest.java +++ b/java/dev/enola/core/rosetta/RosettaTest.java @@ -35,10 +35,7 @@ import dev.enola.common.io.iri.namespace.NamespaceRepositoryEnolaDefaults; import dev.enola.common.io.mediatype.MediaTypeProviders; import dev.enola.common.io.mediatype.YamlMediaType; -import dev.enola.common.io.resource.ClasspathResource; -import dev.enola.common.io.resource.MemoryResource; -import dev.enola.common.io.resource.ResourceProvider; -import dev.enola.common.io.resource.StringResource; +import dev.enola.common.io.resource.*; import dev.enola.common.xml.XmlMediaType; import dev.enola.common.yamljson.JSON; import dev.enola.common.yamljson.YAML; @@ -46,6 +43,7 @@ import dev.enola.rdf.io.RdfMediaTypes; import dev.enola.thing.Thing; import dev.enola.thing.gen.gexf.GexfMediaType; +import dev.enola.thing.gen.graphcommons.GraphCommonsMediaType; import dev.enola.thing.gen.graphviz.GraphvizMediaType; import dev.enola.thing.impl.ImmutableThing; import dev.enola.thing.io.ThingMediaTypes; @@ -57,6 +55,7 @@ import org.junit.Test; import org.junit.rules.TestRule; +import java.io.IOException; import java.nio.charset.StandardCharsets; public class RosettaTest { @@ -72,6 +71,7 @@ public class RosettaTest { MediaTypeProviders.set( new RdfMediaTypes(), new GraphvizMediaType(), + new GraphCommonsMediaType(), new GexfMediaType(), new YamlMediaType(), new XmlMediaType())); @@ -186,7 +186,7 @@ public void testXMLToTurtle() throws Exception { } @Test - public void testGraphvizAndGexf() throws Exception { + public void testGexfAndGraphvizAndGraphCommons() throws Exception { var in = rp.get("classpath:/graph.ttl"); try (var ctx = TLC.open()) { // This tests that StackedThingProvider in GraphvizGenerator works; @@ -200,18 +200,32 @@ public void testGraphvizAndGexf() throws Exception { var namespaceConverter = new NamespaceConverterWithRepository(namespaceRepo); ctx.push(NamespaceConverter.class, namespaceConverter); + // TODO GexfMediaTypeTest: checkRosettaConvert(in, "classpath:/graph.expected.gexf"); var gexf = new MemoryResource(GexfMediaType.GEXF); rosetta.convertInto(in, gexf); assertThat(gexf) .hasCharsEqualTo(rp.get("classpath:/graph.expected.gexf?charset=UTF-8")); + // TODO checkRosettaConvert(in, "classpath:/graph.expected-full.gv?" + + // OUT_URI_QUERY_PARAMETER_FULL + "=true"); var gv = new MemoryResource(GV, OUT_URI_QUERY_PARAMETER_FULL + "=true"); rosetta.convertInto(in, gv); assertThat(gv).hasCharsEqualTo(rp.get("classpath:/graph.expected-full.gv")); + // TODO checkRosettaConvert(in, "classpath:/graph.expected-full.gv?" + // + OUT_URI_QUERY_PARAMETER_FULL + "=false"); gv = new MemoryResource(GV, OUT_URI_QUERY_PARAMETER_FULL + "=false"); rosetta.convertInto(in, gv); assertThat(gv).hasCharsEqualTo(rp.get("classpath:/graph.expected-short.gv")); + + checkRosettaConvert(in, "classpath:/graph.expected.graphcommons.json"); } } + + void checkRosettaConvert(ReadableResource in, String expectedURL) throws IOException { + var expected = rp.get(expectedURL); + var actual = new MemoryResource(expected.mediaType()); + rosetta.convertInto(in, actual); + assertThat(actual).hasCharsEqualTo(expected); + } } diff --git a/java/dev/enola/thing/gen/BUILD b/java/dev/enola/thing/gen/BUILD index 93007030..0b5f5fab 100644 --- a/java/dev/enola/thing/gen/BUILD +++ b/java/dev/enola/thing/gen/BUILD @@ -49,6 +49,7 @@ java_library( "@maven//:com_google_auto_service_auto_service_annotations", "@maven//:com_google_errorprone_error_prone_annotations", "@maven//:com_google_errorprone_error_prone_type_annotations", + "@maven//:com_google_code_gson_gson", "@maven//:com_google_guava_guava", "@maven//:org_jspecify_jspecify", "@maven//:org_slf4j_slf4j_api", @@ -70,6 +71,7 @@ junit_tests( "//java/dev/enola/common/context/testlib", "//java/dev/enola/common/io", "//java/dev/enola/common/io/testlib", + "//java/dev/enola/common/xml", "//java/dev/enola/datatype", "//java/dev/enola/model", "//java/dev/enola/rdf/io", diff --git a/java/dev/enola/thing/gen/gexf/GexfMediaTypeTest.java b/java/dev/enola/thing/gen/gexf/GexfMediaTypeTest.java new file mode 100644 index 00000000..ab2c45b9 --- /dev/null +++ b/java/dev/enola/thing/gen/gexf/GexfMediaTypeTest.java @@ -0,0 +1,47 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright 2024 The Enola Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package dev.enola.thing.gen.gexf; + +import static com.google.common.truth.Truth.assertThat; + +import static dev.enola.common.context.testlib.SingletonRule.$; + +import dev.enola.common.context.testlib.SingletonRule; +import dev.enola.common.io.mediatype.MediaTypeProviders; +import dev.enola.common.io.resource.ClasspathResource; +import dev.enola.common.xml.XmlMediaType; + +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; + +public class GexfMediaTypeTest { + + @Rule + public SingletonRule r = $(MediaTypeProviders.set(new GexfMediaType(), new XmlMediaType())); + + @Test + @Ignore // TODO Figure out why this doesn't work (but only IFF XmlMediaType is present) + public void gexfMediaType() { + var r = new ClasspathResource.Provider().get("classpath:/graph.expected.gexf"); + assertThat(r.mediaType()).isEqualTo(GexfMediaType.GEXF); + } + + @Test + public void TODO_empty() {} +} diff --git a/java/dev/enola/thing/gen/graphcommons/GraphCommonsJsonGenerator.java b/java/dev/enola/thing/gen/graphcommons/GraphCommonsJsonGenerator.java new file mode 100644 index 00000000..ffae6eb9 --- /dev/null +++ b/java/dev/enola/thing/gen/graphcommons/GraphCommonsJsonGenerator.java @@ -0,0 +1,73 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright 2024 The Enola Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package dev.enola.thing.gen.graphcommons; + +import static com.google.gson.FormattingStyle.PRETTY; +import static com.google.gson.Strictness.STRICT; + +import com.google.common.io.CharStreams; +import com.google.gson.stream.JsonWriter; + +import dev.enola.common.context.TLC; +import dev.enola.common.convert.ConversionException; +import dev.enola.thing.Thing; +import dev.enola.thing.gen.ThingsIntoAppendableConverter; +import dev.enola.thing.repo.StackedThingProvider; +import dev.enola.thing.repo.ThingProvider; + +import java.io.IOException; + +/** Generator of JSON Format used by Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package dev.enola.thing.gen.graphcommons; + +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; +import com.google.common.net.MediaType; + +import dev.enola.common.io.mediatype.MediaTypeProvider; + +import java.nio.charset.StandardCharsets; + +public class GraphCommonsMediaType implements MediaTypeProvider { + + public static final MediaType GCJSON = + MediaType.create("text", "vnd.enola.graphcommons+json") + .withCharset(StandardCharsets.UTF_8); + + @Override + public Multimap extensionsToTypes() { + return ImmutableMultimap.of(".graphcommons.json", GCJSON); + } +} diff --git a/java/dev/enola/thing/gen/graphcommons/GraphCommonsMediaTypeTest.java b/java/dev/enola/thing/gen/graphcommons/GraphCommonsMediaTypeTest.java new file mode 100644 index 00000000..913ccade --- /dev/null +++ b/java/dev/enola/thing/gen/graphcommons/GraphCommonsMediaTypeTest.java @@ -0,0 +1,39 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright 2024 The Enola Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package dev.enola.thing.gen.graphcommons; + +import static com.google.common.truth.Truth.assertThat; + +import static dev.enola.common.context.testlib.SingletonRule.$; + +import dev.enola.common.context.testlib.SingletonRule; +import dev.enola.common.io.mediatype.MediaTypeProviders; +import dev.enola.common.io.resource.ClasspathResource; + +import org.junit.Rule; +import org.junit.Test; + +public class GraphCommonsMediaTypeTest { + @Rule public SingletonRule r = $(MediaTypeProviders.set(new GraphCommonsMediaType())); + + @Test + public void graphCommonsMediaType() { + var r = new ClasspathResource.Provider().get("classpath:/graph.expected.graphcommons.json"); + assertThat(r.mediaType()).isEqualTo(GraphCommonsMediaType.GCJSON); + } +} diff --git a/java/dev/enola/thing/gen/graphcommons/GraphCommonsResourceConverter.java b/java/dev/enola/thing/gen/graphcommons/GraphCommonsResourceConverter.java new file mode 100644 index 00000000..fe74afdb --- /dev/null +++ b/java/dev/enola/thing/gen/graphcommons/GraphCommonsResourceConverter.java @@ -0,0 +1,45 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright 2024 The Enola Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package dev.enola.thing.gen.graphcommons; + +import dev.enola.common.io.mediatype.MediaTypes; +import dev.enola.common.io.resource.ReadableResource; +import dev.enola.common.io.resource.WritableResource; +import dev.enola.common.io.resource.convert.CatchingResourceConverter; +import dev.enola.thing.io.Loader; + +public class GraphCommonsResourceConverter implements CatchingResourceConverter { + + private final GraphCommonsJsonGenerator graphcommons = new GraphCommonsJsonGenerator(); + private final Loader loader; + + public GraphCommonsResourceConverter(Loader loader) { + this.loader = loader; + } + + @Override + public boolean convertIntoThrows(ReadableResource from, WritableResource into) + throws Exception { + if (!MediaTypes.normalizedNoParamsEquals(into.mediaType(), GraphCommonsMediaType.GCJSON)) + return false; + + var things = loader.loadAtLeastOneThing(from.uri()); + graphcommons.convertIntoOrThrow(things, into); + return true; + } +} diff --git a/java/dev/enola/thing/gen/graphviz/GraphvizGenerator.java b/java/dev/enola/thing/gen/graphviz/GraphvizGenerator.java index ef788c7c..43266570 100644 --- a/java/dev/enola/thing/gen/graphviz/GraphvizGenerator.java +++ b/java/dev/enola/thing/gen/graphviz/GraphvizGenerator.java @@ -87,21 +87,21 @@ public boolean convertInto(Iterable from, Appendable out) ctx.push(ThingProvider.class, new StackedThingProvider(from)); for (Thing thing : from) { thingIRIs.add(thing.iri()); - printFullThing(thing, out, thingIRIs, linkIRIs); + printThing(thing, out, thingIRIs, linkIRIs); } // Remove links to all things which were processed after we processed them linkIRIs.removeAll(thingIRIs); // linkIRIs now contains things which were linked to but that have no properties for (String orphanIRI : linkIRIs) { var orphanThing = new OnlyIRIThing(orphanIRI); - printFullThing(orphanThing, out, thingIRIs, linkIRIs); + printThing(orphanThing, out, thingIRIs, linkIRIs); } } out.append("}\n"); return true; } - private void printFullThing( + private void printThing( Thing thing, Appendable out, Set thingIRIs, Set linkIRIs) throws IOException { boolean full = TLC.optional(Flags.FULL).orElse(false); diff --git a/java/dev/enola/thing/io/ThingMediaTypes.java b/java/dev/enola/thing/io/ThingMediaTypes.java index 5b676a01..3366685a 100644 --- a/java/dev/enola/thing/io/ThingMediaTypes.java +++ b/java/dev/enola/thing/io/ThingMediaTypes.java @@ -34,6 +34,8 @@ public class ThingMediaTypes implements MediaTypeProvider { + // TODO Use vnd.enola.* like e.g. in GraphCommonsMediaType (for consistency) + public static final MediaType THING_TEXTPROTO_UTF_8 = ProtobufMediaTypes.setProtoMessageFQN( ProtobufMediaTypes.PROTOBUF_TEXTPROTO_UTF_8, diff --git a/test/graph.expected.graphcommons.json b/test/graph.expected.graphcommons.json new file mode 100644 index 00000000..9d48e907 --- /dev/null +++ b/test/graph.expected.graphcommons.json @@ -0,0 +1,26 @@ +{ + "edgeTypes": [], + "edges": [], + "name": "Enola.dev", + "nodeTypes": [], + "nodes": [ + { + "id": "http://www.w3.org/2000/01/rdf-schema#Class" + }, + { + "id": "https://example.org/Salutation" + }, + { + "id": "https://example.org/TwoLinks" + }, + { + "id": "https://example.org/greeting3" + }, + { + "id": "https://example.org/orphan" + }, + { + "id": "https://example.org/world" + } + ] +}