### InstallAction Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Represents the action of installing software. Use this to indicate a person installing an application. ```json { "@context": "http://schema.org", "@type": "InstallAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "MobileApplication", "name": "Fitbit" } } ``` -------------------------------- ### InstallAction Schema.org Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt Use InstallAction to represent an agent installing a software application. This is useful for tracking software deployment. ```json { "@context": "https://schema.org", "@type": "InstallAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "MobileApplication", "name": "Fitbit" } } ``` -------------------------------- ### OrganizeAction JSON-LD Example (Business) Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt This example shows John organizing a local business. ```json { "@context": "https://schema.org", "@type": "OrganizeAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "LocalBusiness", "name": "John's tavern" } } ``` -------------------------------- ### Load Schema.org Data Sources Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/scripts/Schema_org_Examples.ipynb Configures the data source for schema.org terms and examples, and sets up the local environment by cloning the repository if necessary and installing dependencies. ```python DataSource = "Github:main" #@param ["Github:main", "staging.schema.org", "schema.org"] {allow-input: true} gitpullrequired = False if DataSource == "Github:main": gitpullrequired = True termSource = "default" examplesSource = "default" elif DataSource == "staging.schema.org": termSource = "https://staging.schema.org/version/latest/schemaorg-current-http.ttl" examplesSource = "https://staging.schema.org/version/latest/schemaorg-all-examples.txt" elif DataSource == "schema.org": termSource = "https://schema.org/version/latest/schemaorg-current-http.ttl" examplesSource = "https://schema.org/version/latest/schemaorg-all-examples.txt" os.chdir("/content") if not os.path.isdir("lib"): !mkdir lib for path in [os.getcwd(),"lib","/content/lib"]: sys.path.insert( 1, path ) #Pickup libs from shipped lib directory print("Loading schemaorg support libraries ...") !(cd lib; curl -s -O https://raw.githubusercontent.com/schemaorg/schemaorg/main/SchemaTerms/sdotermsource.py) !(cd lib; curl -s -O https://raw.githubusercontent.com/schemaorg/schemaorg/main/SchemaTerms/sdoterm.py) !(cd lib; curl -s -O https://raw.githubusercontent.com/schemaorg/schemaorg/main/SchemaTerms/localmarkdown.py) !(cd lib; curl -s -O https://raw.githubusercontent.com/schemaorg/schemaorg/main/SchemaExamples/schemaexamples.py) !(cd lib; curl -s -O https://raw.githubusercontent.com/schemaorg/schemaorg/main/requirements.txt) !pip --quiet install -r lib/requirements.txt from schemaexamples import SchemaExamples, Example from sdotermsource import SdoTermSource from sdoterm import * from localmarkdown import Markdown Markdown.setWikilinkCssClass("localLink") Markdown.setWikilinkPrePath("https://schema.org/") Markdown.setWikilinkPostPath("") if gitpullrequired: print("\nPulling data from schemaorg repository...") if os.path.isdir("schemaorg"): !rm -r schemaorg !git clone https://github.com/schemaorg/schemaorg.git os.chdir("schemaorg") #If sources are 'default' file paths are relative to schemaorg dir. print("\nLoading triples file(s)") SdoTermSource.loadSourceGraph(termSource,init=True) print ("loaded %s triples - %s terms" % (len(SdoTermSource.sourceGraph()),len(SdoTermSource.getAllTerms())) ) print("\nLoading examples file(s)") SchemaExamples.loadExamplesFiles(examplesSource,init=True) print("Loaded %d examples " % (SchemaExamples.count())) os.chdir("/content") #put us back to a consistent place ``` -------------------------------- ### RegisterAction Example: Registering for Comcast Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt This example shows a person registering for a specific product, Comcast. ```json { "@context": "https://schema.org", "@type": "RegisterAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "Product", "name": "Comcast" } } ``` -------------------------------- ### UseAction Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Represents the action of using an item. This example shows using an exercise plan. ```json { "@context": "http://schema.org", "@type": "UseAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "ExercisePlan", "name": "How to lose 100 calories a day." } } ``` -------------------------------- ### Validate Schema.org Examples Source: https://context7.com/schemaorg/quantity_datatype/llms.txt Command to run the test harness, which checks if examples validate against the schema. ```python python software/util/testharness.py ``` -------------------------------- ### CreateAction JSON-LD Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt This JSON-LD example represents a CreateAction, specifying the agent, the result (an ExercisePlan), and a participant. ```json { "@context": "http://schema.org", "@type": "CreateAction", "agent": { "@type": "Person", "name": "John" }, "result": { "@type": "ExercisePlan", "name": "John's weight loss plan" }, "participant": { "@type": "Person", "name": "Steve" } } ``` -------------------------------- ### LodgingReservation JSON-LD Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt This example demonstrates how to structure a lodging reservation. It includes details about the guest, the accommodation, and check-in/check-out times. ```json { "@context": "https://schema.org", "@type": "LodgingReservation", "reservationId": "abc456", "reservationStatus": "https://schema.org/ReservationConfirmed", "underName": { "@type": "Person", "name": "John Smith" }, "reservationFor": { "@type": "LodgingBusiness", "name": "Hilton San Francisco Union Square", "address": { "@type": "PostalAddress", "streetAddress": "333 O'Farrell St", "addressLocality": "San Francisco", "addressRegion": "CA", "postalCode": "94102", "addressCountry": "US" }, "telephone": "415-771-1400" }, "checkinTime": "2017-04-11T16:00:00-08:00", "checkoutTime": "2017-04-13T11:00:00-08:00" } ``` -------------------------------- ### WinAction Example (Book) Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Represents an action where an agent wins something. This example shows winning a book. ```json { "@context": "http://schema.org", "@type": "WinAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "Book", "name": "Top 1000 Things You Didn't Know about Nobel prizes" } } ``` -------------------------------- ### JSON-LD PrependAction Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Shows a PrependAction for adding an item to the beginning of a collection. This example prepends a movie to a list. ```json // John prepended a movie to his movie queue. { "@context": "http://schema.org", "@type": "PrependAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "Movie", "name": "The Internship" }, "targetCollection": { "@type": "ItemList", "name": "List of my favorite movies", "url": "http://netflix.com/john/favorite" } } ``` -------------------------------- ### PlanAction Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt Represents an action taken by an agent to plan something. This example shows planning an exercise plan. ```json { "@context": "https://schema.org", "@type": "PlanAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "ExercisePlan", "name": "John's weight loss plan" }, "participant": { "@type": "Person", "name": "Steve" } } ``` -------------------------------- ### SomeProducts JSON-LD Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt This JSON-LD snippet represents the same product information as the Microdata example, suitable for structured data. ```json { "@context": "http://schema.org", "@id": "#product", "@type": "SomeProducts", "additionalType": "http://www.productontology.org/id/Printer_(computing)", "description": "A fast, great-looking, compact laser printer for your desk.", "gtin13": "0012502627104", "name": "Brother HL-2230 Compact Laser Printer" } ``` -------------------------------- ### OrganizationRole Example in JSON-LD Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Represents a role within an organization, such as a member of a sports team with start and end dates. ```json { "@context": "http://schema.org", "@type": "SportsTeam", "name": "San Francisco 49ers", "member": { "@type": "OrganizationRole", "member": { "@type": "Person", "name": "Joe Montana" }, "startDate": "1979", "endDate": "1992", "roleName": "Quarterback" } } ``` -------------------------------- ### Clone and Set Up Schema.org Environment Source: https://context7.com/schemaorg/quantity_datatype/llms.txt Steps to clone the Schema.org repository, create a virtual environment, and install dependencies. ```bash git clone https://github.com/schemaorg/schemaorg.git cd schemaorg python3 -m venv .venv && source .venv/bin/activate pip install -r software/requirements.txt ``` -------------------------------- ### Example Building Instance (List 3) Source: https://github.com/schemaorg/quantity_datatype/blob/main/docs/iot-gettingstarted.html Demonstrates how to create an instance of a building using the BRICK ontology, linking sensors, zones, and equipment. ```turtle @prefix brick: . @prefix brickframe: . @prefix ex: . @prefix owl: . @prefix rdfs: . ex:example_building a brick:Building . ex:zt_sensor_1 a brick:Zone_Temperature_Sensor; brickframe:isPointOf ex:zone_1, ex:vav_1 . ex:zone_1 a brick:HVAC_Zone; brickframe.isLocatedIn ex:example_building . ex:vav_1 a brick:VAV; brickframe:basPoint ex:zt_sensor_1; brickframe:feeds ex:zone_1. ``` -------------------------------- ### OrganizationRole Example in RDFa Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Represents a role within an organization, such as a member of a sports team with start and end dates, using RDFa. ```html
San Francisco 49ers
Joe Montana
1979 1992 Quarterback
``` -------------------------------- ### OrganizeAction Example (Business) Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Demonstrates organizing a local business, detailing the agent and the business object. ```json { "@context": "http://schema.org", "@type": "OrganizeAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "LocalBusiness", "name": "John's tavern" } } ``` -------------------------------- ### Event JSON-LD Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt This JSON-LD snippet represents an Event, including its name, location, offers, and start date. The location is detailed as a Place with a PostalAddress. ```json { "@context": "https://schema.org", "@type": "Event", "location": { "@type": "Place", "address": { "@type": "PostalAddress", "addressLocality": "Denver", "addressRegion": "CO", "postalCode": "80209", "streetAddress": "7 S. Broadway" }, "name": "The Hi-Dive" }, "name": "Typhoon with Radiation City", "offers": { "@type": "Offer", "price": "13.00", "priceCurrency": "USD", "url": "http://www.ticketfly.com/purchase/309433" }, "startDate": "2013-09-14T21:30" } ``` -------------------------------- ### Event RDFa Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt This RDFa snippet marks up an Event, specifying its name, start date, location, and offers. The location is defined as a Place with a PostalAddress. ```html
Sat Sep 14
Typhoon with Radiation City
The Hi-Dive
7 S. Broadway
Denver, CO 80209
9:30 PM
$ 13.00
Tickets
``` -------------------------------- ### Build Release Site Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/RELEASING.md Run the build script to assign example IDs, perform a full site build, and copy release files to the data/releases directory. ```bash ./software/util/buildsite.py --release ``` -------------------------------- ### Event Microdata Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt This Microdata snippet defines an Event, including its name, start date, location, and offers. The location is further detailed as a Place with a PostalAddress. ```html
Sat Sep 14
Typhoon with Radiation City
The Hi-Dive
7 S. Broadway
Denver, CO 80209
9:30 PM
$13.00
``` -------------------------------- ### Serve Schema.org Site Locally Source: https://context7.com/schemaorg/quantity_datatype/llms.txt Command to start a local development server for previewing the Schema.org site. ```bash ./software/devserv.py ``` -------------------------------- ### Initial Site Build Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SOFTWARE_README.md Perform an initial build of the Schema.org website locally. This command creates a static image of the site in the 'site' directory. ```bash ./software/util/buildsite.py -a ``` -------------------------------- ### Event JSON-LD Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Describes an event with its name, location, start date, and offer details including price and URL. Use this for concerts, performances, or other public gatherings. ```json { "@context": "http://schema.org", "@type": "Event", "location": { "@type": "Place", "address": { "@type": "PostalAddress", "addressLocality": "Denver", "addressRegion": "CO", "postalCode": "80209", "streetAddress": "7 S. Broadway" }, "name": "The Hi-Dive" }, "name": "Typhoon with Radiation City", "offers": { "@type": "Offer", "price": "13.00", "priceCurrency": "USD", "url": "http://www.ticketfly.com/purchase/309433" }, "startDate": "2013-09-14T21:30" } ``` -------------------------------- ### Help for Build Script Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SOFTWARE_README.md Display the help message for the buildsite.py script to understand all available options. ```bash ./software/util/buildsite.py -h ``` -------------------------------- ### Find Example Text Files Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/scripts/Schema_org_Dashboard.ipynb This command searches the cloned schema.org repository for files ending in 'example.txt' or 'examples.txt' and lists them. It helps in identifying all available example data files. ```shell !find . -name \*example\*.txt -exec ls {} \;\n```\n\n```\nOutput:\n./schemaorg/SchemaExamples/example-code/examples.txt\n./schemaorg/data/sdo-bus-stop-examples.txt\n./schemaorg/data/sdo-trip-examples.txt\n./schemaorg/data/sdo-police-station-examples.txt\n./schemaorg/data/sdo-airport-examples.txt\n./schemaorg/data/sdo-train-station-examples.txt\n./schemaorg/data/sdo-videogame-examples.txt\n./schemaorg/data/sdo-book-series-examples.txt\n./schemaorg/data/sdo-automobile-examples.txt\n./schemaorg/data/sdo-invoice-examples.txt\n./schemaorg/data/sdo-creativework-examples.txt\n./schemaorg/data/sdo-itemlist-examples.txt\n./schemaorg/data/sdo-offeredby-examples.txt\n./schemaorg/data/sdo-digital-document-examples.txt\n./schemaorg/data/examples.txt\n./schemaorg/data/sdo-hotels-examples.txt\n./schemaorg/data/ext/pending/issue-2490-examples.txt\n./schemaorg/data/ext/pending/issue-1670-examples.txt\n./schemaorg/data/ext/pending/issue-2192-examples.txt\n./schemaorg/data/ext/pending/issue-894-examples.txt\n./schemaorg/data/ext/pending/issue-2396-examples.txt\n./schemaorg/data/ext/pending/issue-1156-examples.txt\n./schemaorg/data/ext/pending/issue-2384-examples.txt\n./schemaorg/data/ext/pending/issue-1698-examples.txt\n./schemaorg/data/ext/pending/issue-2294-examples.txt\n./schemaorg/data/ext/pending/issue-2543-examples.txt\n./schemaorg/data/ext/pending/issue-1457-examples.txt\n./schemaorg/data/ext/pending/issue-1389-examples.txt\n./schemaorg/data/ext/pending/issue-2173-examples.txt\n./schemaorg/data/ext/pending/issue-447-examples.txt\n./schemaorg/data/ext/pending/issue-1779-examples.txt\n./schemaorg/data/ext/pending/issue-1525-examples.txt\n./schemaorg/data/ext/pending/issue-1050-examples.txt\n./schemaorg/data/ext/pending/issue-2599-examples.txt\n./schemaorg/data/ext/pending/issue-1759-examples.txt\n./schemaorg/data/ext/pending/issue-383-examples.txt\n./schemaorg/data/ext/pending/issue-2482-examples.txt\n./schemaorg/data/ext/pending/issue-1741-examples.txt\n./schemaorg/data/ext/pending/issue-2366-examples.txt\n./schemaorg/data/ext/pending/issue-2421-examples.txt\n./schemaorg/data/ext/pending/issue-2021-examples.txt\n./schemaorg/data/ext/pending/issue-2534-examples.txt\n./schemaorg/data/ext/pending/issue-2405-examples.txt\n./schemaorg/data/ext/pending/issue-2085-examples.txt\n./schemaorg/data/ext/pending/issue-1062-examples.txt\n./schemaorg/data/ext/pending/issue-1950-examples.txt\n./schemaorg/data/ext/pending/issue-2296-examples.txt\n./schemaorg/data/ext/pending/issue-template-examples.txt\n./schemaorg/data/ext/pending/issue-1758-examples.txt\n./schemaorg/data/ext/pending/issue-2109-examples.txt\n./schemaorg/data/ext/pending/issue-2722-example.txt\n./schemaorg/data/ext/pending/issue-2108-examples.txt\n./schemaorg/data/ext/pending/issue-373-examples.txt\n./schemaorg/data/ext/pending/issue-2289-examples.txt\n./schemaorg/data/ext/pending/issue-1423-examples.txt\n./schemaorg/data/ext/pending/issue-2514-examples.txt\n./schemaorg/data/ext/pending/issue-2419-examples.txt\n./schemaorg/data/ext/pending/issue-2083-examples.txt\n./schemaorg/data/ext/pending/issue-1842-examples.txt\n./schemaorg/data/ext/pending/issue-2740-examples.txt\n./schemaorg/data/ext/pending/issue-1045-examples.txt\n./schemaorg/data/ext/pending/issue-1689-examples.txt\n./schemaorg/data/ext/pending/issue-1253-examples.txt\n./schemaorg/data/ext/pending/issue-1810-examples.txt\n./schemaorg/data/ext/pending/issue-271-examples.txt\n./schemaorg/data/ext/health-lifesci/drug-example.txt\n./schemaorg/data/ext/health-lifesci/MedicalScholarlyArticle-examples.txt\n./schemaorg/data/ext/health-lifesci/medicalCondition-examples.txt\n./schemaorg/data/ext/health-lifesci/medicalWebpage-examples.txt\n./schemaorg/data/ext/health-lifesci/medicalGuideline-examples.txt\n./schemaorg/data/ext/bib/bsdo-atlas-examples.txt\n./schemaorg/data/ext/bib/bsdo-collection-examples.txt\n./schemaorg/data/ext/bib/comics-examples.txt\n./schemaorg/data/ext/bib/bsdo-newspaper-examples.txt\n./schemaorg/data/ext/bib/bsdo-thesis-examples.txt\n./schemaorg/data/ext/bib/bsdo-translation-examples.txt\n./schemaorg/data/ext/bib/bsdo-audiobook-examples.txt\n./schemaorg/data/ext/bib/bsdo-chapter-examples.txt\n./schemaorg/data/sdo-tv-listing-examples.txt\n./schemaorg/data/sdo-identifier-examples.txt\n./schemaorg/data/sdo-service-examples.txt\n./schemaorg/data/sdo-defined-region-examples.txt\n./schemaorg/data/sdo-mainEntity-examples.txt\n./schemaorg/data/sdo-visualartwork-examples.txt\n./schemaorg/data/sdo-course-examples.txt\n ``` -------------------------------- ### JSON-LD EventSeries Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/ext/pending/issue-447-examples.txt This JSON-LD snippet defines an EventSeries for the Olympic Games and its sub-events, the Summer Olympics in Rio and London. It includes event names, start and end dates, URLs, and relationships between super and sub-events. ```json { "@context" : "https://schema.org", "@type" : "EventSeries", "@id" : "http://www.olympic.org/olympic-games", "name" : "Olympic Games", "subEvent" : "http://www.olympic.org/rio-2016-summer-olympics", "subEvent" : "http://www.olympic.org/london-2012-summer-olympics" } ``` ```json { "@context" : "https://schema.org", "@type" : "Event", "@id" : "http://www.olympic.org/rio-2016-summer-olympics", "name" : "The Rio 2016 Summer Olympics", "startDate" : "2016-08-05", "endDate" : "2016-08-21", "url" : "http://www.rio2016.com", "offers" : { "@type" : "Offer", "url" : "http://www.rio2016.com/en/tourist-information" }, "superEvent" : "http://www.olympic.org/olympic-games", "subEvent" : "http://www.rio2016.com/en/rowing" } ``` ```json { "@context" : "https://schema.org", "@type" : "Event", "@id" : "http://www.rio2016.com/en/rowing", "location" : { "@type" : "Place", "name" : "Lagoa Stadium", "address" : "Av. Borges de Medeiros, 1524 - Lagoa, Rio de Janeiro - RJ, 22470-003, Brazil" }, "startDate" : "2016-08-06", "endDate" : "2016-08-13", "superEvent": "http://www.olympic.org/rio-2016-summer-olympics" } ``` ```json { "@context" : "https://schema.org", "@type": "Event", "@id" : "http://www.olympic.org/london-2012-summer-olympics", "name" : "The London 2012 Summer Olympics", "startDate" : "2012-07-27", "endDate" : "2012-08-12", "superEvent" : "http://www.olympic.org/olympic-games" } ``` -------------------------------- ### JSON-LD Example for ListenAction with ActionAccessSpecification Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/ext/pending/issue-1741-examples.txt This example demonstrates how to structure a MusicRecording with a potential ListenAction. It includes detailed requirements for accessing the action, such as availability dates, eligible regions, subscription needs, and expected offers. ```json ``` -------------------------------- ### MortgageLoan and RepaymentSpecification JSON-LD Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/docs/financial.html Demonstrates JSON-LD for describing a Mortgage Loan and its Repayment Specification, including loan amount, term, interest rate, APR, payment frequency, number of installments, down payment, and payment amount. ```json { "@context": "https://schema.org", "@type": "WebPage", "name": "Middle exchange rates of foreign currencies – table A", "mainEntity": { "@type": "ItemList", "name": "Table No. 047/A/NBP/2016 of 2016-03-09", "itemListElement": [ { "@type": "ExchangeRateSpecification", "currency":"EUR", "currentExchangeRate":{ "@type": "UnitPriceSpecification", "price": "4.3215", "priceCurrency": "PLN" } }, { "@type": "ExchangeRateSpecification", "currency":"BRL", "currentExchangeRate":{ "@type": "UnitPriceSpecification", "price": "1.0490", "priceCurrency": "PLN" } } ] } } ``` -------------------------------- ### Fully Specified Music Event with Performers (JSON-LD) Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt This example provides a detailed description of a MusicEvent, including a tour image, full venue address with postal code, multiple performers, and multiple ticket classes with pricing and availability. It specifies start and end times, and performer details with 'sameAs' links. ```json [{ "@context" : "https://schema.org", "@type" : "MusicEvent", "name" : "B.B. King with Jonathon \"Boogie\" Long", "image" : "http://www.bbking.com/gallery/b-b-king-live.jpg", "url" : "http://www.bbking.com/events/apr12-providence.html", "startDate" : "2014-04-12T19:30", "doorTime" : "18:30:00", "endDate" : "2014-04-12T22:00", "location" : { "@type" : "Place", "name" : "Lupo's Heartbreak Hotel", "sameAs" : "http://lupos.com/", "address" : { "@type" : "PostalAddress", "streetAddress" : "79 Washington St.", "addressLocality" : "Providence", "addressRegion" : "RI", "postalCode" : "02903", "addressCountry" : "US" } }, "offers" : [ { "@type" : "Offer", "name" : "General Admission", "priceCurrency": "USD", "price" : "63.25", "availability" : "SoldOut", "url" : "http://www.ticketmaster.com/event/17004C29" },{ "@type" : "Offer", "name" : "VIP Experience", "url" : "http://www.example.com/Abcde12345", "priceCurrency": "USD", "price" : "299.00", "validFrom" : "2014-02-05T10:00", "validThrough" : "2014-03-19T23:59" } ], "performer" : [ { "@type" : "MusicGroup", "name" : "B.B. King", "sameAs" : "http://en.wikipedia.org/wiki/B.B._King" },{ "@type" : "MusicGroup", "name" : "Jonathon \"Boogie\" Long", "sameAs" : "http://jonathonboogielong.com/" } ] }] ``` -------------------------------- ### Analyze Schema.org Example Coverage Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/scripts/Schema_org_Examples.ipynb Analyzes the loaded schema.org examples to report on total examples, terms with examples, maximum examples per term, and identifies invalid or missing terms. ```python #@title Analyse Examples coverage ShowErrors = False #@param {type:"boolean"} print("Total Examples: %s" % SchemaExamples.count()) print("Terms with examples: %s" % len(SchemaExamples.EXAMPLESMAP)) maxex = maxterm = invalidTerms = 0 for t, exs in SchemaExamples.EXAMPLESMAP.items(): maxex = max(maxex,len(exs)) print("Max examples for a term: %s" % maxex) import re all = SchemaExamples.allExamples() total = len(all) done = 0 for ex in all: debugdata = "" if gitpullrequired: debugdata = " (%s [%s]) " % (ex.exmeta.get('file',''),ex.exmeta.get('filepos','')) maxterm = max(maxterm,len(ex.terms)) for term in ex.terms: if re.search('[^0-9a-zA-Z-_]',term): if ShowErrors: clearProgressBar(" %s: invalid term name: '%s' %s\n" %(ex.keyvalue,term,debugdata)) invalidTerms += 1 else: t = SdoTermSource.getTerm(term) if not t: if ShowErrors: clearProgressBar(" %s: term not found: %s %s\n" %(ex.keyvalue,term,debugdata)) invalidTerms += 1 done += 1 drawProgressBar(percentage(done,total)/100,50,pre="Processing Example Definitions.... ") clearProgressBar("") print() print("Max terms for an example: %s" % maxterm) ``` -------------------------------- ### ChooseAction Example with Multiple Options Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt Illustrates an agent choosing an object from a list of action options. This example shows John choosing Dogfish Head from two brewery options. ```json { "@context": "https://schema.org", "@type": "ChooseAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "Brewery", "name": "Dogfish Head" }, "actionOption": [ { "@type": "Brewery", "name": "Dogfish Head" }, { "@type": "Brewery", "name": "Russian River" } ] } ``` -------------------------------- ### DiscoverAction Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Use this to describe a discovery action. It requires an agent and an object, such as a MusicRecording. ```json { "@context": "http://schema.org", "@type": "DiscoverAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "MusicRecording", "name": "Pink" } } ``` -------------------------------- ### DataIntegrityProof Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/ext/pending/issue-3230-examples.txt Example of a DataIntegrityProof object with specific properties. ```json { "type": "DataIntegrityProof", "cryptosuite": "ecdsa-rdfc-2019", "created": "2023-12-11T13:00:00Z", "verificationMethod": "https://certification.example/issuers/1562#key-1", "proofPurpose": "assertionMethod", "proofValue": "998qTceMhzmpFSfwEphYDnWJJiAtcGaitiZ2FgpRWEcLJmfQBRMUpaTihmhpdHbiMJN9Ranx1PXLaGSePQjV74nLC" } ``` -------------------------------- ### DepartAction Example: Departing from a Hotel Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt This example shows how to represent a departure action from a location. ```json { "@context": "https://schema.org", "@type": "DepartAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "Hotel", "name": "The Hilton" } } ``` -------------------------------- ### JSON-LD AddAction Example (Skillset) Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Demonstrates adding a software application to a skillset collection. Ensure the object and targetCollection are accurately described. ```json // John added SAAS to his skillset. { "@context": "http://schema.org", "@type": "AddAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "SoftwareApplication", "name": "SAAS" }, "targetCollection": { "@type": "ItemList", "name": "John's skillset", "url": "http://linkedn.com/john/skillset" } } ``` -------------------------------- ### ExerciseAction (Opponent) Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt Represents an action of exercising. This example specifies the type of exercise and an opponent. ```json { "@context": "https://schema.org", "@type": "ExerciseAction", "agent": { "@type": "Person", "name": "John" }, "exerciseType": "Tennis", "opponent": { "@type": "Person", "name": "Steve" } } ``` -------------------------------- ### OrganizeAction JSON-LD Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt Use this to mark up an action where an agent organizes something. This example shows John organizing a webpage. ```json { "@context": "https://schema.org", "@type": "OrganizeAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "WebPage", "name": "John's thought about the web" } } ``` -------------------------------- ### VoteAction Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/examples.txt Represents an agent voting for a candidate. This example shows John voting on Steve. ```json { "@context": "https://schema.org", "@type": "VoteAction", "agent": { "@type": "Person", "name": "John" }, "candidate": { "@type": "Person", "name": "Steve" } } ``` -------------------------------- ### Schema.org Data Setup and RDFLib Plugin Registration Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/scripts/dashboard.ipynb Initializes the testing harness, registers the JSON-LD serializer for RDFLib, loads Schema.org schemas and extensions, and retrieves the master data store. ```python # Setup setInTestHarness(True) import sdoapp rdflib.plugin.register("json-ld", Serializer, "rdflib_jsonld.serializer", "JsonLDSerializer") store = getMasterStore() read_schemas(loadExtensions=True) read_extensions(sdoapp.ENABLED_EXTENSIONS) graphs = list(store.graphs()) ``` -------------------------------- ### Install SPARQLWrapper Library Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/scripts/Schema_org_Dashboard.ipynb Installs the SPARQLWrapper library, which is required for querying SPARQL endpoints. This command should be run once per session. ```python # run this once per session to bring in a required library !pip --quiet install sparqlwrapper | grep -v 'already satisfied' from SPARQLWrapper import SPARQLWrapper, JSON import pandas as pd import io import requests ``` -------------------------------- ### Action Target URL Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/docs/actions.html Illustrates how to specify a target URL for executing an action, like watching a movie. ```json { "@context": "https://schema.org", "@type": "Movie", "name": "Footloose", "potentialAction": { "@type": "WatchAction", "target" : "http://example.com/player?id=123" } } ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SOFTWARE_README.md Installs the Python dependencies required for the schema.org project using pip. ```bash pip3 install -r software/requirements.txt ``` -------------------------------- ### JSON-LD DeleteAction Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Represents a DeleteAction for removing an item from a collection. This example deletes a movie from a list. ```json // John deleted The Internship from his movie queue. { "@context": "http://schema.org", "@type": "DeleteAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "Movie", "name": "The Internship" }, "targetCollection": { "@type": "ItemList", "name": "List of my favorite movies", "url": "http://netflix.com/john/favorite" } } ``` -------------------------------- ### ShareAction Example (Image) Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Use to indicate that an agent has shared an object with a recipient. This example shares an image. ```json { "@context": "http://schema.org", "@type": "ShareAction", "agent": { "@type": "Person", "name": "John" }, "recipient": { "@type": "Person", "name": "Steve" }, "object": { "@type": "ImageObject", "name": "My kids", "url": "http://john.com/kids.jpg" } } ``` -------------------------------- ### WearAction Example Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Represents the action of wearing an item of clothing or accessory. This example indicates wearing a brand. ```json { "@context": "http://schema.org", "@type": "WearAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "Brand", "name": "Calvin Klein" } } ``` -------------------------------- ### Basic JSON-LD for OnlineStore Source: https://github.com/schemaorg/quantity_datatype/blob/main/data/ext/pending/issue-3028-examples.txt This example demonstrates a basic JSON-LD structure for an OnlineStore, including properties like name, description, image, logo, parent organization, address, ratings, interaction statistics, and founding date. ```json ``` -------------------------------- ### PlanAction Example with ExercisePlan Source: https://github.com/schemaorg/quantity_datatype/blob/main/software/SchemaExamples/example-code/examples.txt Use this snippet to represent planning an exercise plan with another person. It includes the agent, the exercise plan object, and the participant. ```json // John planned an exercise plan with Steve. { "@context": "http://schema.org", "@type": "PlanAction", "agent": { "@type": "Person", "name": "John" }, "object": { "@type": "ExercisePlan", "name": "John's weight loss plan" }, "participant": { "@type": "Person", "name": "Steve" } } ```