title: How do I store rule-related data in RDF?
body: <p>I have some data on students' test scores as follows:</p>
  <pre><code>@prefix : &lt;http://example.org/#&gt; .
  :Bob a :Student;
       :tookTest :Test0,:Test1,:Test2 ,:Test3 .
  :Test0 :score 90 .
  :Test1 :score 81 .
  :Test2 :score 62 .
  :Test3 :score 32 .
  </code></pre>
  <p>The rules for grading based on scores are as follows:</p>
  <pre><code>  [90-100]  --&gt; A
    [75-90)   --&gt; B
    [60-75)   --&gt; C
    [0-60)    --&gt; D
  </code></pre>
  <p>So I used the following SPARQL query to get the grade of the student's Test:</p>
  <pre><code>prefix : &lt;http://example.org/#&gt;
  select ?student ?test ?grade
      WHERE {  
        ?student :tookTest ?test .
        ?test :score ?score .
        BIND ( IF ( ?score &gt;= 90 , &quot;A&quot;, IF ( ?score&gt;=75, &quot;B&quot;, IF ( ?score&gt;=60, &quot;C&quot;, &quot;D&quot; ) ) ) AS ?grade )
        }
  </code></pre>
  <p>And I got the right result as such:</p>
  <pre><code>student,                  test,                       grade
  http://example.org/#Bob,  http://example.org/#Test3,  D
  http://example.org/#Bob,  http://example.org/#Test2,  C
  http://example.org/#Bob,  http://example.org/#Test1,  B
  http://example.org/#Bob,  http://example.org/#Test0,  A
  </code></pre>
  <p>Now my question is how to store this rule data in RDF (along with the score) rather than in SPARQL,  so that the rule data can be defined and modified by the user, The server side reads the rule data to generate the appropriate SPARQL query.<br />
  My initial thoughts are as follows:</p>
  <pre><code> :range1 a :range ；
           :grade &quot;A&quot; ;
           :lowerLimit 90 ;
           :upperLimit 100.
  :range2 a :range ；
           :grade &quot;B&quot; ;
           :lowerLimit 75 ;
           :upperLimit 89 .
  :range3 a :range ；
           :grade &quot;C&quot; ;
           :lowerLimit 60 ;
           :upperLimit 74 .
  :range4 a :range ；
           :grade &quot;D&quot; ;
           :lowerLimit 0 ;
           :upperLimit 59 .
  :rule1 :hasRange :range1,:range2, :range3, :range4 .
  </code></pre>
  <p>But now how do I make the SPARQL work? And how to consider inclusive and exclusive of boundary values?</p>