# Editable RDFS vocabulary source. Assemble distributions with scripts/build_rdf.py.
# Copyright (c) 2026 CoreStory, Inc. — Apache-2.0

@prefix export: <https://ontologies.corestory.ai/sao/export/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sao: <https://ontologies.corestory.ai/sao/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

sao:Constraint a rdfs:Class ;
    rdfs:label "Constraint" ;
    rdfs:comment "A condition that must be satisfied for authorization" ;
    rdfs:isDefinedBy sao: ;
    rdfs:subClassOf sao:NamedEntity ;
    skos:note "Adds contextual or temporal restrictions to permissions." .

sao:Permission a rdfs:Class ;
    rdfs:label "Permission" ;
    rdfs:comment "A specific allowed action on a resource type or instance" ;
    rdfs:isDefinedBy sao: ;
    rdfs:subClassOf sao:NamedEntity ;
    skos:note "Represents atomic units of access that can be granted or denied." .

sao:Policy a rdfs:Class ;
    rdfs:label "Policy" ;
    rdfs:comment "A rule set governing access decisions" ;
    rdfs:isDefinedBy sao: ;
    rdfs:subClassOf sao:NamedEntity ;
    skos:note "Implements complex authorization logic that cannot be expressed through simple role-permission mappings." .

sao:Role a rdfs:Class ;
    rdfs:label "Role" ;
    rdfs:comment "A named collection of permissions assignable to actors" ;
    rdfs:isDefinedBy sao: ;
    rdfs:subClassOf sao:NamedEntity ;
    skos:note "Groups permissions into meaningful job functions or responsibilities that can be assigned to identities." .

sao:Scope a rdfs:Class ;
    rdfs:label "Scope" ;
    rdfs:comment "A boundary limiting where a permission applies" ;
    rdfs:isDefinedBy sao: ;
    rdfs:subClassOf sao:NamedEntity ;
    skos:note "Restricts permissions to specific contexts, reducing the blast radius of access grants." .

sao:ConstraintType a rdfs:Datatype ;
    rdfs:label "ConstraintType" ;
    rdfs:comment "Types of authorization constraints" ;
    rdfs:isDefinedBy sao: ;
    rdfs:subClassOf rdfs:Literal ;
    export:permissibleValue <https://ontologies.corestory.ai/sao/export/values/ConstraintType/attribute>,
        <https://ontologies.corestory.ai/sao/export/values/ConstraintType/context>,
        <https://ontologies.corestory.ai/sao/export/values/ConstraintType/rate_limit>,
        <https://ontologies.corestory.ai/sao/export/values/ConstraintType/spatial>,
        <https://ontologies.corestory.ai/sao/export/values/ConstraintType/temporal> .

sao:allows_actions a rdf:Property ;
    rdfs:label "allows_actions" ;
    rdfs:comment "[Permission] `Action` entities permitted by this permission.",
        "`Action` entities permitted by this permission." ;
    rdfs:domain sao:Permission ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Action .

sao:applies_to_resource_types a rdf:Property ;
    rdfs:label "applies_to_resource_types" ;
    rdfs:comment "[Permission] `ResourceType` entities this permission governs.",
        "`ResourceType` entities this permission governs." ;
    rdfs:domain sao:Permission ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:ResourceType .

sao:assigned_to_identities a rdf:Property ;
    rdfs:label "assigned_to_identities" ;
    rdfs:comment "[Role] `Identity` entities that have this role.",
        "`Identity` entities that have this role." ;
    rdfs:domain sao:Role ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Identity .

sao:can_access_features a rdf:Property ;
    rdfs:label "can_access_features" ;
    rdfs:comment "[Role] `Feature` entities accessible to this role.",
        "`Feature` entities accessible to this role." ;
    rdfs:domain sao:Role ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Feature .

sao:enforced_by_system a rdf:Property ;
    rdfs:label "enforced_by_system" ;
    rdfs:comment "[Policy] `System` that enforces this policy.",
        "`System` that enforces this policy." ;
    rdfs:domain sao:Policy ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:System .

