Change some inline term definitions to new JSON-LD context

This commit is contained in:
Eugen Rochko 2024-09-11 09:50:03 +02:00
parent 9e12fa254e
commit 5a7ea1dd2f
5 changed files with 25 additions and 6 deletions

View File

@ -4,6 +4,7 @@ module ContextHelper
NAMED_CONTEXT_MAP = {
activitystreams: 'https://www.w3.org/ns/activitystreams',
security: 'https://w3id.org/security/v1',
miscellany: 'https://purl.archive.org/socialweb/miscellany',
}.freeze
CONTEXT_EXTENSION_MAP = {

View File

@ -4,10 +4,10 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
include RoutingHelper
include FormattingHelper
context :security
context :security, :miscellany
context_extensions :manually_approves_followers, :featured, :also_known_as,
:moved_to, :property_value, :discoverable, :olm, :suspended,
context_extensions :featured, :also_known_as,
:property_value, :discoverable, :olm, :suspended,
:memorial, :indexable, :attribution_domains
attributes :id, :type, :following, :followers,

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class ActivityPub::HashtagSerializer < ActivityPub::Serializer
context_extensions :hashtag
context :miscellany
include RoutingHelper

View File

@ -3,7 +3,9 @@
class ActivityPub::NoteSerializer < ActivityPub::Serializer
include FormattingHelper
context_extensions :atom_uri, :conversation, :sensitive, :voters_count
context :miscellany
context_extensions :atom_uri, :conversation, :voters_count
attributes :id, :type, :summary,
:in_reply_to, :published, :url,
@ -254,7 +256,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
end
class TagSerializer < ActivityPub::Serializer
context_extensions :hashtag
context :miscellany
include RoutingHelper

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
# This file generated automatically from https://purl.archive.org/socialweb/miscellany
require 'json/ld'
class JSON::LD::Context
add_preloaded("http://purl.archive.org/socialweb/miscellany") do
new(processingMode: "json-ld-1.1", term_definitions: {
"Hashtag" => TermDefinition.new("Hashtag", id: "https://www.w3.org/ns/activitystreams#Hashtag", simple: true),
"as" => TermDefinition.new("as", id: "https://www.w3.org/ns/activitystreams#", simple: true, prefix: true),
"manuallyApprovesFollowers" => TermDefinition.new("manuallyApprovesFollowers", id: "https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", type_mapping: "http://www.w3.org/2001/XMLSchema#boolean"),
"movedTo" => TermDefinition.new("movedTo", id: "https://www.w3.org/ns/activitystreams#movedTo", type_mapping: "@id"),
"sensitive" => TermDefinition.new("sensitive", id: "https://www.w3.org/ns/activitystreams#sensitive", type_mapping: "http://www.w3.org/2001/XMLSchema#boolean"),
"xsd" => TermDefinition.new("xsd", id: "http://www.w3.org/2001/XMLSchema#", simple: true, prefix: true)
})
end
alias_preloaded("https://purl.archive.org/socialweb/miscellany", "http://purl.archive.org/socialweb/miscellany")
end