Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from admin-shell-io/feature/renaming-json-ld
Browse files Browse the repository at this point in the history
Renaming the JSON-LD Serializer to RDF Serializer and changing the de…
  • Loading branch information
sebbader authored Aug 17, 2021
2 parents fcef0f9 + 8d5f8bb commit 40ec29c
Show file tree
Hide file tree
Showing 103 changed files with 122 additions and 110 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ The project contains several modules:
- `dataformat-core` Location of the general classes and interfaces that are used by more than one de-/serializer.
- `dataformat-aasx` AASX de-/serializer
- `dataformat-json` JSON de-/serializer
- `dataformat-rdf` RDF de-/serializer
- `dataformat-xml` XML de-/serializer
- `dataformat-uanodeset` OPC UA I4AAS NodeSet de-/serializer

Expand All @@ -44,7 +45,7 @@ We always look for contributions, bug reports, feature requests etc. Simply open

# Contributors

| Name | Affiliation | Github Account | parent | core | aasx | json | xml | json-ld | ua-nodeset | validator|
| Name | Affiliation | Github Account | Parent | Core | AASX | JSON | XML | RDF | UA-Nodeset | Validator|
--- | --- | --- | :---: | :---: | :---: | :---: | :---: | :---: | :---:| :---:
| Mohammad Alreeni | Fraunhofer IWU | []() | | | | | x | | |
| Sebastian Bader | Fraunhofer IAIS | [sebbader](https://github.com/sebbader) | x | | | | | x | | x |
Expand Down
4 changes: 2 additions & 2 deletions dataformat-jsonld/pom.xml → dataformat-rdf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dataformat-jsonld</artifactId>
<name>Asset Administration Shell JSON-LD-Serializer</name>
<artifactId>dataformat-rdf</artifactId>
<name>Asset Administration Shell RDF-Serializer</name>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld;
package io.adminshell.aas.v3.dataformat.rdf;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld;
package io.adminshell.aas.v3.dataformat.rdf;

import com.fasterxml.jackson.annotation.JsonIgnoreType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld;
package io.adminshell.aas.v3.dataformat.rdf;

import com.fasterxml.jackson.databind.module.SimpleModule;

import io.adminshell.aas.v3.dataformat.jsonld.custom.BigDecimalSerializer;
import io.adminshell.aas.v3.dataformat.jsonld.custom.XMLGregorianCalendarDeserializer;
import io.adminshell.aas.v3.dataformat.jsonld.custom.XMLGregorianCalendarSerializer;
import io.adminshell.aas.v3.dataformat.rdf.custom.BigDecimalSerializer;
import io.adminshell.aas.v3.dataformat.rdf.custom.XMLGregorianCalendarDeserializer;
import io.adminshell.aas.v3.dataformat.rdf.custom.XMLGregorianCalendarSerializer;
import io.adminshell.aas.v3.model.LangString;

import java.math.BigDecimal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld;
package io.adminshell.aas.v3.dataformat.rdf;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld;
package io.adminshell.aas.v3.dataformat.rdf;


import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.ser.BeanSerializerModifier;
import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase;
import io.adminshell.aas.v3.dataformat.jsonld.JsonLDSerializer;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.adminshell.aas.v3.dataformat.jsonld;
package io.adminshell.aas.v3.dataformat.rdf;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld;
package io.adminshell.aas.v3.dataformat.rdf;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld;
package io.adminshell.aas.v3.dataformat.rdf;

import io.adminshell.aas.v3.model.LangString;
import io.adminshell.aas.v3.model.annotations.IRI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld;
package io.adminshell.aas.v3.dataformat.rdf;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
Expand All @@ -23,11 +23,10 @@
import io.adminshell.aas.v3.dataformat.DeserializationException;
import io.adminshell.aas.v3.dataformat.Deserializer;
import io.adminshell.aas.v3.dataformat.SerializationException;
import io.adminshell.aas.v3.dataformat.jsonld.custom.ReflectiveMixInResolver;
import io.adminshell.aas.v3.dataformat.jsonld.preprocessing.JsonPreprocessor;
import io.adminshell.aas.v3.dataformat.jsonld.preprocessing.TypeNamePreprocessor;
import io.adminshell.aas.v3.dataformat.rdf.custom.ReflectiveMixInResolver;
import io.adminshell.aas.v3.dataformat.rdf.preprocessing.JsonPreprocessor;
import io.adminshell.aas.v3.dataformat.rdf.preprocessing.TypeNamePreprocessor;
import io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.riot.Lang;
Expand All @@ -44,7 +43,7 @@
public class Serializer implements io.adminshell.aas.v3.dataformat.Serializer, Deserializer {

private static final ObjectMapper mapper = new ObjectMapper();
private final List<JsonPreprocessor> preprocessors; //TODO: It seems like this list is never used...
private final List<JsonPreprocessor> preprocessors;
private final Logger logger = LoggerFactory.getLogger(Serializer.class);

public static String implementingClassesNamePrefix = "Default";
Expand Down Expand Up @@ -79,17 +78,31 @@ public Serializer() {
}

/**
* Serializes an object to JSON-LD representation. In order to support JSON-LD, the input instance must be
* annotated using IDS Infomodel annotations
* Serializes an object to an RDF representation. In order to support RDF, the input instance must be
* annotated using AAS Metamodel annotations. Default format is Turtle (TTL).
*
* @param instance the instance to be serialized
* @return RDF serialization of the provided object graph
* @throws IOException if the serialization fails
*/
public String serialize(Object instance) throws IOException {
return serialize(instance, RDFLanguages.JSONLD, new HashMap<>());
return serialize(instance, RDFLanguages.TTL, new HashMap<>());
}

/**
* Serializes an object to an RDF representation of a given RDF serialization format. In order to support RDF, the
* input instance must be annotated using AAS Metamodel annotations.
*
* @param instance the instance to be serialized
* @param format the RDF format to be returned (only RDFLanguages.TTL, RDFLanguages.JSONLD, RDFLanguages.RDFXML)
* @return RDF serialization of the provided object graph
* @throws IOException if the serialization fails
*/
public synchronized String serialize(Object instance, Lang format) throws IOException {
return serialize(instance, format, new HashMap<>() );
}


//Synchronized is required for thread safety. Without it, context elements might be missing in case of multiple simultaneous calls to this function
public synchronized String serialize(Object instance, Lang format, Map<Object, String> idMap) throws IOException {
if (format != RDFLanguages.JSONLD && format != RDFLanguages.TURTLE && format != RDFLanguages.RDFXML) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld;
package io.adminshell.aas.v3.dataformat.rdf;

import java.io.IOException;
import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.custom;
package io.adminshell.aas.v3.dataformat.rdf.custom;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.custom;
package io.adminshell.aas.v3.dataformat.rdf.custom;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.adminshell.aas.v3.dataformat.jsonld.JsonLdEnumSerializer;
import io.adminshell.aas.v3.dataformat.rdf.JsonLdEnumSerializer;

@JsonSerialize(using = JsonLdEnumSerializer.class)
public class JsonLdEnumMixin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.custom;
package io.adminshell.aas.v3.dataformat.rdf.custom;



import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

import io.adminshell.aas.v3.model.*;
import io.adminshell.aas.v3.model.AccessPermissionRule;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.custom;
package io.adminshell.aas.v3.dataformat.rdf.custom;

import com.fasterxml.jackson.databind.introspect.ClassIntrospector;

Expand All @@ -26,7 +26,7 @@ public Class<?> findMixInClassFor(Class<?> cls) {
return JsonLdEnumMixin.class;
}
try {
return Class.forName("io.adminshell.aas.v3.dataformat.jsonld.mixins." + cls.getSimpleName() + "Mixin");
return Class.forName("io.adminshell.aas.v3.dataformat.rdf.mixins." + cls.getSimpleName() + "Mixin");
}
catch (ClassNotFoundException ignored)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.custom;
package io.adminshell.aas.v3.dataformat.rdf.custom;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.custom;
package io.adminshell.aas.v3.dataformat.rdf.custom;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;


import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;


import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.adminshell.aas.v3.dataformat.jsonld.mixins;
package io.adminshell.aas.v3.dataformat.rdf.mixins;


import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Loading

0 comments on commit 40ec29c

Please sign in to comment.