I am trying to develop a simple Notation3 ontology file.
so far my code in the notation3 file is
@prefix my: <http://www.codeproject.com/KB/recipes/n3_notation#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
my:batterycs a my:spec;
my:preferedby my:BusinessPerson, my:LoveBird, my:MusicLover, my:Travelar;
my:name "batteryCS".
rdfs:Person a rdfs:Class.
I am using dotNetRdf library to read and query the ontology file. the above code in n3 file works fine. But when I Insert
rdfs:Woman a rdfs:Class; rdfs:subClassOf :Person .
at the end of the ontology file it occurs the error Unable to resolve the QName ':Person'
seems like it cant even load the ontology to the parser.
I studied the n3 syntax from http://www.w3.org/2000/10/swap/Primer.html
can somebody help me with this where I have made the mistake
thanks in advance
Your data is invalid, you need to define the empty prefix in order to be able to refer to it in a QName such as :Person
A QName (Qualified Name) is a syntactic shortcut which allows you to shorten URIs written in the form prefix:name
where prefix
must refer to a defined namespace prefix defined via a previous @prefix
statement. The parser then simply looks up the prefix and concatenates it with the name
part, so for example rdfs:Class
is expanded to http://www.w3.org/2000/01/rdf-schema#Person
in your example data.
If a prefix is not defined then a RDF parser is expected to throw an error.
So you need to fix your data, there are a couple of ways to do this depending on what your intent was.
:Person
in your own my:
namespaceSimply replace :Person
with my:Person
Note that you have also referred to rdfs:Person
so your data looks somewhat inconsistent
Simply add the following @prefix
definition:
@prefix : <http://example.org/namespace#> .
Where the URI is the desired namespace URI
Aside
What version of dotNetRDF are you using? And is the error message you quote the complete error message?
More recent versions of dotNetRDF are supposed to give more informative error messages that should have told you that you were likely missing a prefix declaration