Summary

This is a multi-stage proposal for supporting schema.org documents in Streams.  Activity Streams 2.0 explicitly supports schema.org types as first class citizens.  While Apache Streams supports only Activity Streams 1.0 as of this writing, using schema.org will be an incentive to adopt AS 2.0 and preparation for that support can begin prior to full AS 2.0 support. 

Objectives

A developer building with streams should be able to:

  1. Instantiate and then modify POJOs for core schema.org [1]
  2. Assign them to the actor, provider, object, and target fields of an activity
  3. Expect proper serialization and deserialization of application/json type documents
  4. Implement a conversion between an activity streams object and a schema.org object

Proposal

Phase 1: model core schema.org objects using json-schema in a new project module.  generate and publish POJOs in maven artifacts

Phase 2: implement unit tests that demonstrate proper serialization and deserialization of json-formatted schema.org documents

Phase 3: provide a way to swap ActivityObject and Thing java classes in an intelligent way, and for management of activities with any class that extends Thing assignable to any field that currently requires an ActivityObject

Phase 4: support serialization to and from JSON-LD

Phase X: implement the extended vocabularies as well

Considerations

  • streams-plugin-pojo does not currently support the jsonschema oneOf or anyOf syntax introduced with jsonschema v4. some schema.org fields can one one of several possible types.  we'll have to figure out a way to deal with this challenge at each phase
  • DateTimes - schema.org specifies datetimes using ISO 8601 whereas activity streams uses RFC3339.
  • Other libraries - we should be able to demonstrate compatibility with google's schemaorg-java library.  This will probably require adding optional GSON support to streams-pojo and streams-plugin-pojo.

References

[1] http://schema.org/docs/schemas.html

[2] https://github.com/json-schema-org/json-schema-org.github.io

[3] http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.26

[4] http://schema.org/DateTime

[5] https://github.com/google/schemaorg-java