It's all about the answers!

Ask a question

How to query data under a specific URL by SPARQL


Shirley Chang (111) | asked Jan 20 '16, 12:10 a.m.
 I am new to SPARQL and like to query the title under 1st portion of the data source. but the query doesn't work in both Jean and Twinkle and I can not figure it out.  Please help.  Thanks a lot. 

Here is my sparql  and the data source :

#filename: myquery-001.rq
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.              
@prefix dc:  <http://purl.org/dc/elements/1.1/>.  

SELECT ?title

WHERE <http://www.dlib.org>   dc:date  "1995-01-07" ?title. 

        }

Here is my source data in *.ttl 
#File: mydata-001.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.              
@prefix dc:  <http://purl.org/dc/elements/1.1/>.  

<http://www.dlib.org>
   
dc:title       "D-Lib Program - Research in Digital Libraries";
dc:description "The D-Lib program supports the community of people         with research interests in digital libraries and electronic

dc:publisher  "Corporation For National Research Initiatives";
 dc:date        "1995-01-07";
  dc:subject   "Education, research, related topics";
   dc:subject    "Library use Studies" ;
   dc:type       "World Wide Web Home Page";
dc:format     "text/html";
dc:language   "en".

<http://journals.tdl.org/jodi>
dc:title       "Journal of Digital Information";
dc:description  "First publishing papers in 1997, the Journal of Digital Information is an electronic-only, peer-reviewed journal covering the broad topics related  to digital libraries, hypertext and hypermedia systems and digital repositories, and the issues of digital information. JoDI is supported by the University of Texas Libraries and Texas A&M University Libraries and hosted by the Texas Digital Library.";
    
dc:publisher  "Texas Digital Library";
dc:date        "1997-01-01";
dc:subject   "digital libraries";
dc:subject    "visual interfaces" ; 
dc:subject    "information discovery" ;
dc:type        "World Wide Web Home Page";
dc:format      "text/html"; 
dc:language    "en".

One answer



permanent link
Donald Nong (14.4k313) | answered Jan 20 '16, 1:24 a.m.
edited Jan 20 '16, 1:26 a.m.
Not quite sure how it "doesn't work", because these words contain nothing for others to understand the issue. Also, why do you put dc:date in the query if you're interested in the title only?

The query should look like this (also shown in a screen shot of Twinkle):

prefix dc:  < http://purl.org/dc/elements/1.1/ >

select ?title
where {
    < http://www.dlib.org > dc:title ?title
}
(I add extra spaces between the angle brackets to retain the format of the post).



P.S. This forum is about IBM products on Jazz platform, not for general SPARQL questions.

Comments
Shirley Chang commented Jan 20 '16, 11:39 a.m. | edited Jan 20 '16, 11:45 a.m.

Donald Nong,  Thank You so much for your help. It works for me know.

Your answer


Register or to post your answer.