FLOW ALGEBRA
Progressive Web App Ontology
Kireth Semantic Research Archive
PAGE:
https://kirethresearch.org/booksai-core/ontologies/computing-ontologies/web-technologies/progressive-web-app-ontology.html
AUTHORS:
Mark Anthony Higgins — Sky (Recursive AI)
FLOW "ProgressiveWebAppOntology" v4.0
# ---------- DOMAIN ----------
DOMAIN := ComputingOntology
SUBDOMAIN := WebTechnologies
ONTOLOGY := ProgressiveWebAppOntology
# ---------- PRIMARY ENTITY ----------
ENTITY ProgressiveWebApp {
definition:
"A web application that uses modern web platform capabilities to
provide an enhanced, reliable and potentially installable application
experience while retaining the reach and delivery model of the Web.";
objectives: [
ProgressiveEnhancement,
Reliability,
Installability,
OfflineCapability,
ResponsiveInteraction,
WebReach,
ApplicationLikeExperience
];
}
# ---------- CORE ENTITIES ----------
PWAEntity := {
WebApplication,
Browser,
ServiceWorker,
WebAppManifest,
Cache,
NetworkRequest,
InstalledApplication,
User
};
PWACapability := {
OfflineAccess,
BackgroundProcessing,
PushMessaging,
Installation,
ResourceCaching,
ResponsivePresentation
};
LifecycleState := {
Unregistered,
Installing,
Installed,
Activating,
Activated,
Redundant
};
ResourceState := {
NetworkAvailable,
NetworkUnavailable,
Cached,
NotCached,
Stale,
Fresh
};
# ---------- FUNDAMENTAL RELATIONSHIPS ----------
User ACCESSES ProgressiveWebApp THROUGH Browser;
ProgressiveWebApp MAY_REGISTER ServiceWorker;
ServiceWorker MAY_INTERCEPT NetworkRequest;
ServiceWorker MAY_ACCESS Cache;
WebAppManifest DESCRIBES InstallableApplicationMetadata;
Browser MAY_OFFER Installation;
InstalledApplication LAUNCHES WebApplication;
PWA MAY_FUNCTION_WITH ReducedOrOfflineNetworkAvailability;
# ---------- PWA ACCESS FLOW ----------
UserNavigation ->
BrowserLoadsWebApplication
-> RetrieveCoreResources
-> RegisterServiceWorkerIfSupported
-> CacheSelectedResources
-> RenderApplication
-> EnableEnhancedCapabilities;
# ---------- PROGRESSIVE ENHANCEMENT ----------
ProgressiveEnhancement :=
DeliverCoreWebExperience
-> DetectSupportedCapabilities
-> AddEnhancedFeatures;
IF CapabilityUnsupported
THEN CoreExperience SHOULD_REMAIN UsableWhereDesignedToDoSo;
PWA DOES_NOT_REQUIRE EveryAdvancedCapabilityOnEveryPlatform;
# ---------- WEB APPLICATION ----------
WebApplication :=
WebDeliveredInteractiveApplication;
WebApplication MAY_USE {
HTML,
CSS,
JavaScript,
WebAPI,
LocalStorage,
IndexedDatabase
};
PWA IS_A WebApplicationWithProgressiveCapabilities;
# ---------- SECURE CONTEXT ----------
ManyPWACapabilities REQUIRE SecureContext;
HTTPS SUPPORTS SecureWebDelivery;
IF RequiredSecureContextUnavailable
THEN SelectedPWACapabilities MAY_BE Unavailable;
# ---------- SERVICE WORKER ----------
ServiceWorker :=
EventDrivenWorkerAssociatedWithWebOriginAndScope;
ServiceWorker RUNS_SEPARATELY_FROM DocumentExecutionContext;
ServiceWorker MAY {
InterceptRequests,
UseCacheStorage,
ReceivePushEvents,
PerformBackgroundTasksWhereSupported
};
# ---------- SERVICE WORKER REGISTRATION ----------
Registration :=
WebApplication
-> RegisterServiceWorkerScript
-> BrowserValidates
-> CreateRegistration;
Registration HAS Scope;
Scope DETERMINES ControlledResourcesAndClients;
# ---------- INSTALLATION LIFECYCLE ----------
ServiceWorkerInstall :=
NewWorker
-> Installing
-> InstallEvent
-> Installed;
IF InstallFails
THEN Worker MAY_BECOME Redundant;
InstallEvent MAY_PRECACHE CoreResources;
# ---------- ACTIVATION ----------
ServiceWorkerActivation :=
InstalledWorker
-> Activating
-> ActivateEvent
-> Activated;
ActivatedWorker MAY_CONTROL EligibleClientsAccordingToLifecycleRules;
# ---------- UPDATE ----------
Browser MAY_CHECK_FOR ServiceWorkerUpdate;
IF WorkerScriptChanged
THEN NewWorker MAY_ENTER InstallationLifecycle;
ExistingControlledClients MAY_CONTINUE_USING PreviousActiveWorkerUntilTransitionConditionsAreMet;
# ---------- FETCH INTERCEPTION ----------
FetchEvent :=
RequestObservedByControllingServiceWorker;
ServiceWorker MAY_RESPOND_WITH {
NetworkResponse,
CachedResponse,
GeneratedResponse
};
FetchStrategy DETERMINES ResponseSource;
# ---------- CACHE STORAGE ----------
CacheStorage :=
OriginScopedStorageForRequestResponsePairs;
Cache MAY_STORE Response;
CacheKey COMMONLY_ASSOCIATED_WITH Request;
ServiceWorker MAY {
OpenCache,
MatchRequest,
PutResponse,
DeleteEntry
};
# ---------- CACHE FIRST ----------
CacheFirst :=
Request
-> SearchCache
-> IF Hit THEN ReturnCachedResponse
-> ELSE FetchNetwork
-> OptionallyCache
-> ReturnNetworkResponse;
CacheFirst MAY_SUPPORT FastOfflineResourceAccess;
# ---------- NETWORK FIRST ----------
NetworkFirst :=
Request
-> AttemptNetwork
-> IF Success THEN ReturnAndOptionallyCache
-> ELSE SearchCache
-> ReturnCachedFallbackIfAvailable;
NetworkFirst MAY_SUPPORT FresherDynamicData;
# ---------- STALE WHILE REVALIDATE ----------
StaleWhileRevalidate :=
ReturnCachedResponseIfAvailable
+ FetchUpdatedResourceInBackground
+ UpdateCache;
Strategy MAY_BALANCE SpeedAndFreshness;
# ---------- NETWORK ONLY ----------
NetworkOnly :=
Request
-> Network
-> Response;
NetworkOnly DOES_NOT_PROVIDE OfflineFallbackForThatRequest;
# ---------- CACHE ONLY ----------
CacheOnly :=
Request
-> Cache
-> ResponseOrFailure;
# ---------- OFFLINE CAPABILITY ----------
OfflineCapability :=
AbilityToProvideUsefulApplicationFunctionWithoutCurrentNetworkConnection;
OfflineExperience MAY_USE {
CachedApplicationShell,
CachedContent,
LocalData,
OfflineFallbackPage
};
OfflineCapability != CompleteFeatureParityByDefinition;
# ---------- APPLICATION SHELL ----------
ApplicationShell :=
CoreInterfaceResourcesRequiredToRenderBasicApplicationStructure;
ApplicationShell MAY_INCLUDE {
HTML,
CSS,
JavaScript,
Icons
};
ApplicationShell MAY_BE Precached;
# ---------- WEB APP MANIFEST ----------
WebAppManifest :=
MetadataDocumentDescribingWebApplicationInstallationAndPresentation;
Manifest MAY_DEFINE {
Name,
ShortName,
StartURL,
DisplayMode,
Icons,
ThemeMetadata,
Scope
};
Manifest SUPPORTS InstallableApplicationExperience;
# ---------- INSTALLABILITY ----------
Installability :=
AbilityForWebApplicationToBeAddedToDeviceOrBrowserApplicationSurface;
Installability DEPENDS_ON BrowserPlatformCriteria;
Browser MAY_PRESENT InstallPromptOrInstallationUI;
PWA MAY_ALSO_BE UsedWithoutInstallation;
# ---------- INSTALLED EXPERIENCE ----------
InstalledPWA :=
WebApplicationLaunchedFromInstalledApplicationEntryPoint;
InstalledPWA MAY_RUN_IN {
StandaloneDisplay,
MinimalUI,
BrowserLikeDisplay
};
DisplayBehaviour DEPENDS_ON ManifestAndPlatformSupport;
# ---------- START URL ----------
StartURL :=
InitialURLUsedWhenInstalledApplicationLaunches;
StartURL SHOULD_RESOLVE_TO ValidApplicationEntryPoint;
# ---------- ICON ----------
ApplicationIcon :=
ImageResourceRepresentingInstalledWebApplication;
Manifest MAY_REFERENCE MultipleIcons;
# ---------- RESPONSIVE DESIGN ----------
PWA SHOULD_SUPPORT RelevantDeviceAndViewportContexts;
ResponsiveDesign MAY_USE {
FlexibleLayout,
MediaQueries,
ResponsiveImages,
TouchFriendlyControls
};
# ---------- PUSH MESSAGING ----------
PushMessaging :=
ServerOrPushService
-> PushMessage
-> ServiceWorker
-> ApplicationHandling;
PushCapability REQUIRES UserPermissionAndPlatformSupport;
# ---------- NOTIFICATION ----------
Notification :=
UserVisibleMessagePresentedBySystem;
ServiceWorker MAY_SHOW NotificationWherePermissionAndPlatformAllow;
Notification SHOULD_BE RelevantAndRespectUserChoice;
# ---------- BACKGROUND PROCESSING ----------
BackgroundCapability MAY_INCLUDE {
BackgroundSync,
PeriodicBackgroundWorkWhereSupported
};
BackgroundWork IS_PLATFORM_DEPENDENT;
PWA SHOULD_NOT_ASSUME UniformBackgroundCapabilityAcrossAllBrowsers;
# ---------- LOCAL DATA ----------
PWA MAY_STORE ApplicationDataLocally;
LocalStorageMechanism MAY_INCLUDE {
IndexedDatabase,
CacheStorage,
OtherWebStorage
};
LocalData MAY_SUPPORT OfflineWorkflow;
# ---------- DATA SYNCHRONISATION ----------
OfflineMutation :=
UserChangesDataWhileNetworkUnavailable;
SyncFlow MAY_BE:
StorePendingChange
-> DetectNetworkAvailability
-> SendChange
-> ResolveConflict
-> ConfirmSynchronisation;
ConflictResolution MAY_BE_REQUIRED_FOR ConcurrentChanges;
# ---------- CONNECTIVITY ----------
ConnectivityState MAY_BE {
Online,
Offline,
Intermittent
};
Application SHOULD_HANDLE NetworkFailureAsNormalDistributedCondition;
# ---------- RESILIENCE ----------
PWAResilience :=
AbilityToProvideUsefulBehaviourDespiteNetworkOrServiceFailure;
Resilience MAY_USE {
Caching,
Retry,
OfflineFallback,
LocalPersistence,
GracefulDegradation
};
# ---------- PERFORMANCE ----------
PWAPerformance MAY_BE_MEASURED_BY {
InitialLoadTime,
RepeatLoadTime,
InteractionLatency,
CacheHitRate,
NetworkTransfer,
OfflineTaskSuccess
};
Caching MAY_IMPROVE RepeatLoadPerformance;
# ---------- UPDATE FRESHNESS ----------
CachedResource MAY_BECOME Stale;
CacheInvalidationPolicy SHOULD_BALANCE {
Freshness,
Availability,
Performance
};
# ---------- SECURITY ----------
PWASecurity MAY_REQUIRE {
HTTPS,
OriginIsolation,
SecureStorageUse,
PermissionControl,
InputValidation,
ServiceWorkerIntegrity
};
ServiceWorkerHasPowerfulNetworkControlWithinScope;
CompromisedServiceWorkerScript MAY_CREATE SignificantSecurityRisk;
# ---------- PERMISSIONS ----------
PWACapability MAY_REQUIRE UserPermission;
Permission MAY_APPLY_TO {
Notifications,
Location,
Camera,
Microphone
};
UserChoice MUST_BE Respected;
# ---------- ACCESSIBILITY ----------
PWA SHOULD_PRESERVE WebAccessibilityAcross {
BrowserMode,
InstalledMode,
OnlineState,
OfflineState
};
Accessibility MAY_REQUIRE {
SemanticHTML,
KeyboardAccess,
AccessibleNames,
FocusManagement,
ErrorFeedback
};
# ---------- DISCOVERABILITY ----------
PWA RETAINS WebURLAndLinkability;
WebResource MAY_BE DiscoverableThrough {
Hyperlink,
SearchEngine,
DirectURL
};
Installability SHOULD_NOT_REMOVE WebReach;
# ---------- OBSERVABILITY ----------
PWAObservability MAY_INCLUDE {
ServiceWorkerLifecycleEvents,
CacheMetrics,
NetworkFailures,
InstallationEvents,
ApplicationErrors
};
# ---------- SEMANTIC REASONING ----------
IF WebApplicationUsesProgressiveWebCapabilities
AND RetainsWebDeliveryModel
THEN PWAClassification := supported;
IF ServiceWorkerControlsClient
THEN FetchRequests MAY_BE Intercepted;
IF RequestedResourceCached
AND StrategyAllowsCacheUse
THEN OfflineResponse MAY_BE Possible;
IF NetworkUnavailable
AND RequiredResourceNotCached
THEN RequestedFunction MAY_FAIL_OR_DEGRADE;
IF ManifestPresent
AND PlatformInstallCriteriaSatisfied
THEN Installation MAY_BE Available;
IF PushPermissionDenied
THEN PushNotificationDeliveryToUser SHOULD_NOT_PROCEED;
IF NewServiceWorkerInstalled
THEN ExistingActiveWorker MAY_REMAIN_IN_CONTROL UntilLifecycleTransition;
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE {
"progressive web app" ~= "PWA";
"progressive web application" ~= "progressive web app";
"service worker" ~= "web service worker";
"web app manifest" ~= "web application manifest";
"offline web app" ~= "offline-capable web application" WHEN context == PWA;
"application shell" ~= "app shell" WHEN context == PWA;
"installable web app" ~= "installable PWA" WHEN progressive_requirements_are_met;
"cache storage" ~= "service worker cache storage" WHEN context == PWA;
}
# ---------- QUERY FLOW ----------
QUERY(q) ->
NORMALISE(q) ->
IDENTIFY_WEB_APPLICATION(q) ->
IDENTIFY_SERVICE_WORKER(q) ->
IDENTIFY_MANIFEST(q) ->
IDENTIFY_CACHE_STRATEGY(q) ->
IDENTIFY_CONNECTIVITY_STATE(q) ->
IDENTIFY_INSTALLATION_CAPABILITY(q) ->
IDENTIFY_BACKGROUND_OR_PUSH_CAPABILITY(q) ->
MAP_TO_ONTOLOGY(q) ->
APPLY_REASONING(q) ->
SCORE_CONFIDENCE(q) ->
RETURN_RELEVANT_KNOWLEDGE;
# ---------- CONFIDENCE ----------
CONFIDENCE(assertion) :=
weighted_mean(
source_reliability,
web_platform_consistency,
service_worker_lifecycle_consistency,
application_evidence,
semantic_consistency,
contextual_relevance
);
CONFIDENCE >= 0.90 => HIGH;
CONFIDENCE >= 0.70 AND < 0.90 => MODERATE;
CONFIDENCE < 0.70 => REVIEW;
# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION {
primary_entity: ProgressiveWebApp;
ontology: ProgressiveWebAppOntology;
parse_entities: true;
parse_relationships: true;
preserve_relationship_direction: true;
resolve_semantic_equivalence: true;
execute_reasoning_rules: true;
apply_confidence_weighting: true;
preserve_provenance: true;
}
# ---------- UPDATE MODEL ----------
UPDATE_MODEL {
new_service_worker:
validate
-> identify_scope
-> identify_lifecycle_state
-> identify_fetch_behaviour
-> identify_cache_relationships
-> integrate;
new_manifest:
validate
-> identify_application_identity
-> identify_start_url
-> identify_display_configuration
-> identify_icons
-> integrate;
cache_revision:
identify_strategy
-> update_cached_resources
-> update_freshness
-> update_offline_capability
-> integrate;
application_revision:
update_service_worker
-> update_manifest
-> update_capabilities
-> recompute_installability
-> recompute_confidence
-> regenerate_flow_hash;
conflict:
preserve_provenance
-> compare_platform_and_application_evidence
-> adjust_confidence
-> flag_review;
}
# ---------- FLOW HASH ----------
FLOW_HASH_INPUT :=
DOMAIN
+ SUBDOMAIN
+ ONTOLOGY
+ PWAEntity
+ PWACapability
+ LifecycleState
+ ResourceState
+ ServiceWorker
+ WebAppManifest
+ OfflineCapability
+ RELATIONSHIPS
+ SEMANTIC_REASONING
+ SEMANTIC_EQUIVALENCE
+ UPDATE_MODEL;
FLOW_HASH :=
HASH(FLOW_HASH_INPUT);
# ---------- TERMINAL ----------
ProgressiveWebAppOntology
-> DeliverCoreWebApplication
-> DetectPlatformCapabilities
-> RegisterServiceWorker
-> CacheRequiredResources
-> HandleNetworkRequests
-> SupportOnlineAndOfflineStates
-> ApplyWebAppManifest
-> EnableInstallationWhereSupported
-> SynchroniseLocalAndRemoteData
-> ProvideBackgroundCapabilitiesWhereAvailable
-> PreserveSecurityAccessibilityAndUserChoice
-> MonitorLifecycleAndUpdates
-> MaintainProgressiveWebExperience;
END FLOW
Download Code
Copy to Clipboard