当前位置:网站首页>SPARQL learning notes of query, an rrdf query language
SPARQL learning notes of query, an rrdf query language
2022-06-25 14:47:00 【HELLOWORLD2424】
SPARQL query Learning from
This article mainly records SPARQL The learning process and demo Results of operation , This practice project is based on apache-jena-fuseki,demo The database file for is kg-demo-for-movie
1. Check all the links with movieTitle= Chill related triples
PREFIX : <http://www.kgdemo.com#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE {
?x :movieTitle ' chills '.
?x ?p ?o.
}
Query results
2. Yes 1 Format the results in , Display only predicate Predicate sum object object
PREFIX : <http://www.kgdemo.com#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?p ?o WHERE {
?x :movieTitle ' chills '.
?x ?p ?o.
}
Query results
3. Use CONCAT Format all movie titles and release times
PREFIX : <http://www.kgdemo.com#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT (CONCAT("movie name: ", ?name, " release: ", ?date)) WHERE {
?x :movieTitle ?name.
?x :movieReleaseDate ?date.
}
Query results
4. Use BIND Key words put 3 Copy the results found in to info Variable
PREFIX : <http://www.kgdemo.com#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?info WHERE {
?x :movieTitle ?name.
?x :movieReleaseDate ?date.
BIND (CONCAT("movie name: ", ?name, " release: ", ?date) AS ?info)
}
Query results
5. Use CONSTRUCT Keyword query and build RDF Return after drawing
PREFIX : <http://www.kgdemo.com#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
CONSTRUCT {?x :movieTitle ?name} WHERE {
?x :movieTitle ?name.
}
Query results
6. Use FILTER Field to filter the results
Select to ’' cold " Is the name of the movie that begins
PREFIX : <http://www.kgdemo.com#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?name WHERE {
?x :movieTitle ?name.
FILTER regex(?name, "^ cold ")
}
Query results
7. Use OPTIONAL Keyword to build a variety of query patterns
PREFIX : <http://www.kgdemo.com#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?name ?date WHERE {
?x :movieTitle ?name.
OPTIONAL {?x :movieReleaseDate ?date}
}
In the above statement ,optional The condition inside is the second match 
边栏推荐
- Haven't you understood the microservice data architecture transaction management +acid+ consistency +cap+base theory? After reading it, you can completely solve your doubts
- Two methods to rollback the code in pycharm to the specified version (with screenshot)
- Clipboard tutorial
- 分享自己平时使用的socket多客户端通信的代码技术点和软件使用
- Native JS obtains form data and highlights and beautifies JSON output display
- Kubernetes 理解kubectl/调试
- 【中國海洋大學】考研初試複試資料分享
- dev/mapper的解释
- [world history] Episode II: Dawn of civilization
- Application of TSDB in civil aircraft industry
猜你喜欢
![[try to hack] vulhub shooting range construction](/img/fc/6057b6dec9b51894140453e5422176.png)
[try to hack] vulhub shooting range construction

15 -- k points closest to the origin

Ideal L9 in the eyes of the post-90s: the simplest product philosophy, creating the most popular products

Power automatic test system nsat-8000, accurate, high-speed and reliable power test equipment

分享自己平時使用的socket多客戶端通信的代碼技術點和軟件使用

【Try to Hack】vulhub靶场搭建

Stream竟然还有应用进阶学习?作为程序员的你知道吗

Master XSS completely from 0 to 1

Renix Perf: IP网络性能测试工具及测试用例参数详解

TSDB在民机行业中的应用
随机推荐
Application of TSDB in civil aircraft industry
Explanation of dev/mapper
NBD Network Block Device
Where is it safe to open an account for buying funds? Ask for guidance
[Ocean University of China] Data Sharing for retest of initial Examination
JVM uses tools to analyze classic cases of OOM
挖财是正规的吗?股票开户安全吗?
Garbage collection mechanism
[Ocean University of China] information sharing for the first and second examinations of postgraduate entrance examination
Page 112 machine learning - review of fundamentals of mathematics pptx
【Try to Hack】vulnhub DC1
Shell string variable
当了六年程序员第一次搞懂微服务架构的数据一致性,真不容易
Biscuit distribution
Flexible layout (display:flex;) Attribute details
15 -- 最接近原点的 K 个点
Renix perf: detailed explanation of IP network performance test tools and test case parameters
[untitled]
重磅!国产 IDE 发布,由阿里研发,完全开源!(高性能+高定制性)
Using Sphinx to automatically generate API documents from py source files





