with rdf triples like this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rdf:RDF [<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
<!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'>]>
<rdf:RDF xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dnr="http://www.dotnetrdf.org/configuration#"
xml:base="http://www.example.org/"
xmlns:nss="http://www.example.org/startTime"
xmlns:nse="http://www.example.org/endTime">
<rdf:Description rdf:about="Fadi">
<ns0:eat xmlns:ns0="http://example.org/">Apple</ns0:eat>
<nss:startTime>00:01:38</nss:startTime>
<nse:endTime>00:01:39</nse:endTime>
</rdf:Description>
<rdf:Description rdf:about="I">
<ns1:love xmlns:ns1="http://example.org/">You</ns1:love>
<nss:startTime>00:05:35</nss:startTime>
<nse:endTime>00:06:39</nse:endTime>
</rdf:Description>
</rdf:RDF>
how can i query about subject or object?
my code:
Graph myGraph = new Graph();
FileLoader.Load(myGraph, "C:\\Users\\hasoOn\\Desktop\\tt.rdf");
TripleStore store = new TripleStore();
store.Add(myGraph);
SparqlParameterizedString queryString = new SparqlParameterizedString();
queryString.CommandText = "PREFIX ex: <http://example.org/> SELECT * WHERE { { ex:fadi ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } } } ";
SparqlQueryParser parser = new SparqlQueryParser();
SparqlQuery query = parser.ParseFromString(queryString.CommandText);
SparqlResultSet results = (SparqlResultSet)store.ExecuteQuery(query);
if (results is SparqlResultSet)
{
SparqlResultSet rset = (SparqlResultSet)results;
foreach (SparqlResult result in rset)
{
Console.WriteLine(result);
}
}
with my code below i get all answers from the query. can anyone help me to get for just subject = fadi?