You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by ab...@thomsonreuters.com on 2011/07/07 09:27:51 UTC

Why doesn't FOAFFriends.rdf have a xml:base declaration?

Hi,

 

    I am a beginner for Semantic Web and currently working with JENA. I
came across the attached file FOAFFriends.rdf that could be read into a
Model with the following statement:

 

private void populateFOAFFriends(){

            _friends = ModelFactory.createOntologyModel();

            InputStream inFoafInstance =
FileManager.get().open("Ontologies/FOAFFriends.rdf");

            _friends.read(inFoafInstance,defaultNameSpace);

}

 

Also, here the defaultNameSpace is: 

 

static String defaultNameSpace = 
http://semwebprogramming.org/2009/ont/chp2#

 

I have the following question:

The attached file has declarations such as rdf:ID="me". I believe from
my reading that if there is rdf:ID declaration in a RDF document, then
it should also contain xml:base declaration, but the file is missing
this declaration. So, how is JENA successfully able to read the RDF
file? Where does it get the xml:base declaration from to determine the
complete URI of "me"? Does it do something with the defaultnamespace? 

 

If you say defaultnamespace to be the xml:base, then my question would
be that the xml:base should not contain the # symbol at the end but the
declaration here for defaultnamespace does. How do you justify this
please?

 

A quick reply would be highly appreciated.=

 

Thanks

With Regards,

Abhishek S


This email was sent to you by Thomson Reuters, the global news and information company. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.

Re: Why doesn't FOAFFriends.rdf have a xml:base declaration?

Posted by Andy Seaborne <an...@epimorphics.com>.

On 07/07/11 08:27, abhishek.shivkumar@thomsonreuters.com wrote:
> Hi,
>
> I am a beginner for Semantic Web and currently working with JENA. I came
> across the attached file FOAFFriends.rdf that could be read into a Model
> with the following statement:
>
> *private**void*populateFOAFFriends(){
>
> _friends= ModelFactory./createOntologyModel/();
>
> InputStream inFoafInstance =
> FileManager./get/().open("Ontologies/FOAFFriends.rdf");
>
> _friends.read(inFoafInstance,/defaultNameSpace/);

it's not the default namespace - it's the base URI.  The base comes from

1/ xmlbase declaration (nestable)
2/ The declared one
3/ where it's read from if appropriate and meaningful.

See RFC 3986 section 5.

Any relative URI wil be resolved against the base URI as part of parsing.

>
> }
>
> Also, here the defaultNameSpace is:
>
> *static*String /defaultNameSpace/=
> http://semwebprogramming.org/2009/ont/chp2#
>
> I have the following question:
>
> The attached file has declarations such as rdf:ID=”me”. I believe from
> my reading that if there is rdf:ID declaration in a RDF document, then
> it should also contain xml:base declaration, but the file is missing
> this declaration. So, how is JENA successfully able to read the RDF
> file?

The base URI is provided externally to

  Model 	read(InputStream in, String base)


> Where does it get the xml:base declaration from to determine the
> complete URI of “me”? Does it do something with the defaultnamespace?
>
> If you say defaultnamespace to be the xml:base, then my question would
> be that the xml:base should not contain the # symbol at the end but the
> declaration here for defaultnamespace does. How do you justify this please?

Justify?

It's part of the standard process for URI resolution (RFC 3986).

http://semwebprogramming.org/2009/ont/chp2#

if in HTML you had <a href="foo"> you'd expect

http://semwebprogramming.org/2009/ont/foo
right?

if in HTML you had <a href="#bar"> you'd expect
http://semwebprogramming.org/2009/ont/chp2#bar

It's not a simple concatenate.

rdf:ID="me" => a relative URI of #me because it's defined to be that:

http://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-ID-xml-base

Resolve "#me" with base http://semwebprogramming.org/2009/ont/chp2# and 
you get

http://semwebprogramming.org/2009/ont/chp2#me

(there's no double #).

>
> A quick reply would be highly appreciated.=
>
> Thanks
>
> With Regards,
>
> Abhishek S
>
>
> This email was sent to you by Thomson Reuters, the global news and
> information company. Any views expressed in this message are those of
> the individual sender, except where the sender specifically states them
> to be the views of Thomson Reuters.