sql Jesse_xpath.sql

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql Jesse_xpath.sql相关的知识,希望对你有一定的参考价值。

Copy(select internal_id, object_id, (xpath('/imscp:manifest/imscp:metadata/lom:lom/lom:rights/lom:cost/lom:value/text()', manifest::xml, ARRAY[ARRAY['lom', 'http://ltsc.ieee.org/xsd/LOM'],
ARRAY['imscp', 'http://www.imsglobal.org/xsd/imscp_v1p1'] ]))[1]:: text costValue,

(xpath('/imscp:manifest/imscp:metadata/lom:lom/lom:rights/lom:copyrightAndOtherRestrictions/lom:value/text()', manifest::xml, ARRAY[ARRAY['lom', 'http://ltsc.ieee.org/xsd/LOM'],
ARRAY['imscp', 'http://www.imsglobal.org/xsd/imscp_v1p1'] ]))[1]:: text copyrightAndOtherRestrictions


from available_objects  order by object_id desc limit 50) To 'C:/<filepath>/Notes1.csv' CSV
;


select internal_id, object_id,(xpath('/imscp:manifest/imscp:resources/imscp:resource/imscp:file/@href', manifest::xml, ARRAY[ARRAY['lom', 'http://ltsc.ieee.org/xsd/LOM'],
ARRAY['imscp', 'http://www.imsglobal.org/xsd/imscp_v1p1'] ]))[1]:: text resource_list
select  object_id, name, learning_areas,
(xpath('/imscp:manifest/imscp:metadata/lom:lom/lom:classification/lom:taxonPath/lom:taxon/lom:entry[lom:string="Performing arts"]/lom:string/text()', manifest::xml, ARRAY[ARRAY['lom', 'http://ltsc.ieee.org/xsd/LOM'],
ARRAY['imscp', 'http://www.imsglobal.org/xsd/imscp_v1p1'] ])) :: text

from available_objects
where (object_id like 'S%' or object_id like 'L%' or object_id like 'R%')
and
(xpath('/imscp:manifest/imscp:metadata/lom:lom/lom:classification/lom:taxonPath/lom:taxon/lom:entry[lom:string="Performing arts"]/lom:string/text()', manifest::xml, ARRAY[ARRAY['lom', 'http://ltsc.ieee.org/xsd/LOM'],
ARRAY['imscp', 'http://www.imsglobal.org/xsd/imscp_v1p1'] ])) :: text like '%Performing arts%'
order by object_id
--Thanks for this. Very helpful  I was able to validate that the field available_objects.resource_type is the same as the metadata field learningResourceType in the manifest file. 
--Sharing my queries:

select internal_id, object_id, 
(xpath('/imscp:manifest/imscp:metadata/lom:lom/lom:educational/lom:learningResourceType/lom:value/text()', manifest::xml, ARRAY[ARRAY['lom', 'http://ltsc.ieee.org/xsd/LOM'],
ARRAY['imscp', 'http://www.imsglobal.org/xsd/imscp_v1p1'] ]))[1]:: text learningResourceType

from available_objects
where (xpath('/imscp:manifest/imscp:metadata/lom:lom/lom:educational/lom:learningResourceType/lom:value/text()', manifest::xml, ARRAY[ARRAY['lom', 'http://ltsc.ieee.org/xsd/LOM'],
ARRAY['imscp', 'http://www.imsglobal.org/xsd/imscp_v1p1'] ]))[1]:: text like '%Sound%'
or
(xpath('/imscp:manifest/imscp:metadata/lom:lom/lom:educational/lom:learningResourceType/lom:value/text()', manifest::xml, ARRAY[ARRAY['lom', 'http://ltsc.ieee.org/xsd/LOM'],
ARRAY['imscp', 'http://www.imsglobal.org/xsd/imscp_v1p1'] ]))[1]:: text like '%Moving%'

Same as

select object_id, name, resource_type, start_file
from  available_objects
where (resource_type like '%Moving%' or resource_type like '%Sound%')




select internal_id, object_id, 
(xpath('/imscp:manifest/imscp:metadata/lom:lom/lom:classification/lom:taxonPath/lom:taxon/lom:entry[lom:string="Studies of Society and Environment"]/lom:string/text()', manifest::xml, ARRAY[ARRAY['lom', 'http://ltsc.ieee.org/xsd/LOM'],
ARRAY['imscp', 'http://www.imsglobal.org/xsd/imscp_v1p1'] ])) :: text

from available_objects
where object_id like 'S%'
and
(xpath('/imscp:manifest/imscp:metadata/lom:lom/lom:classification/lom:taxonPath/lom:taxon/lom:entry[lom:string="Studies of Society and Environment"]/lom:string/text()', manifest::xml, ARRAY[ARRAY['lom', 'http://ltsc.ieee.org/xsd/LOM'],
ARRAY['imscp', 'http://www.imsglobal.org/xsd/imscp_v1p1'] ])) :: text like '%Studies of Society and Environment%'
order by object_id

以上是关于sql Jesse_xpath.sql的主要内容,如果未能解决你的问题,请参考以下文章

SQL*Plus中怎么执行多个*sql脚本文件

sql 2008和sql 2012的区别

sql [sql技巧]一些sql技巧#sql

sql 2008 r2 在sql 2008上兼容么

SQL基础

有大神知道,sql server 中如何批量执行sql语句吗?