Skip to content

Instantly share code, notes, and snippets.

@asanchez75
Created July 1, 2022 13:57
Show Gist options
  • Save asanchez75/535c533f5ad2050a817554489cbd00f4 to your computer and use it in GitHub Desktop.
Save asanchez75/535c533f5ad2050a817554489cbd00f4 to your computer and use it in GitHub Desktop.
[PrefixDeclaration]
: http://example.org/voc#
ex: http://example.org/
owl: http://www.w3.org/2002/07/owl#
rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
xml: http://www.w3.org/XML/1998/namespace
xsd: http://www.w3.org/2001/XMLSchema#
foaf: http://xmlns.com/foaf/0.1/
obda: https://w3id.org/obda/vocabulary#
rdfs: http://www.w3.org/2000/01/rdf-schema#
sides: http://ontosides.org/ontology#
[MappingDeclaration] @collection [[
mappingId question
target sides:q{id} sides:has_for_title "{name}"^^xsd:string .
source select id, name from mdl_question
mappingId question
target sides:q{id} rdf:type sides:{question_type} .
source select q.id, replace(c.name, ' ', '_') as question_type, q.qtype from mdl_question q
inner join mdl_question_categories c
on q.category = c.id
mappingId urn:proposal_of_answer_type
target sides:prop{proposal_id} a sides:proposal_of_answer .
source select distinct a.id as proposal_id from mdl_question q
inner join mdl_question_answers a on a.question = q.id
where q.id = a.question
mappingId urn:proposal_of_answer_question
target sides:q{question_id} sides:has_for_proposal_of_answer sides:prop{proposal_id} .
source select q.id as question_id, a.id as proposal_id from mdl_question q
inner join mdl_question_answers a on a.question = q.id
where q.id = a.question
]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment