Liking cljdoc? Tell your friends :D

vaelii.foreign.rdf

Translate an RDF graph — RDFS and OWL, read by vaelii.foreign.turtle — into a vaelii corpus.

This is the reader with the widest reach in the repo and the one that gives up the most, and both come from the same fact: OWL is a description logic and vaelii is a Horn rule engine. So the translation is not a rename with a table of exceptions the way Cyc's is. It is a projection: the fragment of OWL that has a Horn reading comes across as rules and declarations, and the rest is dropped under a counted reason.

What comes across

RDF / OWLvaelii
C rdfs:subClassOf D(genl c d)
X rdf:type C(c X)
P rdfs:subPropertyOf Q(genl p q)
P rdfs:domain C / rdfs:range C(argIsa p 1 c) / (argIsa p 2 c)
C owl:disjointWith D(disjoint c d)
owl:AllDisjointClasses(disjoint …), pairwise
P owl:inverseOf Q(inverse p q)
P a owl:TransitiveProperty (and the rest)(transitive p), (symmetric p), …
C owl:equivalentClass D(genl c d) and (genl d c)
P owl:propertyChainAxiom (Q R)(implies (and (q ?x ?y) (r ?y ?z)) (p ?x ?z))
C ⊑ ∀P.D (owl:allValuesFrom)(implies (and (c ?x) (p ?x ?y)) (d ?y))
C ⊑ ∃P.{v} (owl:hasValue)(implies (c ?x) (p ?x V))
C ≡ ∃P.D (owl:someValuesFrom)(implies (and (p ?x ?y) (d ?y)) (c ?x))
C ≡ D1 ⊓ D2 (owl:intersectionOf)the rule and both genl edges
O owl:imports O2(genlContext OContext O2Context)
anything else(p S O), a plain fact

What does not, and why that is the interesting half

  • C ⊑ ∃P.D — an existential in the conclusion. "Every hand has a finger" obliges the reasoner to invent a finger, which is what a description logic does and a rule engine does not. Counted as :existential-superclass, and it is the single largest drop on a real ontology.
  • owl:unionOf in the ⊑ direction, owl:oneOf, owl:complementOf — a real disjunction, a real closed class, a real negation. Each is a claim vaelii could hold only by weakening it into something else.
  • Cardinality (owl:minCardinality, maxCardinality, qualifiedCardinality) — counting constraints have no Horn form at all. owl:FunctionalProperty is the one exception and only behind :functional?, for the same reason it is behind that flag in the Cyc reader: vaelii's functional merges two values through the equality closure rather than refusing the second.

Reading the two directions of owl:equivalentClass separately is what buys most of what is kept: C ≡ ∃P.D is worthless as a definition and perfectly good as the sufficient-condition half of one.

Blank nodes, and the n-ary relations they stand for

RDF triples are binary, so a relation with more than two arguments has to be written as a node with one edge per argument — the W3C n-ary pattern, Wikidata's statements, schema.org's Role, and every [ :city "Austin" ; :zip "78701" ] anybody ever wrote. vaelii predicates have no arity limit, so such a node can become one fact of higher arity:

ex:Bob ex:hasJob [ ex:employer ex:Acme ; ex:role ex:Engineer ; ex:since 2020 ] .
-> (hasJob Bob Acme Engineer 2020)   with  (arity hasJob 4)

That is only sound when the shape is uniform, and bnode-plan is the pass that decides. Flattening positionally needs every node a predicate reaches to carry the same qualifiers, exactly once each, with nameable fillers, reached from one place, and the predicate to take no plain object anywhere else. Miss any of those and the arguments silently misalign — (hasJob Ann Beta 1999) with a date where a rule reads a role. vaelii is open-world about arity until something declares it, so nothing would refuse the misaligned fact; it would simply never match. Hence the (arity p n) written beside the tuples: once declared, a later fact at the wrong arity is a refusal rather than a sentence quietly matching nothing.

Every other blank node is skolemized — given a name built from the subject and predicate that reach it (BobAward), with its own triples kept as ordinary facts:

ex:Bob ex:award [ ex:name "Prize" ; ex:year 2001 ] .
-> (award Bob BobAward) (name BobAward "Prize") (year BobAward 2001)

