
query.roman.rq Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of corese-gui Show documentation
Show all versions of corese-gui Show documentation
Corese is a Semantic Web Factory (triple store and SPARQL endpoint)
implementing RDF, RDFS, SPARQL 1.1 Query and Update, Shacl. STTL. LDScript.
The newest version!
#
# Roman numbers custom datatype
# Olivier Corby - Wimmics Inria I3S - 2015
#
prefix dt:
prefix rm:
prefix spqr:
select ?res ?val (spqr:digit(?val) as ?dig)
where {
bind ( 'II'^^dt:roman * 'X'^^dt:roman + 'V'^^dt:roman as ?res)
bind (maplist(rm:roman, xt:iota(7)) as ?list)
bind (reduce (rq:plus, ?list) as ?val)
}
export {
function rm:equal(?x, ?y) { (spqr:digit(?x) = spqr:digit(?y))}
function rm:diff(?x, ?y) { (spqr:digit(?x) != spqr:digit(?y))}
function rm:less(?x, ?y) { (spqr:digit(?x) < spqr:digit(?y))}
function rm:lessEqual(?x, ?y) { (spqr:digit(?x) <= spqr:digit(?y))}
function rm:greater(?x, ?y) { (spqr:digit(?x) > spqr:digit(?y))}
function rm:greaterEqual(?x, ?y) { (spqr:digit(?x) >= spqr:digit(?y))}
function rm:plus(?x, ?y) { rm:roman(spqr:digit(?x) + spqr:digit(?y))}
function rm:minus(?x, ?y) { rm:roman(spqr:digit(?x) - spqr:digit(?y))}
function rm:mult(?x, ?y) { rm:roman(spqr:digit(?x) * spqr:digit(?y))}
function rm:divis(?x, ?y) { rm:roman(spqr:digit(?x) / spqr:digit(?y))}
function rm:roman(?x) { strdt(spqr:romain(?x), dt:roman) }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy