title: Accessing the literal value of the object of a triple
body: <p>I'm working on a validator that validates turtle files. When working on a function to check if the cardinality that's stated is correct for each object, I can't figure out how to access the value of a literal.</p>
  
  <p>The literal value is <code>Card=literal(type(xsd:nonNegativeInteger, '1'))</code> (or <code>1^^'http://www.w3.org/2001/XMLSchema#nonNegativeInteger'</code>).</p>
  
  <p>I find a bag of properties of length L. How can I check that <code>L == Card</code>?</p>
  
  <p>I already tried the following:</p>
  
  <pre><code>% L and Card are both 1
  rdf_canonical_literal(L, LiteralL), rdf_compare(=, LiteralL, Card).
  % false
  
  rdf_canonical_literal(L, LiteralL).
  % LiteralL = 1^^'http://www.w3.org/2001/XMLSchema#integer'.
  </code></pre>
  
  <p>The problem is that <code>xsd:integer</code> and <code>xsd:nonNegativeInteger</code> don't compare as equal.</p>
  
  <p>However, the easiest thing to me would seem to get the value of <code>Card</code> but I really don't see how to do it. Any solutions or pointers where to find an example of this would be much appreciated!!</p>