@prefix rec:<http://www.w3.org/2001/02pd/rec54#>.
@prefix contact:<http://www.w3.org/2000/10/swap/pim/contact#>.
@prefix dc:<http://purl.org/dc/elements/1.1/>. 
@prefix doc:<http://www.w3.org/2000/10/swap/pim/doc#>. 
@prefix trd:<http://www.w3.org/2001/10/trdoc-data.xsl>.
@prefix mat:<http://www.w3.org/2002/05/matrix/vocab#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix :<merge-tr-matrix#>.

<> dc:title "Matrix and TR data merger";
    dc:description "These N3 Rules are used to keep in synchronization the data maintained by the Webmaster in http://www.w3.org/2002/01/tr-automation/tr.n3 and those maintained for the Matrix by the QA Team".

# Flagging what makes that you get into the Matrix
:Status is rdf:type of rec:WD, rec:NOTE, rec:LastCall, rec:CR, rec:PR, rec:REC.
:RelevantStatus is rdf:type of rec:LastCall, rec:CR, rec:PR, rec:REC.
:RelevantProperty is rdf:type of mat:hasValidator, mat:hasTestSuite.

# Flagging data that we want in the final TheMatrix.rdf version
# @@@ Integrate mat:hasErrata in tr.rdf
:Interesting is rdf:type of dc:title, dc:date, mat:hasErrata, mat:isRelatedTo, mat:hasConformanceSection, mat:hasInteropReport, mat:hasValidator, mat:hasTestSuite, mat:hasRequirements, mat:hasPatentDisclosure, mat:hasFeedbackML, mat:hasAcronym, mat:hasImplReport, mat:hasLCIssues, rdf:type.

@forAll :DOC,:WORK, :STATUS, :P, :X.

{
    <../../../2002/01/tr-automation/tr.rdf> log:semantics [
        log:includes { :DOC a :STATUS; doc:versionOf :WORK };
    ].
    :STATUS a :RelevantStatus.
} log:implies {
    :WORK a mat:Work.
}.


{
    <../../../2002/01/tr-automation/tr.rdf> log:semantics [
        log:includes { :DOC doc:versionOf :WORK };
        log:notIncludes { :DOC a rec:FirstEdition };
        log:notIncludes { :DOC a rec:Superseded }
    ].
} log:implies {
    :WORK doc:version :DOC.
}.

{
    <matrix-base.n3> log:semantics [
        log:includes { :WORK :P :X }
    ].
    :P a :RelevantProperty.
} log:implies {
    :WORK a mat:Work.
}.

# Simple inferences rules to give a class to some objects
{
    <matrix-base.n3> log:semantics [
        log:includes { [ mat:hasValidator :X ] }
    ].
    :P a :RelevantProperty.
} log:implies {
    :X a mat:ValidationService.
}.

{
    <matrix-base.n3> log:semantics [
        log:includes { [ mat:hasTestSuite :X ] }
    ].
    :P a :RelevantProperty.
} log:implies {
    :X a mat:TestSuite.
}.
