当前位置:网站首页>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 
边栏推荐
- NBD Network Block Device
- 挖财是正规的吗?股票开户安全吗?
- Add the resources directory under test in idea
- Customization and encapsulation of go language zap library logger
- JGG | 河北大学杜会龙组综述植物泛基因组学研究
- 'NVIDIA SMI' is not an internal or external command, nor is it a runnable program or batch file
- [untitled]
- Getting started with shell variables
- Is it normal to dig for money? Is it safe to open a stock account?
- What is the safest app for stock account opening? Tell me what you know
猜你喜欢

How to cut the size of a moving picture? Try this online photo cropping tool

合宙Air32F103CBT6开发板上手报告

Position (5 ways)

Two methods to rollback the code in pycharm to the specified version (with screenshot)

多张动图怎样合成一张gif?仅需三步快速生成gif动画图片

Shell array

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

Kubernetes understands kubectl/ debugging

电源自动测试系统NSAT-8000,精准高速可靠的电源测试设备

JS get the height and width corresponding to the box model (window.getcomputedstyle, dom.getboundingclientrect)
随机推荐
【世界历史】第二集——文明的曙光
如何裁剪动图大小?试试这个在线照片裁剪工具
Dmsetup command
买卖股票的最佳时机
多张动图怎样合成一张gif?仅需三步快速生成gif动画图片
API encapsulation of uniapp applet
买基金在哪里开户安全?求指导
Mutationobserver listens for DOM changes
'NVIDIA SMI' is not an internal or external command, nor is it a runnable program or batch file
Add a string at the input and textarea cursors
15 -- 最接近原点的 K 个点
JS component
How to cut the size of a moving picture? Try this online photo cropping tool
To make pytorch faster, you need to master these 17 methods
Cool assembly tutorial - concise x86 assembly language tutorial (1)
For the first time in China, Chinatelecom 5g underground personnel positioning project is officially commercial: it can track the position in real time to ensure operation safety
[world history] Episode II: Dawn of civilization
Power automatic test system nsat-8000, accurate, high-speed and reliable power test equipment
Heavyweight! The domestic IDE is released and developed by Alibaba. It is completely open source! (high performance + high customization)
Thymeleaf Usage Summary





