对所有 owl:NamedIndividual 和 return 数据进行全文搜索
full text search across all the owl:NamedIndividual and return data
我正在使用 Protege-5.0.0-beta-17
开发 ontology 和 apache-jena-fuseki-2.0.0
来托管 ontology。它有以下人员。这个场景的背景是http://mywebsite.com/module/ontologies/local_policy
下有policy个人。政策基本上是 local_policies.
类型
<!-- http://mywebsite.com/module/ontologies/policy1 -->
<owl:NamedIndividual rdf:about="http://mywebsite.com/module/ontologies/policy1">
<rdf:type rdf:resource="http://mywebsite.com/module/ontologies/local_policy"/>
<PolicyName rdf:datatype="&xsd;string">1.1.1</PolicyName>
<PolicyResponsibility rdf:datatype="&xsd;string">CIO</PolicyResponsibility>
<PolicyKeyword rdf:datatype="&xsd;string">Information Security</PolicyKeyword>
<PolicyMaturityLevel rdf:datatype="&xsd;string">Interactive-Information</PolicyMaturityLevel>
<PolicyConsulted rdf:datatype="&xsd;string">CERT</PolicyConsulted>
<PolicyDesc rdf:datatype="&xsd;string">The relevant sections of Information Security Policy which has been published by government should be used for classifying organizational data and information. The particular policies have been elaborated in "Information assets classification and control" of the Information Security (IS) policy (http://www.government.lk/images/secPolicy/Asset_Classification_and_Control.doc). The Assistance of Computer Emergency Readiness Team (CERT) could be obtained for this purpose.</PolicyDesc>
<apply rdf:resource="http://mywebsite.com/module/ontologies/focusArea1"/>
</owl:NamedIndividual>
<!-- http://mywebsite.com/module/ontologies/policy2 -->
<owl:NamedIndividual rdf:about="http://mywebsite.com/module/ontologies/policy2">
<rdf:type rdf:resource="http://mywebsite.com/module/ontologies/local_policy"/>
<PolicyName rdf:datatype="&xsd;string">2</PolicyName>
<PolicyResponsibility rdf:datatype="&xsd;string">CIO</PolicyResponsibility>
<PolicyKeyword rdf:datatype="&xsd;string">Information Security</PolicyKeyword>
<PolicyMaturityLevel rdf:datatype="&xsd;string">Interactive-Information</PolicyMaturityLevel>
<PolicyConsulted rdf:datatype="&xsd;string">CERT</PolicyConsulted>
<PolicyDesc rdf:datatype="&xsd;string">The policies defined under the “Privacy and Citizen Information Protection” of the IS policy which have been published by government should be implemented. The guidelines provided in the above section of IS policy could be accessed through (http://www.government.lk/images/secPolicy/Privacy__Citizen_Information_Protection.doc). The assistance of CERT could be obtained for achieving this purpose.</PolicyDesc>
<apply rdf:resource="http://mywebsite.com/module/ontologies/focusArea2"/>
</owl:NamedIndividual>
<!-- http://mywebsite.com/module/ontologies/policy3 -->
<owl:NamedIndividual rdf:about="http://mywebsite.com/module/ontologies/policy3">
<rdf:type rdf:resource="http://mywebsite.com/module/ontologies/local_policy"/>
<PolicyName rdf:datatype="&xsd;string">3</PolicyName>
<PolicyDesc rdf:datatype="&xsd;string">A matrix could be defined for identifying all possible audience and possible delivery channels of organizational data/information. The template given in Annex 001 could be used for this purpose. (refer Annex 001 – Information/Data classification matrix)</PolicyDesc>
<PolicyResponsibility rdf:datatype="&xsd;string">CIO</PolicyResponsibility>
<PolicyConsulted rdf:datatype="&xsd;string">government</PolicyConsulted>
<PolicyMaturityLevel rdf:datatype="&xsd;string">Initial Infomration</PolicyMaturityLevel>
<PolicyKeyword rdf:datatype="&xsd;string">Service Delivery Channels</PolicyKeyword>
<apply rdf:resource="http://mywebsite.com/module/ontologies/focusArea3"/>
</owl:NamedIndividual>
我想做的是查询 ontology 并获取这些人。另请注意,还有其他人。下面是我正在使用的查询。
SELECT ?s
WHERE
{
?s ?p ?o
FILTER(REGEX(?o, "policy"))
}
但是它并没有像预期的那样获取个人。
<http://mywebsite.com/module/ontologies/policy2>
<http://mywebsite.com/module/ontologies/policy1>
如何在所有 owl:NamedIndividual
中进行全文搜索,如果有匹配 return 特定匹配 owl:NamedIndividual
与所有数据?
更新
我在这里尝试做的是当用户输入 policy
我想获取所有包含策略关键字的策略时。假设用户类型 security
如果是这样我想获取所有包含关键字 security
的 owl:NamedIndividual
。它也应该是 local_policy 类型,如下所示。
<rdf:type rdf:resource="http://mywebsite.com/module/ontologies/local_policy"/>
如果您想检索类型为 http://mywebsite.com/module/ontologies/local_policy 的元素,那么您需要请求这些元素:
select * where {
?s rdf:type <http://mywebsite.com/module/ontologies/local_policy>
}
如果您随后想确保他们有一些 属性 其值的字符串表示形式包含文本策略,您需要添加适当的过滤器。例如:
select distinct ?s where {
?s ?p ?o ;
a <http://mywebsite.com/module/ontologies/local_policy>
filter contains(lcase(str(?o)),"security")
}
如果你想获得个人的所有属性和值,只需 select ?p 和 ?o 变量:
select distinct ?s ?p ?o where {
?s ?p ?o ;
a <http://mywebsite.com/module/ontologies/local_policy>
filter contains(lcase(str(?o)),"security")
}
您还可以使用构造查询将这些三元组作为新模型取回:
construct where {
?s ?p ?o ;
a <http://mywebsite.com/module/ontologies/local_policy>
filter contains(lcase(str(?o)),"security")
}
我正在使用 Protege-5.0.0-beta-17
开发 ontology 和 apache-jena-fuseki-2.0.0
来托管 ontology。它有以下人员。这个场景的背景是http://mywebsite.com/module/ontologies/local_policy
下有policy个人。政策基本上是 local_policies.
<!-- http://mywebsite.com/module/ontologies/policy1 -->
<owl:NamedIndividual rdf:about="http://mywebsite.com/module/ontologies/policy1">
<rdf:type rdf:resource="http://mywebsite.com/module/ontologies/local_policy"/>
<PolicyName rdf:datatype="&xsd;string">1.1.1</PolicyName>
<PolicyResponsibility rdf:datatype="&xsd;string">CIO</PolicyResponsibility>
<PolicyKeyword rdf:datatype="&xsd;string">Information Security</PolicyKeyword>
<PolicyMaturityLevel rdf:datatype="&xsd;string">Interactive-Information</PolicyMaturityLevel>
<PolicyConsulted rdf:datatype="&xsd;string">CERT</PolicyConsulted>
<PolicyDesc rdf:datatype="&xsd;string">The relevant sections of Information Security Policy which has been published by government should be used for classifying organizational data and information. The particular policies have been elaborated in "Information assets classification and control" of the Information Security (IS) policy (http://www.government.lk/images/secPolicy/Asset_Classification_and_Control.doc). The Assistance of Computer Emergency Readiness Team (CERT) could be obtained for this purpose.</PolicyDesc>
<apply rdf:resource="http://mywebsite.com/module/ontologies/focusArea1"/>
</owl:NamedIndividual>
<!-- http://mywebsite.com/module/ontologies/policy2 -->
<owl:NamedIndividual rdf:about="http://mywebsite.com/module/ontologies/policy2">
<rdf:type rdf:resource="http://mywebsite.com/module/ontologies/local_policy"/>
<PolicyName rdf:datatype="&xsd;string">2</PolicyName>
<PolicyResponsibility rdf:datatype="&xsd;string">CIO</PolicyResponsibility>
<PolicyKeyword rdf:datatype="&xsd;string">Information Security</PolicyKeyword>
<PolicyMaturityLevel rdf:datatype="&xsd;string">Interactive-Information</PolicyMaturityLevel>
<PolicyConsulted rdf:datatype="&xsd;string">CERT</PolicyConsulted>
<PolicyDesc rdf:datatype="&xsd;string">The policies defined under the “Privacy and Citizen Information Protection” of the IS policy which have been published by government should be implemented. The guidelines provided in the above section of IS policy could be accessed through (http://www.government.lk/images/secPolicy/Privacy__Citizen_Information_Protection.doc). The assistance of CERT could be obtained for achieving this purpose.</PolicyDesc>
<apply rdf:resource="http://mywebsite.com/module/ontologies/focusArea2"/>
</owl:NamedIndividual>
<!-- http://mywebsite.com/module/ontologies/policy3 -->
<owl:NamedIndividual rdf:about="http://mywebsite.com/module/ontologies/policy3">
<rdf:type rdf:resource="http://mywebsite.com/module/ontologies/local_policy"/>
<PolicyName rdf:datatype="&xsd;string">3</PolicyName>
<PolicyDesc rdf:datatype="&xsd;string">A matrix could be defined for identifying all possible audience and possible delivery channels of organizational data/information. The template given in Annex 001 could be used for this purpose. (refer Annex 001 – Information/Data classification matrix)</PolicyDesc>
<PolicyResponsibility rdf:datatype="&xsd;string">CIO</PolicyResponsibility>
<PolicyConsulted rdf:datatype="&xsd;string">government</PolicyConsulted>
<PolicyMaturityLevel rdf:datatype="&xsd;string">Initial Infomration</PolicyMaturityLevel>
<PolicyKeyword rdf:datatype="&xsd;string">Service Delivery Channels</PolicyKeyword>
<apply rdf:resource="http://mywebsite.com/module/ontologies/focusArea3"/>
</owl:NamedIndividual>
我想做的是查询 ontology 并获取这些人。另请注意,还有其他人。下面是我正在使用的查询。
SELECT ?s
WHERE
{
?s ?p ?o
FILTER(REGEX(?o, "policy"))
}
但是它并没有像预期的那样获取个人。
<http://mywebsite.com/module/ontologies/policy2>
<http://mywebsite.com/module/ontologies/policy1>
如何在所有 owl:NamedIndividual
中进行全文搜索,如果有匹配 return 特定匹配 owl:NamedIndividual
与所有数据?
更新
我在这里尝试做的是当用户输入 policy
我想获取所有包含策略关键字的策略时。假设用户类型 security
如果是这样我想获取所有包含关键字 security
的 owl:NamedIndividual
。它也应该是 local_policy 类型,如下所示。
<rdf:type rdf:resource="http://mywebsite.com/module/ontologies/local_policy"/>
如果您想检索类型为 http://mywebsite.com/module/ontologies/local_policy 的元素,那么您需要请求这些元素:
select * where {
?s rdf:type <http://mywebsite.com/module/ontologies/local_policy>
}
如果您随后想确保他们有一些 属性 其值的字符串表示形式包含文本策略,您需要添加适当的过滤器。例如:
select distinct ?s where {
?s ?p ?o ;
a <http://mywebsite.com/module/ontologies/local_policy>
filter contains(lcase(str(?o)),"security")
}
如果你想获得个人的所有属性和值,只需 select ?p 和 ?o 变量:
select distinct ?s ?p ?o where {
?s ?p ?o ;
a <http://mywebsite.com/module/ontologies/local_policy>
filter contains(lcase(str(?o)),"security")
}
您还可以使用构造查询将这些三元组作为新模型取回:
construct where {
?s ?p ?o ;
a <http://mywebsite.com/module/ontologies/local_policy>
filter contains(lcase(str(?o)),"security")
}