Repository navigation
Web Rules, Requirements, and Preferences #10
AdamSobieski
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Introduction
Presented here are new techniques involving: (1) uses of
<link>metadata elements to reference any rules, requirements, or preferences pertaining to hypertext documents and their elements (e.g., from style guides or rubrics), (2) a JSON-LD ontology to represent these rules, requirements, and preferences, and (3) interoperation with a potential Decisions API to verify documents and their elements with respect to these rules, requirements, and preferences.Requirements and preferences can describe hypertext documents and their elements, including with respect to their semantics, pragmatics, stylistics, grammaticality, and vocabulary.
Definitions
A
Rulecan conditionally perform one or more actions. Rules are created using a reduced set of nestable abstract computational operators.A
Requirementis aRulewhich can conditionally produce one or moreMessage,Warning, orErrorinstances about a document or its elements, e.g., when its conditions aren't met.A
Preferenceis aRulewhich can conditionally produce one or moreCostorScoreinstances about a document or its elements. These would be summed across documents and their elements. Costs would be sought to be minimized while scores would be sought to be maximized.Use Cases
Considered use cases include, but are not limited to: (1) natural-language engineering design, (2) both single-author and collaborative writing and editing scenarios, including those involving natural-language generation by artificial-intelligence systems, (3) the automated analysis, evaluation, and assessment of natural-language hypertext documents, and (4) enhancing scholarly and scientific communication.
Examples
The following example shows how Web Requirements could be referenced from hypertext documents using
<link>metadata elements.An article-specific resource,
article-34969.jsonld, might include JSON-LD content resembling:[ { "@context": "http://standard.org/", "@type": "Data", "data": { "subject": { "fullName": "Benjamin Franklin", "dateOfBirth": "January 17, 1706", "dateOfDeath": "April 17, 1790", "occupation": [ "politician", "publisher", "printer", "political theorist", "postmaster", "inventor", "political activist", "statesperson", "diplomat", "dilettante", "polymath", "chess player", "designer", "musician", "political philosopher", "autobiographer", "librarian", "journalist", "economist", "physicist", "editor", "writer", "philosopher", "naturalist", "book printer" ] } } } ]A general-purpose, reusable resource,
encyclopedia-article.jsonld, might include JSON-LD content resembling:[ { "@context": "http://standard.org/", "@id": "http://encyclopedia.org/requirements/neutrality", "@type": "Requirement", "do": { "@type": "ForEachCssSelection", "value": "article p", "as": "x", "do": { "@type": "Question", "question": "Does `x` have a neutral and objective tone?", "as": "conf", "do": { "@type": "Interval", "using": "conf", "lessThan": "0.5", "do": { "@type": "Error", "on": "x", "message": "This paragraph must have a neutral and objective tone." } } } } } ]A general-purpose, reusable resource,
biographical-article.jsonld, might include JSON-LD content resembling:[ { "@context": "http://standard.org/", "@type": "Requirement", "do": { "@type": "ForEachCssSelection", "value": "article.biography p", "as": "x", "do": { "@type": "Question", "question": "Does `x` mention {{data.subject.fullName}}?", "as": "conf", "do": { "@type": "Interval", "using": "conf", "greaterThanOrEqual": "0.5", "do": { "@type": "Question", "question": "Is `x` respectful of {{data.subject.fullName}}?", "as": "conf2", "do": { "@type": "Interval", "using": "conf2", "lessThan": "0.5", "do": { "@type": "Error", "on": "x", "message": "This paragraph must be respectful of {{data.subject.fullName}}." } } } } } } }, { "@context": "http://standard.org/", "@type": "Requirement", "do": { "@type": "ForEachCssSelection", "value": "article.biography > section.introduction > p:first-of-type > span.sentence:first-of-type", "as": "x", "do": { "@type": "Question", "question": "Does `x` indicate that {{data.subject.fullName}} was born {{data.subject.dateOfBirth}}?", "as": "conf", "do": { "@type": "Interval", "using": "conf", "lessThan": "0.5", "do": { "@type": "Error", "on": "x", "message": "First sentence must indicate that {{data.subject.fullName}} was born {{data.subject.dateOfBirth}}." } } } } }, { "@context": "http://standard.org/", "@type": "Requirement", "do": { "@type": "ForEachCssSelection", "value": "article.biography > section.occupations", "as": "x", "do": { "@type": "ForEachData", "value": "data.subject.occupation", "as": "o", "do": { "@type": "Question", "question": "Does `x` mention that {{data.subject.fullName}} was a {{o}}?", "as": "conf", "do": { "@type": "Interval", "using": "conf", "lessThan": "0.5", "do": { "@type": "Error", "on": "x", "message": "This section must mention that {{data.subject.fullName}} was a {{o}}." } } } } } } ]Processing Rules, Requirements, and Preferences
Parallel Processing
Independent rules, requirements, and preferences could be processed concurrently, in parallel.
Hierarchical Processing
Rules, requirements, and preferences could have child items, via a
childrenproperty, such that each child would have to be verified for the parent item to be verified.Since JSON-LD is utilized, developers could use
@idto identify rules, requirements, or preferences and then refer to these by identifier with respect to thischildrenproperty or by means of an inverseparentproperty. This latter inverseparentproperty would enable extensibility with respect to interrelating rules, requirements, and preferences provided in multiple resources.Hierarchical capabilities can enable the aggregation of nested messages, warnings, and errors.
Click here to toggle display of an example.
[ { "@context": "http://standard.org/", "@id": "http://encyclopedia.org/requirements/neutrality", "@type": "Requirement", "do": { "@type": "ForEachCssSelection", "value": "article", "as": "x", "do": { "@type": "TryCatch", "try": { "@type": "AggregateTry", "do": { "@type": "AllChildRules" } }, "catch": [ { "@type": "AggregateCatch", "collect": [ "Error" ], "do": { "@type": "AggregateError", "on": "x", "message": "This article must have a neutral and objective tone." } }, { "@type": "AggregateCatch", "collect": [ "Warning" ], "do": { "@type": "AggregateWarning", "on": "x", "message": "This article may need to be reviewed with respect to its neutrality and objectivity." } }, { "@type": "AggregateCatch", "collect": [ "Message" ], "do": { "@type": "AggregateMessage", "on": "x", "message": "This article has messages with respect to its neutrality and objectivity." } } ] } } }, { "@context": "http://standard.org/", "@type": "Requirement", "parent": { "@id": "http://encyclopedia.org/requirements/neutrality" }, "do": { "@type": "ForEachCssSelection", "using": "x", "value": ":scope section > p", "as": "y", "do": { "@type": "Question", "question": "Does `y` have a neutral and objective tone?", "as": "conf", "do": { "@type": "Interval", "using": "conf", "lessThan": "0.5", "do": { "@type": "Error", "on": "y", "message": "This paragraph does not have a neutral and objective tone." } } } } } ]Multi-step Processing
Rules, requirements, and preferences could indicate that they were to be processed before or after one another. They could be scheduled for processing in multiple steps or stages.
Perhaps
Requirementinstances could be placed into ad-hoc classes, categories, steps, or stages which could be interrelated as occurringbeforeandafterone another.Task-based Processing
From scheduled sequences of steps to hierarchical tree models of steps, provided steps or stages could also be
Taskinstances, these instances having hierarchical subtasks, capable of providing global task scope data atop any tasks and subtasks occurring within individual rules, requirements, and preferences.Individual rules, requirements, and preferences could indicate themselves as being elements of overarching global
Taskinstances which could be traversed in a hierarchical manner during processing.Workflow-based Processing
By analyzing sets of rules, requirements, and preferences, and other objects, alongside their interrelationships and interdependencies, software could create workflows with which to verify documents and their elements.
Knowledge Graphs
With the capabilities to query and update knowledge graphs, one could create semantic rules. These might resemble something like the following example.
Click here to toggle display of an example.
[ { "@context": "http://standard.org/", "@type": "Rule", "do": { "@type": "DeclareVariables", "as": [ "x", "y", "z" ], "do": { "@type": "ForEachMatch", "content": [ { "@type": "Statement", "subject": "{{variable x}}", "predicate": "http://example.org/hasFather", "object": "{{variable y}}" }, { "@type": "Statement", "subject": "{{variable y}}", "predicate": "http://example.org/hasBrother", "object": "{{variable z}}" } ], "do": { "@type": "Insert", "content": { "@type": "Statement", "subject": "{{term x}}", "predicate": "http://example.org/hasUncle", "object": "{{term z}}" } } } } } ]Rules, requirements, or preferences would also be able to select document elements and conditionally update knowledge graphs depending upon interactions with a potential Decisions API. Other objects would later be able to query these knowledge graphs in the process of verifying documents and their elements.
One could use the
idattribute in coordination with documents' URLs orbaseattribute values to obtain IRI nodes for documents' elements. For those elements withoutidattributes, blank nodes could be provided. A table could be utilized to provide the same blank nodes for the same elements, upon repeated requests. In this way, one could obtain either an IRI node or a blank node for any document element.Click here to toggle display of an example.
[ { "@context": "http://standard.org/", "@type": "Rule", "do": { "@type": "ForEachCssSelection", "value": "article.biography > section.events > p", "as": "x", "do": { "@type": "ForEachData", "value": "data.subject.events", "as": "e", "do": { "@type": "Question", "question": "Does `x` mention `e.text`?", "as": "conf", "do": { "@type": "Interval", "using": "conf", "greaterThanOrEqual": "0.5", "do": { "@type": "Insert", "content": [ { "@type": "Statement", "subject": "{{element-to-term x}}", "predicate": "http://example.org/mentionsEvent", "object": "{{term e.id}}", "confidence": "{{conf}}" } ] } } } } } } ]Click here to toggle display of an example.
[ { "@context": "http://standard.org/", "@type": "Rule", "do": { "@type": "ForEachCssSelection", "value": "article section.argument", "as": "a", "do": [ { "@type": "Insert", "content": [ { "@type": "Statement", "subject": "{{element-to-term a}}", "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "object": "http://example.org/Argument" } ] }, { "@type": "ForEachCssSelection", "using": "a", "value": "span.claim", "as": "c", "do": { "@type": "ForEachCssSelection", "using": "a", "value": "span.support", "as": "s", "do": [ { "@type": "Insert", "content": [ { "@type": "Statement", "subject": "{{element-to-term s}}", "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "object": "http://example.org/Statement" }, { "@type": "Statement", "subject": "{{element-to-term a}}", "predicate": "http://example.org/hasStatement", "object": "{{element-to-term s}}" }, { "@type": "Statement", "subject": "{{element-to-term c}}", "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "object": "http://example.org/Claim" }, { "@type": "Statement", "subject": "{{element-to-term a}}", "predicate": "http://example.org/hasClaim", "object": "{{element-to-term c}}" } ] }, { "@type": "Question", "question": "Does `s` support the claim `c`?", "as": "conf", "do": { "@type": "Interval", "using": "conf", "greaterThanOrEqual": "0.5", "do": { "@type": "Insert", "content": { "@type": "Statement", "subject": "{{element-to-term s}}", "predicate": "http://example.org/supports", "object": "{{element-to-term c}}", "confidence": "{{conf}}" } } } } ] } } ] } } ]Notes
noul-related responses usingswitch/case/defaultsemantics on floating-point intervals. That is, could branch based on floating-point intervals with respect to a numericalnoulresponse.Click here to toggle display of an example.
[ { "@context": "http://standard.org/", "@id": "http://encyclopedia.org/requirements/neutrality", "@type": "Requirement", "do": { "@type": "ForEachCssSelection", "value": "article p", "as": "x", "do": { "@type": "Question", "question": "Does `x` have a neutral and objective tone?", "as": "conf", "do": [ { "@type": "Interval", "using": "conf", "lessThan": "0.75", "do": { "@type": "Error", "on": "x", "message": "This paragraph must have a neutral and objective tone." } }, { "@type": "Interval", "using": "conf", "greaterThanOrEqual": "0.75", "lessThan": "0.90", "do": { "@type": "Warning", "on": "x", "message": "This paragraph may need to be reviewed with respect to its neutrality and objectivity." } } ] } } } ]noul-related capabilities,choice-related andscore-related capabilities could be made available through structures drawing inspiration fromswitch/case/default. That is, could branch based on choice responses and, perhaps, floating-point intervals with respect tochoiceresponses' confidence scores.Click here to toggle display of an example.
[ { "@context": "http://standard.org/", "@type": "Requirement", "do": { "@type": "ForEachCssSelection", "value": "article section.argument", "as": "a", "do": { "@type": "ForEachCssSelection", "using": "a", "value": "span.claim", "as": "c", "do": { "@type": "ForEachCssSelection", "using": "a", "value": "span.support", "as": "s", "do": { "@type": "Choice", "question": "Does the statement `s` support the claim `c`?", "criteria": [ { "@type": "Criterion", "label": "supports", "description": "The statement directly supports or clearly entails the claim." }, { "@type": "Criterion", "label": "contradicts", "description": "The statement states or clearly implies the opposite.", "as": "conf", "do": [ { "@type": "Interval", "using": "conf", "lessThan": "0.5", "do": { "@type": "Warning", "on": [ "c", "s" ], "message": "This statement may contradict the claim." } }, { "@type": "Interval", "using": "conf", "greaterThanOrEqual": "0.5", "do": { "@type": "Error", "on": [ "c", "s" ], "message": "The statement contradicts the claim." } } ] }, { "@type": "Criterion", "label": "insufficient", "description": "Relevant, but not enough to establish the claim.", "as": "conf", "do": [ { "@type": "Interval", "using": "conf", "lessThan": "0.5", "do": { "@type": "Warning", "on": [ "c", "s" ], "message": "This statement might not establish the claim." } }, { "@type": "Interval", "using": "conf", "greaterThanOrEqual": "0.5", "do": { "@type": "Error", "on": [ "c", "s" ], "message": "The statement does not establish the claim." } } ] }, { "@type": "Criterion", "label": "unrelated", "description": "The statement does not address the claim.", "as": "conf", "do": [ { "@type": "Interval", "using": "conf", "lessThan": "0.5", "do": { "@type": "Warning", "on": [ "c", "s" ], "message": "The statement may be unrelated to the claim." } }, { "@type": "Interval", "greaterThanOrEqual": "0.5", "do": { "@type": "Error", "on": [ "c", "s" ], "message": "The statement is unrelated to the claim." } } ] } ] } } } } } ]confidencescores.ForEachSparqlSelectioncomponent.window.getComputedStyle(element, pseudoElement)and perhaps the CSSOM.innerTextvalues into variables to be provided to decision models.contenteditable), including per element, may factor into Web Requirements.<link>metadata?ForEachSentencecomponent to iterate sentences in selected documents' elements so that<span class="sentence">markup would not be necessary to provide sentence-granular functionalities. Such a component might useIntl.Segmenterto segment selected text content into sentences.@namespacerules for selectors inForEachCssSelectioncomponents.namespacesproperty which would provide a single object or array of objects each having aprefixandiri.ForEachXPathSelectioncomponents.namespacesproperty on these components.messageproperty values would be useful.Click here to toggle display of an example.
[ { "@context": "http://standard.org/", "@type": "Requirement", "do": { "@type": "ForEachXPathSelection", "value": ".//article//p", "as": "x", "do": { "@type": "Question", "question": "Does `x` have a neutral and objective tone?", "as": "conf", "do": { "@type": "Interval", "using": "conf", "lessThan": "0.5", "do": { "@type": "Error", "on": "x", "message": "<a href='x'>This paragraph</a> must have a neutral and objective tone." } } } } } ]doproperties and providedoproperties. They could be easily used to provide hierarchical tasks or goals pertaining to the processing of rules, requirements, and preferences. These data could accompany messages, warnings, and errors in the form of stacks' traces.System.Diagnostics.Activityand OpenTelemetry.asproperty in aTaskto assign it to a symbol to refer to in nested subtasks'messageproperty values.{ "@type": "Task", "message": "...", "as": "...", "do": { } }{ "@type": "AuthorialTask", "message": "...", "on": "...", "as": "...", "do": { } }MinimumandMaximumcomponents for processing multiple questions' responses into resultant values, e.g. questions that were paraphrases of one another.Questioninstances' expected responses could be interrelated using their@idproperty values via fuzzy-logical expressions and assertions. This could be useful for indicating that questions were paraphrases of one another, implied by one another, logically equivalent, logically mutually exclusive, or otherwise related via usage of conjunction, disjunction, and negation in more intricate expressions.Conclusion
What do you think about these ideas? Thank you.
All reactions