Class CortexNamespace

java.lang.Object
ai.chatur.cortex.core.CortexNamespace

public final class CortexNamespace extends Object
Creates resource names in the cortex:// namespace used by the knowledge graph.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The URI namespace of all resources managed by Cortex.
    static final org.apache.jena.rdf.model.Resource
    The named graph holding per-statement provenance within the assertions dataset.
    static final org.apache.jena.rdf.model.Resource
    The named graph holding per-resource view counts within the assertions dataset.
    static final org.apache.jena.rdf.model.Property
    The property recording a resource's time-decayed view score, within USAGE.
    static final org.apache.jena.rdf.model.Property
    The instant VIEW_COUNT was last recomputed, within USAGE.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.jena.rdf.model.Resource
    Returns a fresh, randomly named branch resource.
    static org.apache.jena.rdf.model.Resource
    Returns the resource with the given name in the Cortex namespace.
    static org.apache.jena.rdf.model.Resource
    getRetractions(org.apache.jena.rdf.model.Resource branch)
    Returns the graph holding the statements a branch stages for removal from the approved assertions.
    static boolean
    isBranch(org.apache.jena.rdf.model.Resource graph)
    Reports whether the named graph is a branch, by its name alone.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NS

      public static final String NS
      The URI namespace of all resources managed by Cortex.
      See Also:
    • PROVENANCE

      public static final org.apache.jena.rdf.model.Resource PROVENANCE
      The named graph holding per-statement provenance within the assertions dataset.
    • USAGE

      public static final org.apache.jena.rdf.model.Resource USAGE
      The named graph holding per-resource view counts within the assertions dataset.

      Like PROVENANCE this is a reserved graph, not a branch and not part of the approved assertions: it records how the graph is used rather than what it claims.

    • VIEW_COUNT

      public static final org.apache.jena.rdf.model.Property VIEW_COUNT
      The property recording a resource's time-decayed view score, within USAGE.

      Not a plain tally: the value is discounted towards zero as it ages, so it is only meaningful alongside VIEW_COUNT_UPDATED, which says when it was last brought up to date.

    • VIEW_COUNT_UPDATED

      public static final org.apache.jena.rdf.model.Property VIEW_COUNT_UPDATED
      The instant VIEW_COUNT was last recomputed, within USAGE.
  • Method Details

    • getResource

      public static org.apache.jena.rdf.model.Resource getResource(String name)
      Returns the resource with the given name in the Cortex namespace.
      Parameters:
      name - the local name of the resource
      Returns:
      the resource named cortex://<name>
    • getResource

      public static org.apache.jena.rdf.model.Resource getResource()
      Returns a fresh, randomly named branch resource.
      Returns:
      a resource named cortex://branch-<uuid>
    • getRetractions

      public static org.apache.jena.rdf.model.Resource getRetractions(org.apache.jena.rdf.model.Resource branch)
      Returns the graph holding the statements a branch stages for removal from the approved assertions.

      It is a graph of its own rather than part of the branch graph because the branch graph is a set of statements to add, and the two must not be confused with each other by any reader. Its name deliberately does not start with branch-, so isBranch(org.apache.jena.rdf.model.Resource) does not mistake it for a branch of its own.

      Parameters:
      branch - the branch resource, named cortex://branch-<uuid>
      Returns:
      a resource named cortex://retract-<uuid>
    • isBranch

      public static boolean isBranch(org.apache.jena.rdf.model.Resource graph)
      Reports whether the named graph is a branch, by its name alone.

      Branches are named graphs of the assertions dataset, but so are PROVENANCE, USAGE, and the retraction graphs of branches themselves — none of which is a branch, and every one of which would otherwise be listed as one and could be approved into the default graph.

      Parameters:
      graph - the named graph resource
      Returns:
      true if the graph is a branch