sao:evaluated_by_policies a rdf:Property ;
    rdfs:label "evaluated_by_policies" ;
    rdfs:comment "[Permission] `Policy` entities evaluating this permission.",
        "`Policy` entities evaluating this permission." ;
    rdfs:domain sao:Permission ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Policy .

sao:evaluates_permissions a rdf:Property ;
    rdfs:label "evaluates_permissions" ;
    rdfs:comment "[Policy] `Permission` entities evaluated by this policy.",
        "`Permission` entities evaluated by this policy." ;
    rdfs:domain sao:Policy ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Permission .

sao:granted_by_roles a rdf:Property ;
    rdfs:label "granted_by_roles" ;
    rdfs:comment "[Permission] `Role` entities that grant this permission.",
        "`Role` entities that grant this permission." ;
    rdfs:domain sao:Permission ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Role .

sao:grants_permissions a rdf:Property ;
    rdfs:label "grants_permissions" ;
    rdfs:comment "[Role] `Permission` entities included in this role.",
        "`Permission` entities included in this role." ;
    rdfs:domain sao:Role ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Permission .

sao:guards_routes a rdf:Property ;
    rdfs:label "guards_routes" ;
    rdfs:comment "[Policy] `Route` entities guarded by this policy.",
        "`Route` entities guarded by this policy." ;
    rdfs:domain sao:Policy ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Route .

sao:has_rules a rdf:Property ;
    rdfs:label "has_rules" ;
    rdfs:comment "List of rules within this policy.",
        "[Policy] List of rules within this policy." ;
    rdfs:domain sao:Policy ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Rule .

sao:inherited_by_roles a rdf:Property ;
    rdfs:label "inherited_by_roles" ;
    rdfs:comment "Child roles that inherit from this role.",
        "[Role] Child roles that inherit from this role." ;
    rdfs:domain sao:Role ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Role .

sao:inherits_from_role a rdf:Property ;
    rdfs:label "inherits_from_role" ;
    rdfs:comment "Parent role for role hierarchy.",
        "[Role] Parent role for role hierarchy." ;
    rdfs:domain sao:Role ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Role .

sao:is_system_role a rdf:Property ;
    rdfs:label "is_system_role" ;
    rdfs:comment "Whether this is a built-in system role.",
        "[Role] Whether this is a built-in system role." ;
    rdfs:domain sao:Role ;
    rdfs:isDefinedBy sao: ;
    rdfs:range xsd:boolean .

sao:limited_by_scope a rdf:Property ;
    rdfs:label "limited_by_scope" ;
    rdfs:comment "[Permission] `Scope` entity defining boundaries.",
        "`Scope` entity defining boundaries." ;
    rdfs:domain sao:Permission ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Scope .

sao:limits_permissions a rdf:Property ;
    rdfs:label "limits_permissions" ;
    rdfs:comment "[Scope] `Permission` entities limited by this scope.",
        "`Permission` entities limited by this scope." ;
    rdfs:domain sao:Scope ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Permission .

sao:policy_type a rdf:Property ;
    rdfs:label "policy_type" ;
    rdfs:comment "Type of policy.",
        "[Policy] Type of policy." ;
    rdfs:domain sao:Policy ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:PolicyType .

sao:required_by_capabilities a rdf:Property ;
    rdfs:label "required_by_capabilities" ;
    rdfs:comment "[Permission] `Capability` entities requiring this permission.",
        "`Capability` entities requiring this permission." ;
    rdfs:domain sao:Permission ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:Capability .

sao:resource_pattern a rdf:Property ;
    rdfs:label "resource_pattern" ;
    rdfs:comment "Pattern matching resources in scope (e.g., regex, glob).",
        "[Scope] Pattern matching resources in scope (e.g., regex, glob)." ;
    rdfs:domain sao:Scope ;
    rdfs:isDefinedBy sao: ;
    rdfs:range xsd:string .

