Accessing the literal value of the object of a tripleAsk Question

问题:

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.

The literal value is Card=literal(type(xsd:nonNegativeInteger, '1')) (or 1^^'http://www.w3.org/2001/XMLSchema#nonNegativeInteger').

I find a bag of properties of length L. How can I check that L == Card?

I already tried the following:

% 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'.

The problem is that xsd:integer and xsd:nonNegativeInteger don't compare as equal.

However, the easiest thing to me would seem to get the value of Card 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!!

标签: swi-prolog turtle-rdf cliopatria
© 2014 TuiCode, Inc.