当前位置:网站首页>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 
边栏推荐
- Get the parameters in the URL and the interchange between parameters and objects
- JS get the height and width corresponding to the box model (window.getcomputedstyle, dom.getboundingclientrect)
- Add a string at the input and textarea cursors
- Report on Hezhou air32f103cbt6 development board
- Uniapp icon configuration
- 如何裁剪动图大小?试试这个在线照片裁剪工具
- Async await to achieve sleep waiting effect
- [deep learning] multi label learning
- What is the safest app for stock account opening? Tell me what you know
- Custom instruction, mixing, routing, lifecycle
猜你喜欢

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

Add the resources directory under test in idea

Complete and detailed compilation of experimental reports

90 后眼中的理想 L9:最简单的产品哲学,造最猛的爆款 | 指南斟

Reading the "clean" series for the first time, I didn't think it was a good book

Kubernetes understands kubectl/ debugging

【中國海洋大學】考研初試複試資料分享

How to view the Chrome browser plug-in location

Heavyweight! The domestic IDE is released and developed by Alibaba. It is completely open source! (high performance + high customization)

The best screenshot tool in the world, color absorption tool snipaste
随机推荐
Position (5 ways)
Let and const commands
当了六年程序员第一次搞懂微服务架构的数据一致性,真不容易
None of the MLIR optimization passes are enabled (registered 2) solutions
Is it safe to open an online stock account? Who knows
[untitled] the CMD command window displays' NPM 'which is not an internal or external command
H5 page graying source code, ie compatible (elegant downgrade provides download browser link)
Biscuit distribution
Renix perf: detailed explanation of IP network performance test tools and test case parameters
Supplementary inheritance and strict mode
How to combine multiple motion graphs into a GIF? Generate GIF animation pictures in three steps
Partager les points techniques de code et l'utilisation de logiciels pour la communication Multi - clients socket que vous utilisez habituellement
JS functions
【中國海洋大學】考研初試複試資料分享
Open a restaurant
Common formatting methods for amount numbers
Does stream even have application advanced learning? As a programmer, you know what
如何裁剪动图大小?试试这个在线照片裁剪工具
[Ocean University of China] information sharing for the first and second examinations of postgraduate entrance examination
[untitled]





