@prefix conf: <https://ontology.inferal.com/modules/confidence/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix ev: <https://ontology.inferal.com/modules/evidence/> .
@prefix ex: <https://example.com/evidence/api-discovery/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix ss: <https://ontology.inferal.com/modules/scoped-statements/> .

# An LLM-assisted activity examines API documentation and live HTTP traces.
ex:apiDiscoveryRun
    a prov:Activity ;
    # PROV records what the run consumed; it does not assign evidence roles.
    prov:used
        ex:apiReferenceFragment ,
        ex:httpProbeTrace ,
        ex:openApiFragment ;
    prov:wasAssociatedWith ex:structureExtractor ;
    # Claims and arguments are themselves generated, attributable resources.
    prov:generated
        ex:routeClaim ,
        ex:routeArgument ,
        ex:semanticClaim ,
        ex:semanticArgument ,
        ex:route404Defeat .

ex:structureExtractor
    a prov:SoftwareAgent ;
    dcterms:title "API structure extraction agent"@en .

# These resources are evidence only in the context of the arguments that cite
# them. PROV records their identity and lineage separately from that role.
ex:apiReferenceFragment
    a prov:Entity ;
    dcterms:title "API reference fragment describing GET /v1/customers/{id}"@en .

ex:httpProbeTrace
    a prov:Entity ;
    dcterms:title "Authenticated 200 response from GET /v1/customers/42"@en .

ex:openApiFragment
    a prov:Entity ;
    dcterms:title "OpenAPI fragment for the Customer response schema"@en .

# The route claim is also a scoped claim about an exact RDF quad. Multi-typing
# composes the two modules without an evidence-specific statement syntax.
ex:routeClaim
    a ev:Claim, ss:ScopedClaim ;
    dcterms:description "The service exposes GET /v1/customers/{id}."@en ;
    ss:claimTarget ex:routeQuad ;
    ss:scope ex:observedServiceVersion ;
    ss:claimValue ex:asserted .

ex:routeQuad
    a ss:QuadTarget ;
    # The quad identifies exact claim content without asserting that content.
    ss:subjectTerm ex:customerLookup ;
    ss:predicateTerm ex:httpMethod ;
    ss:objectResourceTerm ex:GET .

# A premise is a proposition used by the argument, not a source artifact.
ex:documentationPremise
    a ev:Claim ;
    dcterms:description "The API reference identifies GET /v1/customers/{id} as a customer lookup operation."@en .

# The warrant makes the reasoning bridge inspectable instead of leaving it
# implicit in an application or prompt.
ex:docsAndProbeWarrant
    a ev:Claim, ev:ReasoningBasis ;
    dcterms:description "Concordant documentation and a successful authenticated probe justify a provisional route-availability claim for the observed service version."@en .

ex:routeArgument
    a ev:SupportArgument ;
    ev:hasPremise ex:documentationPremise ;
    # hasEvidence selects two of the used entities for this argument's role.
    ev:hasEvidence
        ex:apiReferenceFragment ,
        ex:httpProbeTrace ;
    ev:hasWarrant ex:docsAndProbeWarrant ;
    ev:hasConclusion ex:routeClaim ;
    prov:wasGeneratedBy ex:apiDiscoveryRun ;
    prov:wasAttributedTo ex:structureExtractor .

ex:semanticClaim
    a ev:Claim ;
    dcterms:description "A successful response represents one Customer resource."@en .

ex:schemaInterpretationWarrant
    a ev:ReasoningBasis ;
    dcterms:description "The response schema's object type and identifier property justify interpreting the payload as one Customer resource."@en .

# A conclusion from one argument can become a premise in a later support step.
ex:semanticArgument
    a ev:SupportArgument ;
    ev:hasPremise ex:routeClaim ;
    ev:hasEvidence ex:openApiFragment ;
    ev:hasWarrant ex:schemaInterpretationWarrant ;
    ev:hasConclusion ex:semanticClaim ;
    prov:wasGeneratedBy ex:apiDiscoveryRun ;
    prov:wasAttributedTo ex:structureExtractor .

# A later observation can attack a component or the inferential connection
# without deleting the original support trace.
ex:secondTenantTrace
    a prov:Entity ;
    dcterms:title "Authenticated 404 response for the same route in a second tenant"@en .

ex:secondTenantFailureClaim
    a ev:Claim ;
    dcterms:description "The route returned 404 in a second tenant."@en .

ex:scopeLimitationClaim
    a ev:Claim ;
    dcterms:description "The route-availability conclusion may not generalize across tenants."@en .

ex:route404Defeat
    a ev:DefeatingArgument ;
    ev:hasPremise ex:secondTenantFailureClaim ;
    ev:hasEvidence ex:secondTenantTrace ;
    ev:hasConclusion ex:scopeLimitationClaim ;
    # Undercutting targets the inference; undermining targets an input entity.
    ev:undercuts ex:routeArgument ;
    ev:undermines ex:httpProbeTrace ;
    prov:wasGeneratedBy ex:apiDiscoveryRun .

# Confidence remains an independent assessment vocabulary. Its target is the
# argument resource, so the evidence module does not need confidence terms.
ex:routeArgumentConfidence
    a conf:ConfidenceAssessment ;
    conf:assessmentTarget ex:routeArgument ;
    conf:confidenceValue ex:routeArgumentProbability .

ex:routeArgumentProbability
    a conf:ProbabilityValue ;
    conf:scale conf:ProbabilityScale ;
    conf:score 0.82 .
