omnirank 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. omnirank/__init__.py +14 -0
  2. omnirank/__main__.py +6 -0
  3. omnirank/adapters/__init__.py +202 -0
  4. omnirank/adapters/astro.py +338 -0
  5. omnirank/adapters/base.py +372 -0
  6. omnirank/adapters/html.py +561 -0
  7. omnirank/adapters/jsx.py +340 -0
  8. omnirank/adapters/nextjs.py +692 -0
  9. omnirank/aeo/__init__.py +9 -0
  10. omnirank/aeo/extract.py +383 -0
  11. omnirank/aeo/propose.py +84 -0
  12. omnirank/aeo/rules.py +964 -0
  13. omnirank/aeo/runner.py +148 -0
  14. omnirank/applicability.py +98 -0
  15. omnirank/apply/__init__.py +23 -0
  16. omnirank/apply/engine.py +1254 -0
  17. omnirank/apply/journal.py +139 -0
  18. omnirank/apply/patch.py +144 -0
  19. omnirank/audit.py +185 -0
  20. omnirank/bands.py +106 -0
  21. omnirank/brief/__init__.py +0 -0
  22. omnirank/brief/analyze.py +197 -0
  23. omnirank/brief/constants.py +89 -0
  24. omnirank/brief/cost.py +62 -0
  25. omnirank/brief/egress.py +23 -0
  26. omnirank/brief/fetchpages.py +239 -0
  27. omnirank/brief/render.py +151 -0
  28. omnirank/brief/runner.py +369 -0
  29. omnirank/brief/serp.py +274 -0
  30. omnirank/brief/text.py +181 -0
  31. omnirank/cli.py +844 -0
  32. omnirank/clock.py +22 -0
  33. omnirank/cms/__init__.py +1 -0
  34. omnirank/cms/runner.py +170 -0
  35. omnirank/cms/wordpress.py +495 -0
  36. omnirank/cms/wordpress_apply.py +508 -0
  37. omnirank/cms/wordpress_plan.py +280 -0
  38. omnirank/config.py +81 -0
  39. omnirank/connect/__init__.py +4 -0
  40. omnirank/connect/bing.py +284 -0
  41. omnirank/connect/cloud_setup.py +43 -0
  42. omnirank/connect/confirm.py +242 -0
  43. omnirank/connect/constants.py +226 -0
  44. omnirank/connect/doctor.py +270 -0
  45. omnirank/connect/ga4.py +749 -0
  46. omnirank/connect/ga4_ai.py +123 -0
  47. omnirank/connect/google_auth.py +657 -0
  48. omnirank/connect/gsc.py +630 -0
  49. omnirank/connect/gsc_reports.py +169 -0
  50. omnirank/connect/http.py +310 -0
  51. omnirank/connect/indexnow.py +373 -0
  52. omnirank/connect/naver.py +536 -0
  53. omnirank/connect/runner.py +515 -0
  54. omnirank/connect/runner_ga4_ai.py +59 -0
  55. omnirank/connect/runner_more.py +489 -0
  56. omnirank/connect/runner_regional.py +260 -0
  57. omnirank/connect/secrets.py +190 -0
  58. omnirank/connect/urlcheck.py +41 -0
  59. omnirank/connect/yandex.py +350 -0
  60. omnirank/crawl/__init__.py +11 -0
  61. omnirank/crawl/analyze.py +493 -0
  62. omnirank/crawl/crawler.py +491 -0
  63. omnirank/crawl/custom.py +175 -0
  64. omnirank/crawl/export.py +67 -0
  65. omnirank/crawl/fetcher.py +212 -0
  66. omnirank/crawl/parse.py +102 -0
  67. omnirank/crawl/render.py +148 -0
  68. omnirank/crawl/robotsgate.py +198 -0
  69. omnirank/crawl/runner.py +295 -0
  70. omnirank/crawl/sitemap.py +99 -0
  71. omnirank/crawl/text.py +20 -0
  72. omnirank/crawl/urls.py +100 -0
  73. omnirank/crawlers.py +564 -0
  74. omnirank/data/ai_crawlers.json +269 -0
  75. omnirank/data/ai_referrers.json +42 -0
  76. omnirank/fetch.py +107 -0
  77. omnirank/fixes/__init__.py +92 -0
  78. omnirank/fixes/base.py +232 -0
  79. omnirank/fixes/canonical.py +243 -0
  80. omnirank/fixes/schema.py +126 -0
  81. omnirank/formats.py +134 -0
  82. omnirank/framework.py +223 -0
  83. omnirank/gates/__init__.py +48 -0
  84. omnirank/gates/aeo.py +114 -0
  85. omnirank/gates/contradictions.py +280 -0
  86. omnirank/gates/crawler_policy.py +85 -0
  87. omnirank/gates/geo.py +152 -0
  88. omnirank/gates/hygiene.py +81 -0
  89. omnirank/gates/jsonld.py +282 -0
  90. omnirank/gates/onpage.py +177 -0
  91. omnirank/gates/perf.py +115 -0
  92. omnirank/gates/security.py +264 -0
  93. omnirank/gates/seo.py +118 -0
  94. omnirank/gates/site.py +248 -0
  95. omnirank/geo_artifacts.py +199 -0
  96. omnirank/html.py +79 -0
  97. omnirank/keywords/__init__.py +5 -0
  98. omnirank/keywords/constants.py +69 -0
  99. omnirank/keywords/engine.py +384 -0
  100. omnirank/keywords/report.py +143 -0
  101. omnirank/keywords/runner.py +160 -0
  102. omnirank/keywords/source.py +60 -0
  103. omnirank/keywords/text.py +45 -0
  104. omnirank/locator.py +480 -0
  105. omnirank/logs/__init__.py +0 -0
  106. omnirank/logs/analyze.py +127 -0
  107. omnirank/logs/bots.py +69 -0
  108. omnirank/logs/ipranges.py +191 -0
  109. omnirank/logs/parse.py +452 -0
  110. omnirank/logs/paths.py +22 -0
  111. omnirank/logs/privacy.py +105 -0
  112. omnirank/logs/runner.py +179 -0
  113. omnirank/mcp_server.py +1480 -0
  114. omnirank/netguard.py +525 -0
  115. omnirank/packs/__init__.py +6 -0
  116. omnirank/packs/backlinks.py +535 -0
  117. omnirank/packs/blog.py +544 -0
  118. omnirank/packs/blog_cross.py +468 -0
  119. omnirank/packs/crawlers.py +23 -0
  120. omnirank/packs/entity.py +492 -0
  121. omnirank/packs/feeds.py +150 -0
  122. omnirank/packs/frontmatter.py +59 -0
  123. omnirank/packs/gsc.py +421 -0
  124. omnirank/packs/local.py +879 -0
  125. omnirank/packs/mdscan.py +326 -0
  126. omnirank/packs/miniyaml.py +378 -0
  127. omnirank/packs/model.py +46 -0
  128. omnirank/packs/product.py +979 -0
  129. omnirank/packs/refresh.py +165 -0
  130. omnirank/packs/runner.py +277 -0
  131. omnirank/packs/sitescan.py +294 -0
  132. omnirank/packs/textsafe.py +79 -0
  133. omnirank/packs/xmlsafe.py +92 -0
  134. omnirank/page.py +42 -0
  135. omnirank/registry.py +302 -0
  136. omnirank/report.py +251 -0
  137. omnirank/report_cmd/__init__.py +7 -0
  138. omnirank/report_cmd/delta.py +58 -0
  139. omnirank/report_cmd/files.py +64 -0
  140. omnirank/report_cmd/model.py +208 -0
  141. omnirank/report_cmd/notify.py +195 -0
  142. omnirank/report_cmd/pdf.py +83 -0
  143. omnirank/report_cmd/portfolio.py +342 -0
  144. omnirank/report_cmd/render.py +379 -0
  145. omnirank/report_cmd/runner.py +267 -0
  146. omnirank/robots.py +172 -0
  147. omnirank/scanner/__init__.py +10 -0
  148. omnirank/scanner/badge.py +90 -0
  149. omnirank/scanner/cache.py +69 -0
  150. omnirank/scanner/cli.py +96 -0
  151. omnirank/scanner/engine.py +289 -0
  152. omnirank/scanner/limits.py +98 -0
  153. omnirank/scanner/server.py +143 -0
  154. omnirank/scanner/service.py +328 -0
  155. omnirank/schema/__init__.py +13 -0
  156. omnirank/schema/catalog.py +679 -0
  157. omnirank/schema/catalog_specs.py +350 -0
  158. omnirank/schema/core.py +306 -0
  159. omnirank/schema/extract.py +396 -0
  160. omnirank/schema/gate.py +121 -0
  161. omnirank/schema/runner.py +213 -0
  162. omnirank/schema/validate.py +504 -0
  163. omnirank/schema/vocab.py +305 -0
  164. omnirank/schemas/omnirank.config.schema.json +268 -0
  165. omnirank/track/__init__.py +0 -0
  166. omnirank/track/ai_prompts.py +207 -0
  167. omnirank/track/analysis.py +197 -0
  168. omnirank/track/constants.py +155 -0
  169. omnirank/track/cost.py +229 -0
  170. omnirank/track/discover.py +277 -0
  171. omnirank/track/discover_cli.py +309 -0
  172. omnirank/track/discover_constants.py +95 -0
  173. omnirank/track/engines.py +216 -0
  174. omnirank/track/estimate_view.py +212 -0
  175. omnirank/track/history.py +261 -0
  176. omnirank/track/runner.py +586 -0
  177. omnirank/track/stats.py +138 -0
  178. omnirank/track/storage.py +128 -0
  179. omnirank-0.5.0.dist-info/METADATA +47 -0
  180. omnirank-0.5.0.dist-info/RECORD +183 -0
  181. omnirank-0.5.0.dist-info/WHEEL +5 -0
  182. omnirank-0.5.0.dist-info/entry_points.txt +2 -0
  183. omnirank-0.5.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,305 @@