sao:scope_type a rdf:Property ;
    rdfs:label "scope_type" ;
    rdfs:comment "Type of scope.",
        "[Scope] Type of scope." ;
    rdfs:domain sao:Scope ;
    rdfs:isDefinedBy sao: ;
    rdfs:range sao:ScopeType .

sao:PolicyType a rdfs:Datatype ;
    rdfs:label "PolicyType" ;
    rdfs:comment "Types of authorization policies" ;
    rdfs:isDefinedBy sao: ;
    rdfs:subClassOf rdfs:Literal ;
    export:permissibleValue <https://ontologies.corestory.ai/sao/export/values/PolicyType/abac>,
        <https://ontologies.corestory.ai/sao/export/values/PolicyType/pbac>,
        <https://ontologies.corestory.ai/sao/export/values/PolicyType/rbac>,
        <https://ontologies.corestory.ai/sao/export/values/PolicyType/rebac> .

sao:ScopeType a rdfs:Datatype ;
    rdfs:label "ScopeType" ;
    rdfs:comment "Types of permission scopes" ;
    rdfs:isDefinedBy sao: ;
    rdfs:subClassOf rdfs:Literal ;
    export:permissibleValue <https://ontologies.corestory.ai/sao/export/values/ScopeType/field>,
        <https://ontologies.corestory.ai/sao/export/values/ScopeType/global>,
        <https://ontologies.corestory.ai/sao/export/values/ScopeType/organization>,
        <https://ontologies.corestory.ai/sao/export/values/ScopeType/resource>,
        <https://ontologies.corestory.ai/sao/export/values/ScopeType/tenant> .

<https://ontologies.corestory.ai/sao/export/values/ConstraintType/attribute> rdf:value "attribute" ;
    rdfs:comment "Attribute or property-based constraint." .

<https://ontologies.corestory.ai/sao/export/values/ConstraintType/context> rdf:value "context" ;
    rdfs:comment "Context-dependent constraint (device, IP, etc.)" .

<https://ontologies.corestory.ai/sao/export/values/ConstraintType/rate_limit> rdf:value "rate_limit" ;
    rdfs:comment "Rate limiting or quota-based constraint." .

<https://ontologies.corestory.ai/sao/export/values/ConstraintType/spatial> rdf:value "spatial" ;
    rdfs:comment "Location or geography-based constraint." .

<https://ontologies.corestory.ai/sao/export/values/ConstraintType/temporal> rdf:value "temporal" ;
    rdfs:comment "Time-based constraint (date/time ranges)." .

<https://ontologies.corestory.ai/sao/export/values/PolicyType/abac> rdf:value "abac" ;
    rdfs:comment "Attribute-Based Access Control" .

<https://ontologies.corestory.ai/sao/export/values/PolicyType/pbac> rdf:value "pbac" ;
    rdfs:comment "Policy-Based Access Control" .

<https://ontologies.corestory.ai/sao/export/values/PolicyType/rbac> rdf:value "rbac" ;
    rdfs:comment "Role-Based Access Control" .

<https://ontologies.corestory.ai/sao/export/values/PolicyType/rebac> rdf:value "rebac" ;
    rdfs:comment "Relationship-Based Access Control" .

<https://ontologies.corestory.ai/sao/export/values/ScopeType/field> rdf:value "field" ;
    rdfs:comment "Limited to specific fields within a resource." .

<https://ontologies.corestory.ai/sao/export/values/ScopeType/global> rdf:value "global" ;
    rdfs:comment "System-wide global scope." .

<https://ontologies.corestory.ai/sao/export/values/ScopeType/organization> rdf:value "organization" ;
    rdfs:comment "Limited to an organization within a tenant." .

<https://ontologies.corestory.ai/sao/export/values/ScopeType/resource> rdf:value "resource" ;
    rdfs:comment "Limited to a specific resource or resource type." .

<https://ontologies.corestory.ai/sao/export/values/ScopeType/tenant> rdf:value "tenant" ;
    rdfs:comment "Limited to a specific tenant." .

