i need away to write rdf triples with Time attributes and make sparql query to get the time -
i have triples: fadi eat apple. (subject = fadi, predicate = eat, object = apple). , have time when fadi eat apple, its: 00:00:13 , have time when fadi ate apple, its: 00:00:50
how can write rdf-triples file times attributes? , how can starttime , endtime sparql query request rdf file?
i tried write rdf 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:starttime="http://example.org/starttime#" xmlns:endtime="http://example.org/endtime#"> <rdf:description rdf:about="fadi"> <ns:be xmlns:ns="http://example.org/" xmlns:starttime="00:00:13" xmlns:endtime="00:00:16">may</ns:be> </rdf:description> </rdf:rdf>
but c# gaves me: invalid uri: uri scheme not valid.
and tried 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/"> <rdf:description rdf:about="fadi"> <ns:be xmlns:ns="http://example.org/" xml:starttime="00:00:13" xml:endtime="00:00:16">may</ns:be> </rdf:description> </rdf:rdf>
but can't times sparql.
how can write rdf?!!
you shouldn't using xmlns
try , define attributes, xmlns
reserved prefix in xml used defining namespaces.
once have defined own namespace can use attributes e.g.
<?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:ns="http://yourdomain.com/namespace#" xml:base="http://www.example.org/"> <rdf:description rdf:about="fadi" ns:starttime="00:00:13" ns:endtime="00:00:16"> <ns:be>may</ns:be> </rdf:description> </rdf:rdf>
here defined namespace in root element so:
xmlns:ns="http://yourdomain.com/namespace#"
obviously should change namespace uri appropriate you.
then can use newly defined ns
prefix refer terms in namespace e.g.
ns:starttime="00:00:13"
suggestion
however still don't think going give data intending create. suggest stop trying write rdf/xml hand questions imply doing.
instead recommend learning human readable serialization turtle since easier understand. more triple centric rdf/xml understand better rdf triples expressing , make easier understand how write sparql queries return data want.
Comments
Post a Comment