Service

Contents

Service#

About#

This section will provide information on the service type. This is not one of the main OIH types. However, we will provide guidance here on describing services using schema.org.

It should be noted that this might be a simple link to an OpenAPI or some other descriptor document. Also, schema.org is not rich enough for complex descriptions and itself borrows from the Hydra vocabulary. It may be required to leverage Hydra if complex descriptions are needed.

The graph describes a service than can be invoked with:

curl --data-binary "@yourfile.jpg" -X POST https://us-central1-top-operand-112611.cloudfunctions.net/function-1

This with POST a jpeg to the service and get back a simple text response with some information about the image.

 1{
 2  "@context": {
 3    "@vocab": "https://schema.org/"
 4  },
 5  "@type": "Service",
 6  "@id": "URL:  Optional. A URL that resolves to *this* JSON-LD document, NOT the URL of the CreativeWork that this JSON-LD document describes. To link to the CreativeWork itself, please use 'url' and/or 'identifier')",
 7
 8  "aggregateRating": {"@type": "https://schema.org/aggregateRating"},
 9  "areaServed": [
10    "Text: The geographic area where the service is provided.",
11    {"@type": "https://schema.org/Place"},
12    {"@type": "https://schema.org/GeoShape"},
13    {"@type": "https://schema.org/AdministrativeArea"}
14  ],
15  "audience": {"@type": "https://schema.org/Audience"},
16  "availableChannel": {"@type": "https://schema.org/ServiceChannel"},
17  "award": "Text: An award won by or for this service.",
18  "brand": [
19    "Text: The brand(s) associated with the service, or the brand(s) maintained by an organization or business person.",
20    {"@type": "https://schema.org/Brand"},
21    {"@type": "https://schema.org/Organization"}
22  ],
23  "broker": [
24    {"@type": "https://schema.org/Person"},
25    {"@type": "https://schema.org/Organization"}
26  ],
27  "category": [
28    "Text: A category for the service.",
29    "URL",
30    {"@type": "https://schema.org/CategoryCode"},
31    {"@type": "https://schema.org/PhysicalActivityCategory"},
32    {"@type": "https://schema.org/Thing"}
33  ],
34  "hasCertification": {"@type": "https://schema.org/Certification"},
35  "hasOfferCatalog": {"@type": "https://schema.org/OfferCatalog"},
36  "hoursAvailable": {"@type": "https://schema.org/OpeningHoursSpecification"},
37  "isRelatedTo": [
38    {"@type": "https://schema.org/Product"},
39    {"@type": "https://schema.org/Service"}
40  ],
41  "isSimilarTo": [
42    {"@type": "https://schema.org/Product"},
43    {"@type": "https://schema.org/Service"}
44  ],
45  "logo": [
46    {"@type": "https://schema.org/ImageObject"},
47    "URL"
48  ],
49  "offers": [
50    {"@type": "https://schema.org/Demand"},
51    {"@type": "https://schema.org/Offer"}
52  ],
53  "provider": [
54    "Text: The service provider, service operator, or service performer; the goods producer. Another party (a seller) may offer those services or goods on behalf of the provider.",
55    {"@type": "https://schema.org/Person"},
56    {"@type": "https://schema.org/Organization"}
57  ],
58  "providerMobility": "Text: Indicates the mobility of a provided service (e.g. 'static', 'dynamic').",
59  "review": {"@type": "https://schema.org/Review"},
60  "serviceOutput": {"@type": "https://schema.org/Thing"},
61  "serviceType": [
62    "Text: Human-readable terms of service documentation",
63    {"@type": "https://schema.org/GovernmentBenefitsType"}
64  ],
65  "slogan": "Text: A slogan or motto associated with the item.",
66  "termsOfService": [
67    "Text: Human-readable terms of service documentation",
68    "URL"
69  ],
70  
71  "additionalType": [
72    "Text: An additional type for the item, typically used for adding more specific types from external vocabularies in microdata syntax.",
73    "URL"
74  ],
75  "alternateName": "Text: An alternative name for this Thing.",
76  "description": "Text: Free text which describes this Thing.",
77  "disambiguatingDescription": "Text: A sub property of description. A short description of the item used to disambiguate from other, similar items. Information from other properties (in particular, name) may be necessary for the description to be useful for disambiguation",
78  "identifier": [
79    {"@type": "https://schema.org/PropertyValue"},
80    "Text - The identifier property represents any kind of identifier for any kind of Thing, such as ISBNs, GTIN codes, UUIDs etc. Schema.org provides dedicated properties for representing many of these, either as textual strings or as URL (URI) links. See background notes for more details.",
81    "URL"
82  ],
83  "image": [
84    "URL",
85    {"@type": "https://schema.org/ImageObject"}
86  ],
87  "mainEntityOfPage": [
88    "URL",
89    {"@type": "https://schema.org/CreativeWork"}
90  ],
91  "name": "Text: The name of the item.",
92  "potentialAction": {"@type": "https://schema.org/Action"},
93  "sameAs": "URL",
94  "subjectOf": [
95    {"@type": "https://schema.org/CreativeWork"},
96    {"@type": "https://schema.org/Event"}
97  ],
98  "url": "URL - the URL to the item described by this JSON-LD document"
99}
Hide code cell source
import json
from pyld import jsonld
import os, sys

currentdir = os.path.dirname(os.path.abspath(''))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from lib import jbutils

with open("../../../odis-in/dataGraphs/thematics/services/graphs/serviceBase.json") as dgraph:
    doc = json.load(dgraph)

context = {
    "@vocab": "https://schema.org/",
}

compacted = jsonld.compact(doc, context)
jbutils.show_graph(compacted)
../../_images/ca54a90cda7ea5882c132160d613e73e897aedc72d20502d6438b0592b8d6e43.svg

References#