<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#006600" bgcolor="#ffffff">
<blockquote>Jagdev,<br>
<br>
I'm not sure what your question is for Turtle. Turtle is a
serialization of RDF. It's probably the easiest way to put triples in
an email. SPARQL is a query language syntactically inspired by Turtle.<br>
<br>
If I rewrite your rdf as Turtle, I think I get something like this:<br>
<br>
:AgeGroup rdfs:label "AgeGroup";<br>
rdfs:comment "Documentation on AgeGroup(SUMO): A GroupOfPeople
whose members all have the same age or have and age which is inside a
certain age interval (example, persons between 18 and 25 years)";<br>
rdfs:subClassOf :GroupOfPeople.<span
style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><br>
<br>
</span>:GroupOfPeople rdfs:label "GroupOfPeople";<br>
rdfs:comment "Documentation on GroupOfPeople(SUMO): Any Group
whose members are exclusively Humans. The instances of this class are
used for annotation of groups of interest for a certain news item.
Examples of GroupOfPeople include age groups, religious groups, etc.";<br>
rdfs:subClassOf :Group;<br>
<br>
If that is a correct interpretation (I wasn't sure what you were doing
with &Content:), then these queries should work (they are SPARQL
format, minus prefixes).<br>
<br>
<span
style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><span
style="">a)<span
style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span><!--[endif]--><span
style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">All
childnodes
of the class called Group</span><!--[if !supportLists]--><span
style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><span
style=""><br>
</span></span>
select ?childNode<br>
where { ?childNode rdfs:subClassOf :Group . }<br>
<br>
<span
style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><span
style=""></span></span><span
style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><span
style="">b)<span
style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span><!--[endif]--><span
style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">All
parentnodes
of the class called AgeGroup<br>
</span><span
style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p></o:p></span>select
?parentNode<br>
where { :AgeGroup rdfs:subClassOf ?parentNode .}<br>
<br>
Basically, the trick is to determine the RDF triple(s) that would state
the relationship, then put the variable terms in place of what you're
looking for.<br>
<br>
As for the question about using Turtle in c, that's what Redland is
for. =)<br>
<br>
-j<br>
<br>
</blockquote>
<pre class="moz-signature" cols="72">Joe Andrieu
<a class="moz-txt-link-abbreviated" href="mailto:joe@switchbook.com">joe@switchbook.com</a>
+1 (805) 705-8651
<a class="moz-txt-link-freetext" href="http://www.switchbook.com">http://www.switchbook.com</a>
</pre>
<br>
On 6/21/2010 12:09 PM, Jagdev Bhogal wrote:
<blockquote
cite="mid:123505CD74170A4097732B2AC5326CB0043927F3@STAFFEXA.staff.uce.ac.uk"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<meta name="GENERATOR" content="MSHTML 8.00.7600.16588">
<div dir="ltr" id="idOWAReplyText86059">
<div dir="ltr"> </div>
</div>
<div dir="ltr"><br>
<span style="color: rgb(31, 73, 125); font-size: 11pt;"></span> </div>
<div>
<blockquote cite="" type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">From the following
extract we can see that AgeGroup is a descendant of GroupofPeople and
GroupofPeople is a descendant of Group</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"><rdfs:Class
rdf:about="&Content;AgeGroup"</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">
rdfs:label="Content:AgeGroup"></span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">
<rdfs:comment>Documentation on AgeGroup(SUMO): A GroupOfPeople
whose members all have the same age or have and age which is inside a
certain age interval (example, perso</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">ns between 18 and 25
years)</rdfs:comment></span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">
<rdfs:subClassOf rdf:resource="&Content;GroupOfPeople"/></span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"></rdfs:Class></span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"><rdfs:Class
rdf:about="&Content;GroupOfPeople"</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">
rdfs:label="Content:GroupOfPeople"></span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">
<rdfs:comment>Documentation on GroupOfPeople(SUMO): Any
Group whose members are exclusively Humans. The instances of this class
are used for annotation of groups of inte</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">rest for a certain
news item. Examples of GroupOfPeople include age groups, religious
groups, etc.</rdfs:comment></span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">
<rdfs:subClassOf rdf:resource="&Content;Group"/></span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"></rdfs:Class></span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">QUESTION</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">How can I write the
query so that it retrieves :</span></p>
<p style="text-indent: -18pt;" class="MsoListParagraph"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"><span>a)<span
style="line-height: normal; font-variant: normal; font-style: normal; font-size: 7pt; font-weight: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span><span
style="color: rgb(31, 73, 125); font-size: 11pt;">All childnodes of
the class called Group</span></p>
<p style="text-indent: -18pt;" class="MsoListParagraph"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"><span>b)<span
style="line-height: normal; font-variant: normal; font-style: normal; font-size: 7pt; font-weight: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span><span
style="color: rgb(31, 73, 125); font-size: 11pt;">All parentnodes of
the class called AgeGroup</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">Please point me in
the right direction, or am I trying to achieve something that is not
possible?</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">Is it possible to
use TURTLE within a C program to achieve the above?</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">Many, many thanks</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;">Jagdev</span></p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
<p class="MsoNormal"><span
style="color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
<div>
<div
style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">
<p class="MsoNormal"><b><span
style="color: windowtext; font-size: 10pt;" lang="EN-US">From:</span></b><span
style="color: windowtext; font-size: 10pt;" lang="EN-US"> Joe Andrieu [<a
moz-do-not-send="true" class="moz-txt-link-freetext"
href="mailto:joe@switchbook.com">mailto:joe@switchbook.com</a>] <br>
<b>Sent:</b> 20 June 2010 19:05<br>
<b>To:</b> Jagdev Bhogal<br>
<b>Cc:</b> <a moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="mailto:redland-dev@lists.librdf.org">redland-dev@lists.librdf.org</a><br>
<b>Subject:</b> Re: [redland-dev] xpath query</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I"m not sure which query module you're using,
but with SPARQL, you would just get rid of the ?label term and use
"City" instead. In fact, whatever the query engine, you can probably
just use sprintf or something similar to construct the query clause
with "City" in place of ?label.<br>
<br>
Something like</p>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;"><br>
char keyword[]="City";</span></p>
</div>
<div>
<p style="margin-bottom: 12pt;" class="MsoNormal"><span
style="font-size: 10pt;">char query_string[BIGENOUGHBUFFER];<br>
<br>
sprintf(query_string, "select ?comment from <C:/datafile.rdf>
where (?x rdf:type rdfs:Class) (?x rdfs:label \"%s\") (?x rdfs:comment
?comment) using rdf for <a moz-do-not-send="true"
href="http://www.w3.org/1999/02/22-rdf-syntax-ns"><http://www.w3.org/1999/02/22-rdf-syntax-ns#></a>,
rdfs for <a moz-do-not-send="true"
href="http://www.w3.org/2000/01/rdf-schema"><http://www.w3.org/2000/01/rdf-schema#></a>",
keyword);</span></p>
</div>
<p class="MsoNormal">I won't address the potential unicode and
buffer overrun problems. I prefer c++ classes to deal with the buffer
issues and haven't yet settled completely on how I'm handling unicode.<br>
<br>
-j<br>
<br>
<br>
</p>
<pre>Joe Andrieu</pre>
<pre><a moz-do-not-send="true" href="mailto:joe@switchbook.com">joe@switchbook.com</a></pre>
<pre>+1 (805) 705-8651</pre>
<pre><a moz-do-not-send="true" href="http://www.switchbook.com/">http://www.switchbook.com</a></pre>
<p class="MsoNormal"><br>
On 6/20/2010 4:11 AM, Jagdev Bhogal wrote: </p>
<div>
<p class="MsoNormal"><span style="color: black; font-size: 10pt;">Dear
all</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;">I have a
c-program which currently parses an rdf file and retrieves all of the
nodes using:</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;">const char
*query_string="select ?label, ?comment from <C:/datafile.rdf>
where (?x rdf:type rdfs:Class) (?x rdfs:label ?label) (?x rdfs:comment
?comment) using rdf for <<a moz-do-not-send="true"
href="http://www.w3.org/1999/02/22-rdf-syntax-ns#%3E,rdfs">http://www.w3.org/1999/02/22-rdf-syntax-ns#>,rdfs</a>
for <<a moz-do-not-send="true"
href="http://www.w3.org/2000/01/rdf-schema">http://www.w3.org/2000/01/rdf-schema</a>#>";</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;">Lets say I have
a string defined as:</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;">char
keyword[]="City";</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;">My question is
can we have a where clause in the query, so that we only retrieve
results where the strcmp(label, keyword) = 0 in other words only
retrieve those results where the label is equal to the keyword which in
this case is "City". </span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;">If further
explanation is needed let me know.</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;">Thank you</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;">Jagdev</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<div style="text-align: center;" class="MsoNormal" align="center">
<hr size="2" align="center" width="100%"></div>
<p class="MsoNormal">Through our significant contribution to the
creative industries and the city's cultural and artistic life,<br>
Birmingham City University is proud to support Birmingham's bid to be
UK City of Culture in 2013<br>
<br>
<a moz-do-not-send="true" href="http://birminghamculture.org/">http://birminghamculture.org</a><br>
<a moz-do-not-send="true"
href="http://www.bcu.ac.uk/about-us/excellent-arts">http://www.bcu.ac.uk/about-us/excellent-arts</a>
</p>
</div>
<pre> </pre>
<pre style="text-align: center;"><hr size="4" align="center"
width="90%">
</pre>
<pre> </pre>
<pre>_______________________________________________</pre>
<pre>redland-dev mailing list</pre>
<pre><a moz-do-not-send="true"
href="mailto:redland-dev@lists.librdf.org">redland-dev@lists.librdf.org</a></pre>
<pre><a moz-do-not-send="true"
href="http://lists.librdf.org/mailman/listinfo/redland-dev">http://lists.librdf.org/mailman/listinfo/redland-dev</a></pre>
</div>
<div>
<hr>Through our significant contribution to the creative industries
and the city's cultural and artistic life,<br>
Birmingham City University is proud to support Birmingham's bid to be
UK City of Culture in 2013<br>
<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://birminghamculture.org/">http://birminghamculture.org</a><br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://www.bcu.ac.uk/about-us/excellent-arts">http://www.bcu.ac.uk/about-us/excellent-arts</a>
</div>
</blockquote>
</div>
<div>
<hr>Through our significant contribution to the creative industries
and the city's cultural and artistic life,<br>
Birmingham City University is proud to support Birmingham's bid to be
UK City of Culture in 2013<br>
<br>
<a class="moz-txt-link-freetext" href="http://birminghamculture.org">http://birminghamculture.org</a><br>
<a class="moz-txt-link-freetext" href="http://www.bcu.ac.uk/about-us/excellent-arts">http://www.bcu.ac.uk/about-us/excellent-arts</a>
</div>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
redland-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:redland-dev@lists.librdf.org">redland-dev@lists.librdf.org</a>
<a class="moz-txt-link-freetext" href="http://lists.librdf.org/mailman/listinfo/redland-dev">http://lists.librdf.org/mailman/listinfo/redland-dev</a></pre>
</blockquote>
</body>
</html>