1
+ """Bundled, minimal schema.org vocabulary used by the validator.
2
+
3
+ This is a SUBSET of schema.org, not the full vocabulary. It models the types this
4
+ package generates (with their property value types) plus a list of other common
5
+ type names so that real-world markup is not rejected for using them. Properties
6
+ outside the table are never called invalid (they are noted as unchecked), with
7
+ one exception: a wrong-case spelling of a known property.
8
+ """
9
+ from __future__ import annotations
10
+
11
+ import math
12
+ import re
13
+ from datetime import datetime
14
+ from urllib.parse import urlparse
15
+
16
+ SCHEMA_CONTEXTS = frozenset({
17
+ "https://schema.org", "http://schema.org", "https://schema.org/", "http://schema.org/"})
18
+
19
+ # child -> parent, for the types whose properties are modelled below.
20
+ PARENTS: dict[str, str] = {
21
+ "Organization": "Thing", "Person": "Thing", "CreativeWork": "Thing",
22
+ "Intangible": "Thing", "Action": "Thing",
23
+ "Corporation": "Organization", "NGO": "Organization", "LocalBusiness": "Organization",
24
+ "NewsMediaOrganization": "Organization", "EducationalOrganization": "Organization",
25
+ "MedicalOrganization": "Organization", "ProfessionalService": "LocalBusiness",
26
+ "WebSite": "CreativeWork", "WebPage": "CreativeWork", "Article": "CreativeWork",
27
+ "MediaObject": "CreativeWork", "ImageObject": "MediaObject",
28
+ "AboutPage": "WebPage", "ContactPage": "WebPage", "CollectionPage": "WebPage",
29
+ "ProfilePage": "WebPage", "FAQPage": "WebPage",
30
+ "BlogPosting": "Article", "NewsArticle": "Article", "TechArticle": "Article",
31
+ "ItemList": "Intangible", "BreadcrumbList": "ItemList", "ListItem": "Intangible",
32
+ "StructuredValue": "Intangible", "ContactPoint": "StructuredValue",
33
+ "PostalAddress": "ContactPoint", "EntryPoint": "Intangible",
34
+ "SearchAction": "Action",
35
+ }
36
+
37
+ T, U, D, I, N = "text", "url", "date", "int", "number"
38
+ IMG = (U, "node:ImageObject")
39
+
40
+ # Property -> accepted value kinds, declared on the type that introduces it.
41
+ PROPS: dict[str, dict[str, tuple[str, ...]]] = {
42
+ "Thing": {
43
+ "name": (T,), "url": (U,), "description": (T,), "alternateName": (T,),
44
+ "image": IMG, "sameAs": (U,), "identifier": (T, U, "node:Thing"),
45
+ "potentialAction": ("node:Action",), "mainEntityOfPage": ("node:CreativeWork", U),
46
+ },
47
+ "CreativeWork": {
48
+ "inLanguage": (T,), "datePublished": (D,), "dateModified": (D,), "dateCreated": (D,),
49
+ "headline": (T,), "author": ("node:Person", "node:Organization", T),
50
+ "publisher": ("node:Organization", "node:Person"),
51
+ "isPartOf": ("node:CreativeWork", U), "about": ("node:Thing", T),
52
+ "keywords": (T,), "thumbnailUrl": (U,), "license": (U, "node:CreativeWork"),
53
+ "breadcrumb": ("node:BreadcrumbList", T), "mainEntity": ("node:Thing",),
54
+ "primaryImageOfPage": ("node:ImageObject",), "articleSection": (T,),
55
+ "wordCount": (I,),
56
+ },
57
+ "Organization": {
58
+ "legalName": (T,), "logo": IMG, "address": ("node:PostalAddress", T),
59
+ "contactPoint": ("node:ContactPoint",), "email": (T,), "telephone": (T,),
60
+ "foundingDate": (D,), "parentOrganization": ("node:Organization",),
61
+ "employee": ("node:Person",),
62
+ },
63
+ "Person": {
64
+ "jobTitle": (T,), "worksFor": ("node:Organization",), "email": (T,),
65
+ "telephone": (T,), "address": ("node:PostalAddress", T), "givenName": (T,),
66
+ "familyName": (T,), "affiliation": ("node:Organization",),
67
+ },
68
+ "ItemList": {"itemListElement": ("node:ListItem", T, "node:Thing"), "numberOfItems": (I,)},
69
+ "ListItem": {"position": (I,), "item": ("node:Thing", U)},
70
+ "ContactPoint": {"contactType": (T,), "areaServed": (T,), "availableLanguage": (T,),
71
+ "email": (T,), "telephone": (T,)},
72
+ "PostalAddress": {"streetAddress": (T,), "addressLocality": (T,), "addressRegion": (T,),
73
+ "postalCode": (T,), "addressCountry": (T,)},
74
+ "SearchAction": {"target": ("node:EntryPoint", U, T),
75
+ "query-input": (T, "node:Thing")},
76
+ "EntryPoint": {"urlTemplate": (T,), "actionPlatform": (T, U)},
77
+ "MediaObject": {"contentUrl": (U,), "width": (I, N, "node:Thing"),
78
+ "height": (I, N, "node:Thing"), "caption": (T,)},
79
+ }
80
+
81
+ # Other well-known schema.org type names: accepted as "known", properties unchecked.
82
+ _OTHER_TYPE_NAMES = """
83
+ Product Offer AggregateOffer AggregateRating Review Rating Brand Event Place LocalBusiness
84
+ Restaurant Store Hotel Recipe Book Movie Course Dataset VideoObject AudioObject
85
+ SoftwareApplication WebApplication MobileApplication SoftwareSourceCode JobPosting Service
86
+ Question Answer QAPage HowTo HowToStep HowToSection FAQPage DiscussionForumPosting Comment
87
+ Thing Intangible Action CreativeWork ImageGallery MusicRecording PodcastSeries PodcastEpisode
88
+ Quiz EducationalOrganization CollegeOrUniversity School GovernmentOrganization
89
+ OnlineBusiness OnlineStore Airline Corporation NGO ProfessionalService MedicalOrganization
90
+ NewsMediaOrganization SportsOrganization Country City AdministrativeArea GeoCoordinates
91
+ GeoShape OpeningHoursSpecification PropertyValue QuantitativeValue MonetaryAmount
92
+ PriceSpecification Duration Language Audience WebAPI APIReference SpeakableSpecification
93
+ Clip Photograph Article Report ScholarlyArticle Blog Series Episode CreativeWorkSeries
94
+ TVSeries Game VideoGame Painting Sculpture Map Menu MenuItem Occupation Role
95
+ Date DateTime Text URL Number Integer Boolean Time ContactPoint PostalAddress
96
+ """
97
+ OTHER_TYPES = frozenset(re.findall(r"\w+", _OTHER_TYPE_NAMES))
98
+
99
+ PARENTS.update({
100
+ "Product": "Thing", "Offer": "Intangible", "AggregateOffer": "Offer",
101
+ "Rating": "Intangible", "AggregateRating": "Rating", "Brand": "Intangible",
102
+ "Review": "CreativeWork", "Place": "Thing", "GeoCoordinates": "StructuredValue",
103
+ "OpeningHoursSpecification": "StructuredValue", "VirtualLocation": "Intangible",
104
+ "Event": "Thing", "Service": "Intangible", "WebAPI": "Service",
105
+ "SoftwareApplication": "CreativeWork", "WebApplication": "SoftwareApplication",
106
+ "MobileApplication": "SoftwareApplication", "SoftwareSourceCode": "CreativeWork",
107
+ "Restaurant": "LocalBusiness", "Store": "LocalBusiness", "Hotel": "LocalBusiness",
108
+ "Dentist": "LocalBusiness", "LegalService": "LocalBusiness",
109
+ "RealEstateAgent": "LocalBusiness", "AutoRepair": "LocalBusiness",
110
+ "HealthClub": "LocalBusiness", "BeautySalon": "LocalBusiness",
111
+ "Physician": "LocalBusiness",
112
+ "VideoObject": "MediaObject", "AudioObject": "MediaObject", "DataDownload": "MediaObject",
113
+ "PodcastSeries": "CreativeWork", "PodcastEpisode": "CreativeWork", "Course": "CreativeWork",
114
+ "CollegeOrUniversity": "EducationalOrganization", "School": "EducationalOrganization",
115
+ "Quiz": "CreativeWork", "JobPosting": "Intangible", "MonetaryAmount": "StructuredValue",
116
+ "QuantitativeValue": "StructuredValue", "PropertyValue": "StructuredValue",
117
+ "HowTo": "CreativeWork", "Recipe": "HowTo", "HowToStep": "CreativeWork",
118
+ "HowToSection": "CreativeWork", "NutritionInformation": "StructuredValue",
119
+ "Book": "CreativeWork", "Movie": "CreativeWork", "Dataset": "CreativeWork",
120
+ "DataCatalog": "CreativeWork", "QAPage": "WebPage", "Question": "CreativeWork",
121
+ "Answer": "CreativeWork", "Comment": "CreativeWork",
122
+ "DiscussionForumPosting": "CreativeWork", "APIReference": "TechArticle",
123
+ "SpeakableSpecification": "Intangible",
124
+ })
125
+
126
+ PROPS["Thing"].update({
127
+ "offers": ("node:Offer",), "aggregateRating": ("node:AggregateRating",),
128
+ "review": ("node:Review",),
129
+ })
130
+ PROPS["CreativeWork"].update({
131
+ "text": (T,), "creator": ("node:Person", "node:Organization"),
132
+ "speakable": ("node:SpeakableSpecification",), "version": (T, N),
133
+ "educationalLevel": (T,), "teaches": (T,), "provider": ("node:Organization", "node:Person"),
134
+ "citation": (T, "node:CreativeWork"), "funder": ("node:Organization", "node:Person"),
135
+ "position": (I,),
136
+ })
137
+ PROPS["MediaObject"].update({
138
+ "uploadDate": (D,), "duration": (T,), "embedUrl": (U,), "expires": (D,),
139
+ "transcript": (T,), "encodingFormat": (T,),
140
+ })
141
+ PROPS.update({
142
+ "Product": {"sku": (T,), "gtin": (T,), "mpn": (T,), "brand": ("node:Brand", T),
143
+ "color": (T,), "category": (T,)},
144
+ "Offer": {"price": (N, T), "priceCurrency": (T,), "availability": (U,),
145
+ "priceValidUntil": (D,), "itemCondition": (U,), "seller": ("node:Organization",)},
146
+ "Rating": {"ratingValue": (N, T), "bestRating": (N, T), "worstRating": (N, T),
147
+ "ratingCount": (I,), "reviewCount": (I,)},
148
+ "Review": {"reviewRating": ("node:Rating",), "itemReviewed": ("node:Thing",),
149
+ "reviewBody": (T,)},
150
+ "Place": {"address": ("node:PostalAddress", T), "geo": ("node:GeoCoordinates",),
151
+ "telephone": (T,)},
152
+ "GeoCoordinates": {"latitude": (N, T), "longitude": (N, T)},
153
+ "OpeningHoursSpecification": {"dayOfWeek": (U,), "opens": (T,), "closes": (T,),
154
+ "validFrom": (D,), "validThrough": (D,)},
155
+ "LocalBusiness": {"geo": ("node:GeoCoordinates",),
156
+ "openingHoursSpecification": ("node:OpeningHoursSpecification",),
157
+ "priceRange": (T,), "servesCuisine": (T,), "menu": (U, T),
158
+ "areaServed": (T,)},
159
+ "VirtualLocation": {},
160
+ "Event": {"startDate": (D,), "endDate": (D,), "previousStartDate": (D,),
161
+ "location": ("node:Place", "node:VirtualLocation", T), "eventStatus": (U,),
162
+ "eventAttendanceMode": (U,), "organizer": ("node:Organization", "node:Person"),
163
+ "performer": ("node:Person", "node:Organization")},
164
+ "Service": {"provider": ("node:Organization", "node:Person"), "serviceType": (T,),
165
+ "areaServed": (T,)},
166
+ "WebAPI": {"documentation": (U, "node:CreativeWork"), "termsOfService": (U,)},
167
+ "SoftwareApplication": {"applicationCategory": (T,), "operatingSystem": (T,),
168
+ "softwareVersion": (T,), "downloadUrl": (U,),
169
+ "screenshot": (U, "node:ImageObject"), "fileSize": (T,),
170
+ "softwareRequirements": (T,), "featureList": (T,),
171
+ "releaseNotes": (U, T)},
172
+ "SoftwareSourceCode": {"codeRepository": (U,), "programmingLanguage": (T,),
173
+ "runtimePlatform": (T,)},
174
+ "PodcastSeries": {"webFeed": (U,)},
175
+ "PodcastEpisode": {"partOfSeries": ("node:PodcastSeries",), "duration": (T,),
176
+ "audio": ("node:AudioObject",), "episodeNumber": (I,),
177
+ "associatedMedia": ("node:MediaObject",)},
178
+ "Course": {"courseCode": (T,)},
179
+ "Quiz": {"hasPart": ("node:Question",), "assesses": (T,)},
180
+ "JobPosting": {"title": (T,), "datePosted": (D,), "validThrough": (D,),
181
+ "hiringOrganization": ("node:Organization",),
182
+ "jobLocation": ("node:Place",), "employmentType": (T,),
183
+ "baseSalary": ("node:MonetaryAmount",), "jobLocationType": (T,)},
184
+ "MonetaryAmount": {"currency": (T,), "value": (N, T, "node:QuantitativeValue")},
185
+ "QuantitativeValue": {"value": (N, T), "unitText": (T,), "minValue": (N,), "maxValue": (N,)},
186
+ "PropertyValue": {"value": (N, T), "propertyID": (T,), "unitText": (T,)},
187
+ "HowTo": {"step": ("node:HowToStep", "node:HowToSection"), "totalTime": (T,)},
188
+ "Recipe": {"recipeIngredient": (T,),
189
+ "recipeInstructions": (T, "node:HowToStep", "node:HowToSection"),
190
+ "recipeYield": (T,), "prepTime": (T,), "cookTime": (T,),
191
+ "recipeCategory": (T,), "recipeCuisine": (T,),
192
+ "nutrition": ("node:NutritionInformation",), "video": ("node:VideoObject",)},
193
+ "NutritionInformation": {"calories": (T,)},
194
+ "HowToStep": {},
195
+ "HowToSection": {"itemListElement": ("node:HowToStep",)},
196
+ "Book": {"isbn": (T,), "bookFormat": (U,), "numberOfPages": (I,), "bookEdition": (T,),
197
+ "workExample": ("node:Book",)},
198
+ "Movie": {"director": ("node:Person",), "actor": ("node:Person",), "duration": (T,),
199
+ "trailer": ("node:VideoObject",)},
200
+ "Dataset": {"variableMeasured": (T, "node:PropertyValue"), "measurementTechnique": (T,),
201
+ "temporalCoverage": (T,), "spatialCoverage": (T, "node:Place"),
202
+ "distribution": ("node:DataDownload",),
203
+ "includedInDataCatalog": ("node:DataCatalog",)},
204
+ "Question": {"acceptedAnswer": ("node:Answer",), "suggestedAnswer": ("node:Answer",),
205
+ "answerCount": (I,), "upvoteCount": (I,)},
206
+ "Answer": {"upvoteCount": (I,)},
207
+ "DiscussionForumPosting": {"comment": ("node:Comment",), "commentCount": (I,)},
208
+ "Comment": {"upvoteCount": (I,)},
209
+ "TechArticle": {"proficiencyLevel": (T,)},
210
+ "APIReference": {"programmingModel": (T,), "targetPlatform": (T,)},
211
+ "SpeakableSpecification": {"cssSelector": (T,), "xpath": (T,)},
212
+ })
213
+
214
+ KNOWN_TYPES = frozenset(PARENTS) | frozenset(OTHER_TYPES) | {"Thing"}
215
+
216
+
217
+ def ancestors(type_name: str) -> list[str]:
218
+ """The type followed by its modelled ancestors, nearest first."""
219
+ chain = [type_name]
220
+ while chain[-1] in PARENTS:
221
+ chain.append(PARENTS[chain[-1]])
222
+ return chain
223
+
224
+
225
+ def is_subtype(type_name: str, parent: str) -> bool:
226
+ return parent in ancestors(type_name)
227
+
228
+
229
+ def props_for(type_name: str) -> dict[str, tuple[str, ...]]:
230
+ merged: dict[str, tuple[str, ...]] = {}
231
+ for t in reversed(ancestors(type_name)):
232
+ merged.update(PROPS.get(t, {}))
233
+ return merged
234
+
235
+
236
+ _DATE = re.compile(
237
+ r"^[0-9]{4}-[0-9]{2}-[0-9]{2}"
238
+ r"(T[0-9]{2}:[0-9]{2}(:[0-9]{2}(\.[0-9]+)?)?(Z|[+-][0-9]{2}:[0-9]{2})?)?$")
239
+
240
+
241
+ def is_iso_date(value: object) -> bool:
242
+ """ISO 8601 date or date-time (ASCII digits only), with a real calendar value."""
243
+ if not isinstance(value, str) or not _DATE.match(value):
244
+ return False
245
+ try:
246
+ datetime.fromisoformat(value)
247
+ except ValueError:
248
+ return False
249
+ return True
250
+
251
+
252
+ def is_http_url(value: object) -> bool:
253
+ if not isinstance(value, str) or not value or value != value.strip():
254
+ return False
255
+ if any(ch.isspace() or ord(ch) < 32 for ch in value):
256
+ return False
257
+ parts = urlparse(value)
258
+ return parts.scheme in ("http", "https") and bool(parts.netloc)
259
+
260
+
261
+ _NUM = re.compile(r"^-?[0-9]+(\.[0-9]+)?$")
262
+ _DURATION = re.compile(
263
+ r"^P(?=[0-9T])([0-9]+Y)?([0-9]+M)?([0-9]+W)?([0-9]+D)?(T(?=[0-9])([0-9]+H)?([0-9]+M)?"
264
+ r"([0-9]+(\.[0-9]+)?S)?)?$")
265
+ _TIME = re.compile(r"^([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$")
266
+
267
+
268
+ def is_number(value: object) -> bool:
269
+ """A finite real number, or text holding one (``"19.99"``). Never a bool."""
270
+ if isinstance(value, bool):
271
+ return False
272
+ if isinstance(value, (int, float)):
273
+ return math.isfinite(value)
274
+ return isinstance(value, str) and bool(_NUM.match(value))
275
+
276
+
277
+ def is_duration(value: object) -> bool:
278
+ """ISO 8601 duration such as ``PT1H30M`` or ``P1DT2H``."""
279
+ return isinstance(value, str) and bool(_DURATION.match(value))
280
+
281
+
282
+ def is_time(value: object) -> bool:
283
+ """24-hour ``HH:MM`` (optionally ``:SS``)."""
284
+ return isinstance(value, str) and bool(_TIME.match(value))
285
+
286
+
287
+ def rating_problem(node: dict) -> str | None:
288
+ """Why a Rating node's ``ratingValue`` is out of range, or None.
289
+
290
+ The range is ``worstRating``..``bestRating`` with schema.org's defaults of 1 and 5.
291
+ Values that are not numbers are left to the type checks.
292
+ """
293
+ def num(key, default):
294
+ raw = node.get(key, default)
295
+ if isinstance(raw, bool) or not is_number(raw):
296
+ return None
297
+ return float(raw)
298
+
299
+ value, worst, best = num("ratingValue", None), num("worstRating", 1), num("bestRating", 5)
300
+ if value is None or worst is None or best is None:
301
+ return None
302
+ if worst > best or not worst <= value <= best:
303
+ return (f"ratingValue {node['ratingValue']} is outside the range {node.get('worstRating', 1)}"
304
+ f" to {node.get('bestRating', 5)} (worstRating and bestRating default to 1 and 5)")
305
+ return None
@@ -0,0 +1,268 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/bemoshiur/OmniRank/main/schemas/omnirank.config.schema.json",
4
+ "title": "OmniRank site configuration",
5
+ "type": "object",
6
+ "required": ["site"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "$schema": { "type": "string" },
10
+ "site": {
11
+ "type": "object",
12
+ "required": ["name", "url", "entityType"],
13
+ "additionalProperties": false,
14
+ "properties": {
15
+ "name": { "type": "string", "minLength": 1 },
16
+ "legalName": { "type": "string" },
17
+ "url": { "type": "string", "format": "uri", "pattern": "^https?://" },
18
+ "entityType": {
19
+ "enum": ["Organization", "LocalBusiness", "ProfessionalService",
20
+ "NewsMediaOrganization", "SoftwareApplication",
21
+ "EducationalOrganization", "MedicalOrganization"]
22
+ },
23
+ "parentOrganization": { "type": "string" },
24
+ "locales": {
25
+ "type": "array",
26
+ "items": {
27
+ "type": "object",
28
+ "required": ["code", "path"],
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "code": { "type": "string" },
32
+ "path": { "type": "string" },
33
+ "default": { "type": "boolean" }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ },
39
+ "nap": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "properties": {
43
+ "street": { "type": "string" }, "city": { "type": "string" },
44
+ "region": { "type": "string" }, "postalCode": { "type": "string" },
45
+ "country": { "type": "string" }, "phone": { "type": "string" },
46
+ "email": { "type": "string" },
47
+ "geo": {
48
+ "type": "object",
49
+ "required": ["lat", "lng"],
50
+ "additionalProperties": false,
51
+ "properties": { "lat": { "type": "number" }, "lng": { "type": "number" } }
52
+ },
53
+ "openingHours": { "type": "array", "items": { "type": "string" } }
54
+ }
55
+ },
56
+ "identifiers": { "type": "object", "additionalProperties": { "type": "string" } },
57
+ "sameAs": {
58
+ "type": "object",
59
+ "additionalProperties": { "type": ["string", "null"] }
60
+ },
61
+ "stack": {
62
+ "type": "object",
63
+ "additionalProperties": false,
64
+ "properties": {
65
+ "framework": {
66
+ "enum": ["next-app-router", "next-pages", "next-pages-router", "astro",
67
+ "nuxt", "sveltekit", "wordpress", "jekyll", "hugo", "eleventy",
68
+ "shopify", "static", "other"],
69
+ "description": "Routing convention. `next-pages` is the historical spelling of `next-pages-router` and both remain valid. `shopify` and `other` have no locator implementation, so findings on those projects are display-only. omnirank fix detects this from disk when it is unset."
70
+ },
71
+ "srcDir": { "type": "string" },
72
+ "publicDir": { "type": "string" },
73
+ "builtHtml": { "type": "string" }
74
+ }
75
+ },
76
+ "crawlers": {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "properties": {
80
+ "allowAI": { "type": "boolean", "deprecated": true, "description": "Deprecated and never read: it declared a single yes/no intent for every AI crawler. Use `crawlerPolicy` (training / search / userFetch: allow | block), which sweep checks against robots.txt." },
81
+ "disallow": { "type": "array", "items": { "type": "string" } }
82
+ }
83
+ },
84
+ "geo": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "properties": {
88
+ "license": {
89
+ "type": ["string", "null"],
90
+ "description": "Content reuse licence to state in llms.txt/llms-full.txt and facts.json (e.g. \"CC-BY-4.0\"). Absent: `omnirank geo` grants no reuse rights (same as \"none\" below) and prints a one-line stderr notice naming this key, so the choice isn't made silently. Set to a real licence string to grant reuse rights. Set to the string \"none\" (or JSON null) to state the no-grant choice explicitly and silence the notice -- functionally identical to leaving it unset, but a deliberate record of the choice."
91
+ },
92
+ "attribution": { "type": "string" },
93
+ "answerBlockSelector": { "type": "string" }
94
+ }
95
+ },
96
+ "aeo": {
97
+ "type": "object",
98
+ "additionalProperties": false,
99
+ "description": "AnswerBlock sizing. The default 40-60 word band is calibrated for space-delimited Latin script; scripts without word separators need character counting.",
100
+ "properties": {
101
+ "answerBlock": {
102
+ "type": "object",
103
+ "additionalProperties": false,
104
+ "required": ["default"],
105
+ "properties": {
106
+ "default": { "$ref": "#/$defs/band" },
107
+ "byScript": {
108
+ "type": "object",
109
+ "additionalProperties": { "$ref": "#/$defs/band" },
110
+ "description": "Override per script family: latin, cjk, brahmic, arabic, cyrillic."
111
+ }
112
+ }
113
+ }
114
+ }
115
+ },
116
+ "indexing": {
117
+ "type": "object",
118
+ "additionalProperties": false,
119
+ "properties": {
120
+ "indexnowKeyFile": { "type": "string" },
121
+ "gscProperty": { "type": "string" },
122
+ "bing": { "type": "boolean" },
123
+ "wayback": { "type": "boolean" },
124
+ "priorityUrls": { "type": "string" }
125
+ }
126
+ },
127
+ "crawlerPolicy": {
128
+ "type": "object",
129
+ "description": "Your own per-category choice for AI crawlers. OmniRank never picks one for you: when set, `omnirank sweep` reports whether robots.txt matches it (a mismatch is a warning-level finding only for a category you set). `omnirank sweep --crawler-snippet` prints a robots.txt snippet for these choices to stdout; nothing is written. robots.txt is advisory.",
130
+ "additionalProperties": false,
131
+ "properties": {
132
+ "training": { "enum": ["allow", "block"] },
133
+ "search": { "enum": ["allow", "block"] },
134
+ "userFetch": { "enum": ["allow", "block"] }
135
+ }
136
+ },
137
+ "tracking": { "type": "object", "additionalProperties": { "type": "string" } },
138
+ "audit": {
139
+ "type": "object",
140
+ "additionalProperties": false,
141
+ "properties": {
142
+ "sampleSize": { "type": "integer", "minimum": 0 },
143
+ "failOn": {
144
+ "type": "array",
145
+ "items": {
146
+ "enum": ["h1", "canonical", "title-length", "description-length", "hreflang",
147
+ "og", "image-dims", "answer-block", "faq", "speakable",
148
+ "llms-txt", "llms-full", "facts-json", "ai-allowlist",
149
+ "citation-licence", "crawler-policy", "sitemap-health",
150
+ "lastmod-inflation", "schema", "schema-fabrication",
151
+ "duplicate-title", "duplicate-description", "noindex-in-sitemap",
152
+ "canonical-cluster", "hreflang-reciprocity",
153
+ "response-time", "page-weight", "compression", "render-blocking",
154
+ "hsts", "nosniff", "csp", "referrer-policy",
155
+ "mixed-content", "https-redirect", "robots-sitemap",
156
+ "canonical-target", "hreflang-noindex", "schema-required",
157
+ "image-alt", "heading-order", "link-text", "lang"]
158
+ }
159
+ }
160
+ }
161
+ },
162
+ "smm": {
163
+ "type": "object",
164
+ "additionalProperties": false,
165
+ "properties": {
166
+ "platforms": {
167
+ "type": "array",
168
+ "items": { "enum": ["facebook", "instagram", "x", "linkedin", "youtube"] }
169
+ },
170
+ "queueDir": { "type": "string" },
171
+ "requireHumanApproval": { "type": "boolean" }
172
+ }
173
+ },
174
+ "competitors": { "type": "array", "items": { "type": "string" } },
175
+ "statistics": {
176
+ "type": "array",
177
+ "description": "First-party benchmarks. Only entries with published:true are emitted to facts.json.",
178
+ "items": {
179
+ "type": "object",
180
+ "required": ["name", "value"],
181
+ "additionalProperties": false,
182
+ "properties": {
183
+ "name": { "type": "string" },
184
+ "value": { "type": "string" },
185
+ "unit": { "type": "string" },
186
+ "sampleSize": { "type": "integer", "minimum": 0 },
187
+ "methodology": { "type": "string" },
188
+ "asOf": { "type": "string" },
189
+ "source": { "type": "string" },
190
+ "published": {
191
+ "type": "boolean",
192
+ "description": "Real-only gate. Absent or false means the statistic renders nowhere."
193
+ }
194
+ }
195
+ }
196
+ },
197
+ "report": {
198
+ "type": "object",
199
+ "additionalProperties": false,
200
+ "description": "Settings for `omnirank report`. `cta: false` removes the consulting footer line from HTML and Markdown reports (the same as --no-cta); it never appears in JSON, SARIF, JUnit or CSV.",
201
+ "properties": {
202
+ "cta": { "type": "boolean", "default": true }
203
+ }
204
+ },
205
+ "track": {
206
+ "type": "object",
207
+ "additionalProperties": false,
208
+ "description": "Settings for `omnirank track ai` (BYOK AI-answer tracking). Brand = site.name (+ site.legalName and brandAliases); competitors come from the top-level `competitors` list. API keys are NEVER stored here: they are read from GEMINI_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY and PERPLEXITY_API_KEY.",
209
+ "properties": {
210
+ "brandAliases": { "type": "array", "maxItems": 20, "items": { "type": "string", "minLength": 1, "maxLength": 100 } },
211
+ "brandDomains": { "type": "array", "maxItems": 20, "items": { "type": "string", "minLength": 1, "maxLength": 253 }, "description": "Bare host names (example.com) counted as your site when engines cite sources; the host of site.url is included automatically." },
212
+ "models": {
213
+ "type": "object",
214
+ "additionalProperties": false,
215
+ "description": "Model per engine. A model missing from OmniRank's dated pricing table needs a `pricing` entry.",
216
+ "properties": {
217
+ "gemini": { "type": "string" }, "anthropic": { "type": "string" },
218
+ "openai": { "type": "string" }, "perplexity": { "type": "string" }
219
+ }
220
+ },
221
+ "pricing": {
222
+ "type": "object",
223
+ "additionalProperties": false,
224
+ "description": "Your own prices (USD) per engine; they replace OmniRank's dated table for that engine.",
225
+ "properties": {
226
+ "gemini": { "$ref": "#/$defs/price" }, "anthropic": { "$ref": "#/$defs/price" },
227
+ "openai": { "$ref": "#/$defs/price" }, "perplexity": { "$ref": "#/$defs/price" }
228
+ }
229
+ }
230
+ }
231
+ },
232
+ "secrets": {
233
+ "type": "object",
234
+ "additionalProperties": {
235
+ "type": "string",
236
+ "pattern": "^env:[A-Z_][A-Z0-9_]*$",
237
+ "description": "Must be an env: pointer. Literal secrets are rejected by design."
238
+ }
239
+ }
240
+ },
241
+ "$defs": {
242
+ "price": {
243
+ "type": "object",
244
+ "additionalProperties": false,
245
+ "required": ["model", "inputPerMTok", "outputPerMTok"],
246
+ "properties": {
247
+ "model": { "type": "string", "minLength": 1, "maxLength": 80 },
248
+ "inputPerMTok": { "type": "number", "minimum": 0 },
249
+ "outputPerMTok": { "type": "number", "minimum": 0 },
250
+ "perSearch": { "type": "number", "minimum": 0 },
251
+ "perRequest": { "type": "number", "minimum": 0 },
252
+ "searchInputTokens": { "type": "integer", "minimum": 0 },
253
+ "checkedOn": { "type": "string" },
254
+ "source": { "type": "string" }
255
+ }
256
+ },
257
+ "band": {
258
+ "type": "object",
259
+ "additionalProperties": false,
260
+ "required": ["unit", "min", "max"],
261
+ "properties": {
262
+ "unit": { "enum": ["words", "chars"] },
263
+ "min": { "type": "integer", "minimum": 1 },
264
+ "max": { "type": "integer", "minimum": 1 }
265
+ }
266
+ }
267
+ }
268
+ }
File without changes