That loses nothing — it is what the n-ary pattern already means — and it is what a node with an identity of its own wants regardless. A typed node is always skolemized: [ a :Employment ; … ] claims to be an instance of something, and flattening would take away the term the membership hangs on. So is a shared one, since flattening would copy it rather than move it.

Only the interior of an OWL construct is left alone, because the axiom that owns it has already said what it means. :n-ary? false skolemizes everything, which is the reading to take if a rule set was written against the joined form.

Naming and contexts

A term is named from its IRI's local part — after the last # or / — and its role decides the spelling, so ex:Mammal used as a class becomes the type mammal and ex:hasPart used as a property becomes hasPart. Two IRIs with the same local part in different namespaces collide, which is normal and is resolved by suffix, in a sorted pass, so a re-run of the same graph produces the same names.

A named graph is a context (that is what N-Quads' fourth term is for), and so is an owl:Ontology. A graph that declares neither lands in one context named for the source. owl:imports is a genlContext edge, which makes an ontology's import closure the context hierarchy it always was.

Translate an RDF graph — RDFS and OWL, read by `vaelii.foreign.turtle` — into a
vaelii corpus.

This is the reader with the widest reach in the repo and the one that gives up the
most, and both come from the same fact: **OWL is a description logic and vaelii is a
Horn rule engine.**  So the translation is not a rename with a table of exceptions the
way Cyc's is.  It is a *projection*: the fragment of OWL that has a Horn reading comes
across as rules and declarations, and the rest is dropped under a counted reason.

## What comes across

| RDF / OWL                                      | vaelii                              |
|------------------------------------------------|-------------------------------------|
| `C rdfs:subClassOf D`                          | `(genl c d)`                        |
| `X rdf:type C`                                 | `(c X)`                             |
| `P rdfs:subPropertyOf Q`                       | `(genl p q)`                        |
| `P rdfs:domain C` / `rdfs:range C`             | `(argIsa p 1 c)` / `(argIsa p 2 c)` |
| `C owl:disjointWith D`                         | `(disjoint c d)`                    |
| `owl:AllDisjointClasses`                       | `(disjoint …)`, pairwise            |
| `P owl:inverseOf Q`                            | `(inverse p q)`                     |
| `P a owl:TransitiveProperty` (and the rest)    | `(transitive p)`, `(symmetric p)`, … |
| `C owl:equivalentClass D`                      | `(genl c d)` **and** `(genl d c)`   |
| `P owl:propertyChainAxiom (Q R)`               | `(implies (and (q ?x ?y) (r ?y ?z)) (p ?x ?z))` |
| `C ⊑ ∀P.D`   (`owl:allValuesFrom`)             | `(implies (and (c ?x) (p ?x ?y)) (d ?y))` |
| `C ⊑ ∃P.{v}` (`owl:hasValue`)                  | `(implies (c ?x) (p ?x V))`         |
| `C ≡ ∃P.D`   (`owl:someValuesFrom`)            | `(implies (and (p ?x ?y) (d ?y)) (c ?x))` |
| `C ≡ D1 ⊓ D2` (`owl:intersectionOf`)           | the rule **and** both `genl` edges  |
| `O owl:imports O2`                             | `(genlContext OContext O2Context)`  |
| anything else                                  | `(p S O)`, a plain fact             |

## What does not, and why that is the interesting half

* **`C ⊑ ∃P.D`** — an existential in the *conclusion*.  "Every hand has a finger"
  obliges the reasoner to invent a finger, which is what a description logic does and
  a rule engine does not.  Counted as `:existential-superclass`, and it is the single
  largest drop on a real ontology.
* **`owl:unionOf` in the ⊑ direction, `owl:oneOf`, `owl:complementOf`** — a real
  disjunction, a real closed class, a real negation.  Each is a claim vaelii could
  hold only by weakening it into something else.
* **Cardinality** (`owl:minCardinality`, `maxCardinality`, `qualifiedCardinality`) —
  counting constraints have no Horn form at all.  `owl:FunctionalProperty` is the one
  exception and only behind `:functional?`, for the same reason it is behind that flag
  in the Cyc reader: vaelii's `functional` *merges* two values through the equality
  closure rather than refusing the second.

Reading the two directions of `owl:equivalentClass` separately is what buys most of
what is kept: `C ≡ ∃P.D` is worthless as a definition and perfectly good as the
sufficient-condition half of one.

## Blank nodes, and the n-ary relations they stand for

RDF triples are binary, so a relation with more than two arguments has to be written
as a **node with one edge per argument** — the W3C n-ary pattern, Wikidata's
statements, schema.org's Role, and every `[ :city "Austin" ; :zip "78701" ]` anybody
ever wrote.  vaelii predicates have no arity limit, so such a node can become one fact
of higher arity:

    ex:Bob ex:hasJob [ ex:employer ex:Acme ; ex:role ex:Engineer ; ex:since 2020 ] .
    -> (hasJob Bob Acme Engineer 2020)   with  (arity hasJob 4)

That is only sound when the shape is **uniform**, and `bnode-plan` is the pass that
decides.  Flattening positionally needs every node a predicate reaches to carry the
same qualifiers, exactly once each, with nameable fillers, reached from one place, and
the predicate to take no plain object anywhere else.  Miss any of those and the
arguments silently misalign — `(hasJob Ann Beta 1999)` with a date where a rule reads
a role.  vaelii is open-world about arity until something declares it, so nothing
would refuse the misaligned fact; it would simply never match.  Hence the `(arity p
n)` written beside the tuples: once declared, a later fact at the wrong arity is a
refusal rather than a sentence quietly matching nothing.

Every other blank node is **skolemized** — given a name built from the subject and
predicate that reach it (`BobAward`), with its own triples kept as ordinary facts:

    ex:Bob ex:award [ ex:name "Prize" ; ex:year 2001 ] .
    -> (award Bob BobAward) (name BobAward "Prize") (year BobAward 2001)

That loses nothing — it is what the n-ary pattern already means — and it is what a
node with an identity of its own wants regardless.  A **typed** node is always
skolemized: `[ a :Employment ; … ]` claims to be an instance of something, and
flattening would take away the term the membership hangs on.  So is a **shared** one,
since flattening would copy it rather than move it.

Only the interior of an OWL construct is left alone, because the axiom that owns it
has already said what it means.  `:n-ary? false` skolemizes everything, which is the
reading to take if a rule set was written against the joined form.

## Naming and contexts

A term is named from its IRI's **local part** — after the last `#` or `/` — and its
role decides the spelling, so `ex:Mammal` used as a class becomes the type `mammal`
and `ex:hasPart` used as a property becomes `hasPart`.  Two IRIs with the same local
part in different namespaces collide, which is normal and is resolved by suffix, in a
sorted pass, so a re-run of the same graph produces the same names.

A **named graph** is a context (that is what N-Quads' fourth term is for), and so is
an `owl:Ontology`.  A graph that declares neither lands in one context named for the
source.  `owl:imports` is a `genlContext` edge, which makes an ontology's import
closure the context hierarchy it always was.
raw docstring

annotation-predicatesclj

Predicates carrying a human-readable string rather than a claim about the world. They are the bulk of a real ontology's triples and none of its inference, which is why :profiles can drop them wholesale.

Predicates carrying a human-readable string rather than a claim about the world.
They are the bulk of a real ontology's triples and none of its inference, which is why
`:profiles` can drop them wholesale.
raw docstring

bnode-planclj

(bnode-plan bnodes bnode-refs plain-object opts)

Decide what becomes of every blank node: {:n-ary {predicate [qualifier …]} :skolem {bnode name-base}}.

RDF has only binary triples, so an n-ary relation is written as a node with one edge per argument — the W3C n-ary pattern, Wikidata's statements, schema.org's Role, and every [ :city "Austin" ; :zip "78701" ] anybody ever wrote. vaelii predicates have no arity limit, so such a node can become one fact of higher arity, and that is a better reading than either dropping it or making the caller join through a node.

It is only sound when the shape is uniform, and that is what this pass is for. Flattening positionally requires that every node a predicate reaches carries the same qualifiers, exactly once each, with nameable fillers, and is reached from exactly one place. Miss any of those and the arguments silently misalign — (hasJob Ann Beta 1999) where position 2 was supposed to be a role. vaelii is open-world about arity until something declares it, so nothing would refuse the misaligned fact either; it would simply never match.

Everything else is skolemized: the node gets a name and its triples are kept as ordinary facts about it. That loses nothing — it is what the n-ary pattern already means — and it is what a node with an identity of its own (a typed one, a shared one) wants regardless.

:n-ary? false skolemizes everything, which is the conservative reading and the one to reach for if a downstream rule set was written against the joined form.

Decide what becomes of every blank node: `{:n-ary {predicate [qualifier …]} :skolem
{bnode name-base}}`.

RDF has only binary triples, so an n-ary relation is written as a node with one edge
per argument — the W3C n-ary pattern, Wikidata's statements, schema.org's Role, and
every `[ :city "Austin" ; :zip "78701" ]` anybody ever wrote.  vaelii predicates have
no arity limit, so such a node **can** become one fact of higher arity, and that is a
better reading than either dropping it or making the caller join through a node.

It is only sound when the shape is **uniform**, and that is what this pass is for.
Flattening positionally requires that every node a predicate reaches carries the same
qualifiers, exactly once each, with nameable fillers, and is reached from exactly one
place.  Miss any of those and the arguments silently misalign — `(hasJob Ann Beta
1999)` where position 2 was supposed to be a role.  vaelii is open-world about arity
until something declares it, so nothing would refuse the misaligned fact either; it
would simply never match.

Everything else is **skolemized**: the node gets a name and its triples are kept as
ordinary facts about it.  That loses nothing — it is what the n-ary pattern already
means — and it is what a node with an identity of its own (a typed one, a shared one)
wants regardless.

`:n-ary? false` skolemizes everything, which is the conservative reading and the one
to reach for if a downstream rule set was written against the joined form.
raw docstring

class-metatypesclj

rdf:type objects that declare a type.

`rdf:type` objects that declare a **type**.
raw docstring

classifyclj

(classify triples)

Pass 1. Fold every triple into {evidence-key #{iri …}} plus :bnodes, the triples whose subject is a blank node.

The blank nodes are held in memory and the rest is streamed, which is the shape of the data rather than a compromise: an OWL construct is a small closed cluster of blank nodes, and a graph large enough to matter (a Wikidata or YAGO dump) has none at all.

Pass 1.  Fold every triple into `{evidence-key #{iri …}}` plus `:bnodes`, the triples
whose subject is a blank node.

The blank nodes are held in memory and the rest is streamed, which is the shape of the
data rather than a compromise: an OWL construct is a small closed cluster of blank
nodes, and a graph large enough to matter (a Wikidata or YAGO dump) has none at all.
raw docstring

consumed-vocabularyclj

The RDF/RDFS/OWL IRIs a reading of this reader's own consumes — every axiom predicate, every metatype, every structural link, every annotation predicate.

None of them is ever named: each is read into a vaelii sentence chosen by hand (rdfs:subClassOf becomes genl, owl:Class becomes nothing at all), so minting subClassOf as a vaelii predicate would put a name in names.edn that no sentence uses and invite a reader of the corpus to think it means something. An RDF vocabulary term this reader has no reading for is deliberately not in here — rdfs:seeAlso gets a name and becomes an ordinary fact, which is the honest outcome.

The RDF/RDFS/OWL IRIs a reading of this reader's own consumes — every axiom
predicate, every metatype, every structural link, every annotation predicate.

None of them is ever *named*: each is read into a vaelii sentence chosen by hand
(`rdfs:subClassOf` becomes `genl`, `owl:Class` becomes nothing at all), so minting
`subClassOf` as a vaelii predicate would put a name in `names.edn` that no sentence
uses and invite a reader of the corpus to think it means something.  An RDF vocabulary
term this reader has **no** reading for is deliberately not in here — `rdfs:seeAlso`
gets a name and becomes an ordinary fact, which is the honest outcome.
raw docstring

convert!clj

(convert! path out-dir)
(convert! path out-dir opts)

Convert the RDF graph at path into a vaelii corpus under out-dir. Two passes: the first classifies every IRI and holds the blank nodes, the second writes the sentences. Returns the report map (also written as report.edn).

path is any file vaelii.foreign.turtle reads — .nt, .nq, .ttl, and any of them .gz.

Options: :functional? imports owl:FunctionalProperty as vaelii's functional (off); :languages keeps only these language tags on annotations (default #{"en"}, and an untagged literal is always kept); :context names the fallback context; :limit reads only the first n triples, for a quick sample.

Convert the RDF graph at `path` into a vaelii corpus under `out-dir`.  Two passes:
the first classifies every IRI and holds the blank nodes, the second writes the
sentences.  Returns the report map (also written as `report.edn`).

`path` is any file `vaelii.foreign.turtle` reads — `.nt`, `.nq`, `.ttl`, and any of
them `.gz`.

Options: `:functional?` imports `owl:FunctionalProperty` as vaelii's `functional`
(off); `:languages` keeps only these language tags on annotations (default `#{"en"}`,
and an untagged literal is always kept); `:context` names the fallback context;
`:limit` reads only the first n triples, for a quick sample.
raw docstring

drop-flagsclj

The convert option that keeps each :filtered drop — see cyc/drop-flags for the contract and plugin-test for what enforces it.

--languages is the reversal rather than an on/off flag, because the policy is not "drop these" but "keep this set": the default is en plus every untagged literal, and any other set is one argument away. On a multilingual dump the filter is not a nicety — fifty translations of one label are fifty facts saying one thing.

The convert option that keeps each `:filtered` drop — see `cyc/drop-flags` for the
contract and `plugin-test` for what enforces it.

`--languages` is the reversal rather than an on/off flag, because the policy is not
"drop these" but "keep this set": the default is `en` plus every untagged literal,
and any other set is one argument away.  On a multilingual dump the filter is not a
nicety — fifty translations of one label are fifty facts saying one thing.
raw docstring

drop-kindsclj

What each of this reader's drop reasons is — see corpus/drop-kinds. A reason missing here counts as :unread.

The two that dominate any real graph are both :restated. X a owl:Class is a vocabulary declaration, and the term, its role and its spelling are already in names.edn — the triple says nothing the corpus does not hold. rdf:first / rdf:rest / owl:annotatedSource are the plumbing of a class expression or a reified axiom that class-rules read as a whole; counting the parts again after reading the assembly would be double entry.

What each of this reader's drop reasons **is** — see `corpus/drop-kinds`.  A reason
missing here counts as `:unread`.

The two that dominate any real graph are both `:restated`.  `X a owl:Class` is a
vocabulary declaration, and the term, its role and its spelling are already in
`names.edn` — the triple says nothing the corpus does not hold.  `rdf:first` /
`rdf:rest` / `owl:annotatedSource` are the *plumbing* of a class expression or a
reified axiom that `class-rules` read as a whole; counting the parts again after
reading the assembly would be double entry.
raw docstring

functional-metatypesclj

The rdf:type objects that map to vaelii's functional, behind :functional?owl:FunctionalProperty constrains a property to one value, while vaelii's functional merges a second value into the first through the equality closure, which is not quite the same claim.

The `rdf:type` objects that map to vaelii's `functional`, behind `:functional?` —
`owl:FunctionalProperty` constrains a property to one value, while vaelii's
`functional` *merges* a second value into the first through the equality closure,
which is not quite the same claim.
raw docstring

load-dir!clj

(load-dir! kb dir)
(load-dir! kb dir opts)

Load the corpus at dir into kbvaelii.foreign.corpus/load-dir! with this format's profiles. See there for the options and the layering.

Load the corpus at `dir` into `kb` — `vaelii.foreign.corpus/load-dir!` with this
format's `profiles`.  See there for the options and the layering.
raw docstring

local-partclj

(local-part i)

An IRI's local part — after the last #, / or : — falling back to the whole IRI when that is empty.

An IRI's local part — after the last `#`, `/` or `:` — falling back to the whole IRI
when that is empty.
raw docstring

meta-typesclj

Every rdf:type object that is a declaration about the vocabulary rather than a membership to store. (owlClass mammal) says nothing a reader of the corpus wants.

Every `rdf:type` object that is a declaration about the vocabulary rather than a
membership to store.  `(owlClass mammal)` says nothing a reader of the corpus wants.
raw docstring

name-tableclj

(name-table role-map)
(name-table role-map plan)

The IRI -> vaelii term map, plus a term per skolemized blank node. A term is named from its IRI's local part, and a blank node from the subject and predicate that reach it (BobHasJob), so a name is readable and says where it came from. Built in sorted order so a collision resolves the same way on every run.

IRIs go first, so a minted name is the one that takes a suffix when it collides with a name somebody actually wrote.

The IRI -> vaelii term map, plus a term per **skolemized** blank node.  A term is
named from its IRI's local part, and a blank node from the subject and predicate that
reach it (`BobHasJob`), so a name is readable and says where it came from.  Built in
sorted order so a collision resolves the same way on every run.

IRIs go first, so a minted name is the one that takes a suffix when it collides with a
name somebody actually wrote.
raw docstring

profilesclj

Named subsets of a converted graph. :ontology drops the labels and comments, which on a real ontology are most of the triples and none of the inference; :schema keeps only the axioms, for loading a vocabulary without its instance data.

Named subsets of a converted graph.  `:ontology` drops the labels and comments, which
on a real ontology are most of the triples and none of the inference; `:schema` keeps
only the axioms, for loading a vocabulary without its instance data.
raw docstring

property-metatypesclj

rdf:type objects that declare a predicate and, for most of them, a vaelii metadata predicate with it. A nil value declares the role and nothing more.

`rdf:type` objects that declare a **predicate** and, for most of them, a vaelii
metadata predicate with it.  A nil value declares the role and nothing more.
raw docstring

rdf-listclj

(rdf-list bnodes node)

The members of an rdf:first / rdf:rest chain starting at node, or nil when it is not a well-formed list. Bounded by the number of cells so a cyclic rdf:rest — which a corrupt dump can carry — cannot spin.

The members of an `rdf:first` / `rdf:rest` chain starting at `node`, or nil when it is
not a well-formed list.  Bounded by the number of cells so a cyclic `rdf:rest` — which
a corrupt dump can carry — cannot spin.
raw docstring

readerclj

This format's reader, as the seam (vaelii.impl.foreign) hands it out.

This format's reader, as the seam (`vaelii.impl.foreign`) hands it out.
raw docstring

restrictionclj

(restriction bnodes b)

The OWL restriction blank node b states, as {:on P :kind :all|:some|:value :filler X} — or nil when b is not a restriction this reader has a Horn reading for (a cardinality, a data range, something malformed).

The OWL restriction blank node `b` states, as `{:on P :kind :all|:some|:value :filler
X}` — or nil when `b` is not a restriction this reader has a Horn reading for (a
cardinality, a data range, something malformed).
raw docstring

role-precedenceclj

[role evidence-key] in decreasing authority.

A graph or ontology IRI is a context and never anything else. A term used in predicate position is a predicate whatever else is claimed of it — the same rule the Cyc reader applies for the same reason: vaelii refuses a functor that is not spelled as one, so a wrong role there costs every triple about the term while a wrong role anywhere else costs only its appearance. Then RDF's own rdf:type declarations, then position in a class-shaped axiom, and finally an individual by residue — which is what the overwhelming majority of a data graph's IRIs are.

`[role evidence-key]` in decreasing authority.

A **graph or ontology IRI is a context** and never anything else.  A term used in
**predicate position** is a predicate whatever else is claimed of it — the same rule
the Cyc reader applies for the same reason: vaelii refuses a functor that is not
spelled as one, so a wrong role there costs every triple about the term while a wrong
role anywhere else costs only its appearance.  Then RDF's own `rdf:type`
**declarations**, then **position** in a class-shaped axiom, and finally an
**individual by residue** — which is what the overwhelming majority of a data graph's
IRIs are.
raw docstring

structural-bnode?clj

(structural-bnode? bnodes b)

Is b the interior of an OWL construct rather than a node standing for something?

Is `b` the interior of an OWL construct rather than a node standing for something?
raw docstring

structural-markersclj

Predicates whose presence on a blank node means an OWL axiom already reads it. Such a node is not data and must not be flattened or named — the axiom that owns it has already said what it means.

Predicates whose presence on a blank node means an OWL axiom already reads it.  Such
a node is not data and must not be flattened or named — the axiom that owns it has
already said what it means.
raw docstring

structural-predicatesclj

Predicates that exist to hold an OWL construct together. Every one is read by the axiom that owns it, so emitting it again as a plain fact would restate the axiom in a vocabulary nothing understands.

Predicates that exist to hold an OWL construct together.  Every one is read by the
axiom that owns it, so emitting it again as a plain fact would restate the axiom in a
vocabulary nothing understands.
raw docstring

syntaxclj

(syntax path)

Which lexer reads the document at path:rdf-xml or :turtle.

Decided by looking, not by the extension. .owl is used for both RDF/XML and Turtle by different publishers (the OBO Foundry ships Turtle as .owl; OpenCyc and DOLCE ship RDF/XML as .owl), so an extension table would be wrong about real files from real sources. The first few hundred bytes are unambiguous.

Which lexer reads the document at `path` — `:rdf-xml` or `:turtle`.

Decided by **looking**, not by the extension.  `.owl` is used for both RDF/XML and
Turtle by different publishers (the OBO Foundry ships Turtle as `.owl`; OpenCyc and
DOLCE ship RDF/XML as `.owl`), so an extension table would be wrong about real files
from real sources.  The first few hundred bytes are unambiguous.
raw docstring

translateclj

(translate {:keys [s p o]} {:keys [names bnodes plan opts]})

The vaelii sentences one triple becomes: {:sentences [...] :strength s}, or {:dropped reason}. ctx is {:names :bnodes :plan :opts} — pass 1's blank-node map and the plan for what becomes of each, which is what lets an axiom or an n-ary tuple be read here rather than deferred.

A triple's strength follows what kind of claim it is: a schema axiom is definitional and lands :monotonic, an ordinary triple is somebody's assertion about the world and lands :default. RDF itself draws no such line, so this one is ours — and it is the line that decides whether a later contradiction can retract a triple or is refused against it.

The vaelii sentences one triple becomes: `{:sentences [...] :strength s}`, or
`{:dropped reason}`.  `ctx` is `{:names :bnodes :plan :opts}` — pass 1's blank-node map
and the plan for what becomes of each, which is what lets an axiom or an n-ary tuple
be read here rather than deferred.

A triple's **strength** follows what kind of claim it is: a schema axiom is
definitional and lands `:monotonic`, an ordinary triple is somebody's assertion about
the world and lands `:default`.  RDF itself draws no such line, so this one is ours —
and it is the line that decides whether a later contradiction can retract a triple or
is refused against it.
raw docstring

tuple-signatureclj

(tuple-signature bnodes b)

The qualifier predicates of b in a fixed order, or nil when b cannot be read as a tuple at all:

  • a repeated qualifier — two values in one slot is not one tuple, it is two;
  • a nested blank node — a slot whose filler has no name;
  • no qualifiers — a node that states nothing.

The order is the qualifiers' own IRIs, sorted. It is arbitrary, and being arbitrary is why it has to be fixed: every instance of a predicate must lay its arguments out the same way or a rule reading position 2 gets a role from one fact and a date from the next.

The qualifier predicates of `b` in a fixed order, or nil when `b` cannot be read as a
tuple at all:

* **a repeated qualifier** — two values in one slot is not one tuple, it is two;
* **a nested blank node** — a slot whose filler has no name;
* **no qualifiers** — a node that states nothing.

The order is the qualifiers' own IRIs, sorted.  It is arbitrary, and being arbitrary
is why it has to be *fixed*: every instance of a predicate must lay its arguments out
the same way or a rule reading position 2 gets a role from one fact and a date from
the next.
raw docstring

with-triplesclj

(with-triples path f)
(with-triples path f opts)

(f triples) over the RDF at path, whichever syntax it is in. The one place this namespace touches a lexer, which is why adding RDF/XML changed nothing below it.

`(f triples)` over the RDF at `path`, whichever syntax it is in.  The one place this
namespace touches a lexer, which is why adding RDF/XML changed nothing below it.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close