{"version":3,"file":"rdf-defs.cjs","sources":["../../../src/rdf-and-cd/rdf-defs.js"],"sourcesContent":["// @prefix dockalpha: <https://rdf.dock.io/alpha/2021#> .\n// @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n\n// id: dockalpha:mayClaim\n// type: rdf:Property\n// domain: rdf:Resource\n// range: dockalpha:ClaimFilter\n//\n// An entity that attests to a dockalpha:mayClaim statement grant the subject of that statement\n// authority to make any claims statisfying the object of the statment on the entities behalf.\nexport const MAYCLAIM = 'https://rdf.dock.io/alpha/2021#mayClaim';\n\n// id: dockalpha:ANYCLAIM\n// type: dockalpha:ClaimFilter\n//\n// The \"allow all\" filter. dockalpha:ANYCLAIM accepts all triples.\n// All triples satisfy dockalpha:ANYCLAIM.\nexport const ANYCLAIM = 'https://rdf.dock.io/alpha/2021#ANYCLAIM';\n\n// id: dockalpha:ClaimFilter\n// type: rdf:Class\n//\n// Filter over rdf claims.\nexport const CLAIM_FILTER = 'https://rdf.dock.io/alpha/2021#ClaimFilter';\n\n// This ruleset defines dockalpha:MayClaim specifically only when used with dockalpha:ANYCLAIM.\n//\n// This is not a complete definition of dockalpha:MayClaim, but any complete definition of\n// dockalpha:MayClaim will imply this ruleset.\n//\n// This ruleset is generic over graph name. The genericity of the rule allows it to prove composite\n// claims where graph != the default graph, but at some potential reasoning cost. See\n// MAYCLAIM_DEF_2 for a lighter-weight partial definition.\nexport const MAYCLAIM_DEF_1 = [\n  {\n    if_all: [\n      [\n        { Unbound: 'b' },\n        { Bound: { Iri: MAYCLAIM } },\n        { Bound: { Iri: ANYCLAIM } },\n        { Unbound: 'a' },\n      ],\n      [{ Unbound: 's' }, { Unbound: 'p' }, { Unbound: 'o' }, { Unbound: 'b' }],\n    ],\n    then: [\n      [{ Unbound: 's' }, { Unbound: 'p' }, { Unbound: 'o' }, { Unbound: 'a' }],\n    ],\n  },\n];\n\n// This ruleset defines dockalpha:MayClaim specifically only when used with dockalpha:ANYCLAIM.\n//\n// During reasoning this ruleset is more efficient than its predecessor in terms of space used.\n// This rule generates fewer tuples becuse claims are only ever copied into the default graph.\n// When using this rule tuples need not propagate from graph to graph all the way up the delegation\n// chain. Rather, when it's determined that a specific issuer is authorized, claims will be copied\n// directly from their named graph into the default graph.\n//\n// `MAYCLAIM_DEF_2` is more specific than `MAYCLAIM_DEF_1` as it binds the default graph.\n//\n// `MAYCLAIM_DEF_1` implies `MAYCLAIM_DEF_2`\n// `MAYCLAIM_DEF_1 -> MAYCLAIM_DEF_2`\n//\n// The `MAYCLAIM_DEF_2` ruleset can be used to prove claims that are not expressed as explicit\n// ethos. Only claims where graph == \"Default Graph\" can be proved using this ruleset.\n//\n// `[?s ?p ?o { DefaultGraph: true }]`\n//\n// If the claim you need to prove is in explicit ethos form,\n//\n// `[?s ?p ?o { Iri: 'did:example:somedid' }]`\n//\n// consider using `MAYCLAIM_DEF_1` instead.\nexport const MAYCLAIM_DEF_2 = [\n  {\n    if_all: [\n      [\n        { Unbound: 'b' },\n        { Bound: { Iri: MAYCLAIM } },\n        { Bound: { Iri: ANYCLAIM } },\n        { Bound: { DefaultGraph: true } },\n      ],\n      [{ Unbound: 's' }, { Unbound: 'p' }, { Unbound: 'o' }, { Unbound: 'b' }],\n    ],\n    then: [\n      [\n        { Unbound: 's' },\n        { Unbound: 'p' },\n        { Unbound: 'o' },\n        { Bound: { DefaultGraph: true } },\n      ],\n    ],\n  },\n];\n\n// This is how `dockalpha:mayClaim` is expected to relate to `dockalpha:attestsDocumentContents`.\n// export const ATTESTS = 'https://rdf.dock.io/alpha/2021#attestsDocumentContents';\n// export const ATTESTS_DEF_1 = [\n//   {\n//     if_all: [\n//       [\n//         { Unbound: 'a' },\n//         { Bound: { Iri: ATTESTS } },\n//         { Unbound: 'b' },\n//         { Unbound: 'a' },\n//       ],\n//     ],\n//     then: [\n//       [\n//         { Unbound: 'b' },\n//         { Bound: { Iri: MAYCLAIM } },\n//         { Bound: { Iri: ANYCLAIM } },\n//         { Unbound: 'a' },\n//       ],\n//     ],\n//   }\n// ];\n\n// # The following considerations, and more, are why these definitions (e.g. dockalpha:mayClaim) are marked as alpha.\n//\n// ## New semantics assigned to presence of triples in a named graph\n//\n// These rules assign semantic meaning to triples stored in named graph.\n//\n// If [?s ?p ?o ?g] then ?g attests to the triple [?s ?p ?o].\n//\n// This allows rules to be nice an terse, the above semantics may not be\n// considered universally true by current users of rdf.\n//\n// ## Provenance Tracking\n//\n// Should we add indirection to track provenance of information with more detail? For example,\n// instead of saying\n//\n// ```\n// graph = did:example\n// ```\n//\n// we would say\n//\n// ```\n// graph = _:bxx\n// did:example dereferenced to _:bxx at <date>\n// ```\n//\n// In the context of rdf datasets provenance tracking in not a new idea.\n//\n// ## Meaning of dockalpha:attestsDocumentContents\n//\n// Recently I've been assumning dockalpha:attestsDocumentContents always points to a turtle\n// document on ipfs, but what if a DID wants to attest to another did document? What if an\n// dockalpha:attestsDocumentContents tricks a crawler into thinking a non-turtle document is\n// actually a turtle document? Perhaps provenance tracking can solve this.\n//\n// - Can we prove that this interpretation of dockalpha:attestsDocumentContents is unsound.\n// - Can we prove that this interpretation of dockalpha:attestsDocumentContents is sound.\n"],"names":[],"mappings":";;AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG;;AAExB;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG;;AAExB;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG;AAC9B,EAAE;AACF,IAAI,MAAM,EAAE;AACZ,MAAM;AACN,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;AACxB,QAAQ,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE;AACpC,QAAQ,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE;AACpC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE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