.htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 - 3 - 4 - 5 - 6 | Next >

Parent Message unknown Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Pierre-Antoine Champin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le 03/07/2009 15:14, Danny Ayers a écrit :

> 2009/7/2 Bill Roberts<bill@...>:
>> I thought I'd give the .htaccess approach a try, to see what's involved in
>> actually setting it up.  I'm no expert on Apache, but I know the basics of
>> how it works, I've got full access to a web server and I can read the online
>> Apache documentation as well as the next person.
>
> I've tried similar, even stuff using PURLs - incredibly difficult to
> get right. (My downtime overrides all, so I'm not even sure if I got
> it right in the end)
>
> I really think we need a (copy&  paste) cheat sheet.
>
> Volunteers?
(raising my hand) :)*

Here is a quick python script that makes it easier (if not completely
immediate). It may still requires a one-liner .htaccess, but one that (I
think) is authorized by most webmasters.

I guess a PHP version would not even require that .htaccess, but sorry,
I'm not fluent in PHP ;)

So, assuming you want to publish a vocabulary with an RDF and an HTML
description at http://example.com/mydir/myvoc, you need to:

1. Make `myvoc` a directory at the place where your HTTP server will
    serve it at the desired URI.
2. Copy the script in this directory as 'index.cgi' (or 'index.wsgi' if
    your server as WSGI support).
3. In the same directory, put two files named 'index.html' and
    'index.rdf'

If it does not work now (it didn't for me),you have to tell your HTTP
server that the directory index is index.wsgi. In apache, this is done
by creating (if not present) a `.htaccess` file in the `myvoc`
diractory, and adding the following line::

     DirectoryIndex index.cgi

(or `index.wsgi`, accordingly)

There is more docs in the script itself. I think the more recipes
(including for other httpds) we can provide with the script, the more
useful it will be. So feel free to propose other ones.

  enjoy

   pa

[easypub.py]

#!/usr/bin/env python
#    EasyPub: easy publication of RDF vocabulary
#    Copyright (C) 2009 Pierre-Antoine Champin <pchampin@...>
#
#    EasyPub is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Lesser General Public License as published
#    by the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    KTBS is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Lesser General Public License for more details.
#
#    You should have received a copy of the GNU Lesser General Public License
#    along with KTBS.  If not, see <http://www.gnu.org/licenses/>.
"""
This is a drop-in CGI/WSGI script for publishing RDF vocabulary.

Quick start
===========

Assuming you want to publish the vocabulary http://example.com/mydir/myvoc, the
reciepe with the most chances to work is the following:

1. Make `myvoc` a directory at a place where your HTTP server will serve it at
   the desired URI.
2. Copy the script in this directory as 'index.cgi' (or 'index.wsgi' if your
   server as WSGI support).
3. In the same directory, put two files named 'index.html' and 'index.rdf'

At this point, it may work (if you are lucky), or may have to tell your HTTP
server that the directory index (i.e. the file to serve for the bare directory)
is index.wsgi.

In apache, this is done by creating (if not present) a `.htaccess` file in the
`myvoc` diractory, and adding the following line::
    DirectoryIndex index.cgi
(or `index.wsgi`, accordingly)

Fortunately, this option is allowed to end-users by most webmasters.

More generaly
=============

The script will redirect, according to the Accept HTTP header, to a file with
the same name but a different extension. The file may have no extension at all, so the following layout would work as well::

  mydir/myvoc (the script)
  mydir/myvoc.html
  mydir/myvoc.rdf

However, the tricky part is to convince the HTTP server to consider `myvoc` (an
extension-less file) as a CGI script (a thing in which I didn't succeed for the
moment...). The interesting feature of such a config is that it would support
"slash-based" vocabulary. For example, http://example.com/mydir/myvoc/MyTerm
would still redirect to the html or rdf file. This would not work with the reciep. This would not work with the `index.cgi` recipe.

The script is can be configured to serve different files or support other mime
types by altering the `MAPPING` constant below.
"""

# the list below maps mime-types to redirection URL; %s is to be replaced by
# the script name (without its extension); note that the order may be
# significant (when matching */*)
MAPPING = [
    ("text/html", "%s.html"),
    ("application/rdf+xml", "%s.rdf"),
    ## uncomment the following if applicable
    #("application/turtle", "%s.ttl"),
    #("text/n3", "%s.n3"),
]

HTML_REDIRECT = """<html>
<head><title>Non-Information Resource</title></head>
<body>
<h1>Non-Information Resource</h1>
You should be redirected to <a href="%s">%s</a>.
</body>
</html>"""

HTML_NOT_ACCEPTABLE = """<html>
<head><title>No acceptable representation</title></head>
<body>
<h1>No acceptable representation</h1>
This server has no representation of the required resource that is acceptable
by your web agent. Available representations are:<ul>
%s
</ul>
</body>
</html>"""

HTML_REPRESENTATION = \
    """<li><a href="%(location)s">%(location)s</a> (%(mimetype)s)</li>\n"""

def application(env, start_response):
    """
    Find the most appropriate redirection, and issues an HTTP response
    accordingly.
    """
    redirection = find_redirection(env.get("HTTP_ACCEPT"))
    if redirection is None:
        # TODO should check that HTML is acceptable...
        representations = ""
        for mimetype, location in MAPPING:
            representations += HTML_REPRESENTATION % locals()
        msg = HTML_NOT_ACCEPTABLE % representations
        start_response("406 No Acceptable Representation", [
            ("content-type", "text/html;encoding=ascii"),
            ("content-size", str(len(msg))),
        ])
        yield msg
    else:
        script_name = env["SCRIPT_NAME"]
        if "." in script_name:
            script_name, _ = script_name.rsplit(".",1)
        if "%s" in redirection:
            redirection %= script_name
        msg = HTML_REDIRECT % (redirection, redirection)
        start_response("303 Non-Information Resource", [
            ("content-type", "text/html;encoding=ascii"),
            ("content-size", str(len(msg))),
            ("location", redirection),
        ])
        yield msg

def find_redirection(http_accept):
    """
    Compare the HTTP Accept header field with the available mapping.
    """
    if http_accept is None:
        http_accept = "*/*"
    accept_list = sort_accept(http_accept)
    for accepted in accept_list:
        # FIXME: we currently ignore mimetype parameters for matching:
        accepted = accepted[0]
        for mimetype, redirection in MAPPING:
            if mime_match(accepted, mimetype):
                return redirection
    return None # failed


def sort_accept(accept_str):
    """
    Transform a string complying with the HTTP Accept syntax into a sorted
    list of mimetype (possibly with parameters).
    """
    # build list of accepted mimetype
    lst1 = split_n_strip(accept_str, ",")
    # split params in each accepted mimetype
    lst2 = [ split_n_strip(item, ";") for item in lst1 ]
    # split each param as [name, value]
    lst3 = [ [item[0]] + [ split_n_strip(param, "=") for param in item[1:] ]
             for item in lst2 ]
    # insert priority marker in each accepted mimetype
    lst_prio = [ compile_priority(item) for item in lst3 ]
    lst_prio.sort(reverse=True)
    # strip priority tuples before returning
    ret = [ item[1:] for item in lst_prio ]
    return ret

def split_n_strip(astr, sep):
    """
    Split astr according to sep, and strip each element.
    """
    return [ item.strip() for item in astr.split(sep) ]

def compile_priority(lst):
    """
    Takes a list of the form [ mimetype, parameters* ] and return a copy
    with a tuple (q, p) inserted at the start where q is the value of the 'q'
    parameter, and 'p' represents the "specificity" of the mime type.

    The goal is that those tuples allow to sort different lst with the standard
    sort function (decreasing ordet for decreasing priority).

    Note also that this function removes from the return value the 'q'
    parameter if present.
    """
    ret = list(lst)
    last = ret[-1]
    if len(ret) > 1 and last[0] == "q":
        del ret[-1]
        q = float(last[1])
    else:
        q = 1.0
    mime = ret[0]
    if mime == "*/*":
        p = 1
    elif mime.endswith("/*"):
        p = 2
    elif len(ret) == 1:
        p = 3
    else:
        p = 4
    ret.insert(0, (q, p))
    return ret

def mime_match(m1, m2):
    """
    Return True if mimetype m1 matches mimetype m2, where m1 can contain
    wildcards.
    """
    if m1 == m2:
        return True
    elif m1 == "*/*":
        return True
    elif m1[-2:] == "/*":
        return m2.startswith(m1[:-1])
    return False

if __name__ == "__main__":
    from wsgiref.handlers import CGIHandler
    h = CGIHandler()
    h.run(application)


Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Toby Inkster-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 5 Jul 2009, at 01:52, Pierre-Antoine Champin wrote:

> I guess a PHP version would not even require that .htaccess, but  
> sorry, I'm not fluent in PHP ;)


The situation with PHP should be much the same, though I suppose web  
hosts might be more likely to set index.php in the DirectoryIndex as  
a default.

Anyway, I've done a quick port of your code to PHP. (I stripped out  
your connection negotiation code and replaced it with my own, as I  
figured out it would be faster to paste in the ConNeg class I'm  
familiar with rather than do line-by-line porting of the Python to  
PHP.) Here it is, same license - LGPL 3.

We should start a repository somewhere of useful code for serving  
linked data.

--
Toby A Inkster
<mailto:mail@...>
<http://tobyinkster.co.uk>


[easypub.php]

<?php

#    EasyPub: easy publication of RDF vocabulary
#    Copyright (C) 2009 Toby Inkster <mail@...>
#    Authors: Pierre-Antoine Champin <pchampin@...>
#             Toby Inkster <mail@...>
#
#    EasyPub is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Lesser General Public License as published
#    by the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    EasyPub is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Lesser General Public License for more details.
#
#    You should have received a copy of the GNU Lesser General Public License
#    along with EasyPub.  If not, see <http://www.gnu.org/licenses/>.

/*
This is a drop-in PHP script for publishing RDF vocabulary.

Quick start
===========

Assuming you want to publish the vocabulary http://example.com/mydir/myvoc, the
reciepe with the most chances to work is the following:

1. Make `myvoc` a directory at a place where your HTTP server will serve it at
   the desired URI.
2. Copy the script in this directory as 'index.php'.
3. In the same directory, put two files named 'index.html' and 'index.rdf'

At this point, it may work (if you are lucky), or may have to tell your HTTP
server that the directory index (i.e. the file to serve for the bare directory)
is index.php.

In apache, this is done by creating (if not present) a `.htaccess` file in the
`myvoc` diractory, and adding the following line::
    DirectoryIndex index.php

Fortunately, this option is allowed to end-users by most webmasters.

More generaly
=============

The script will redirect, according to the Accept HTTP header, to a file with
the same name but a different extension. The file may have no extension at all,
so the following layout would work as well::

  mydir/myvoc (the script)
  mydir/myvoc.html
  mydir/myvoc.rdf

However, the tricky part is to convince the HTTP server to consider `myvoc` (an
extension-less file) as a PHP script (a thing in which I didn't succeed for the
moment...). The interesting feature of such a config is that it would support
"slash-based" vocabulary. For example, http://example.com/mydir/myvoc/MyTerm
would still redirect to the html or rdf file. This would not work with the reciep.
This would not work with the `index.php` recipe.

The script is can be configured to serve different files or support other mime
types by altering the `MAPPING` constant below.
*/

# the list below maps mime-types to redirection URL; %s is to be replaced by
# the script name (without its extension); note that the order may be
# significant (when matching */*)
$MAPPING = array(
        "text/html" => "%s.html",
        "application/rdf+xml" => "%s.rdf",
        ## uncomment the following if applicable
        # "application/xhtml+xml" => "%s.html",
        # "application/turtle" => "%s.ttl",
        # "text/n3" => "%s.n3",
);

$HTML_REDIRECT = <<<CHUNK
<html>
<head><title>Non-Information Resource</title></head>
<body>
<h1>Non-Information Resource</h1>
You should be redirected to <a href="%1\$s">%1\$s</a>.
</body>
</html>
CHUNK
;

$HTML_NOT_ACCEPTABLE = <<<CHUNK
<html>
<head><title>No acceptable representation</title></head>
<body>
<h1>No acceptable representation</h1>
This server has no representation of the required resource that is acceptable
by your web agent. Available representations are:<ul>
%s
</ul>
</body>
</html>
CHUNK
;

$HTML_REPRESENTATION = '<li><a href="%1$s">%1$s</a> (%2$s)</li>'."\n";

main($MAPPING, $HTML_REDIRECT, $HTML_NOT_ACCEPTABLE, $HTML_REPRESENTATION);

function main ($map, $h_redir, $h_unaccept, $h_rep)
{
        # Convert list of available MIME types into a string suitable for ConNeg class.
        $offers = array();
        foreach ($map as $mime => $file)
                $offers[] = $mime;
        $offers = implode(',' , $offers);
       
        $chosen = ConNeg::negotiate($offers);
       
        if (empty($chosen) || empty($map[$chosen]))
        {
                $representations = '';
                foreach ($map as $mime => $file)
                        $representations .= sprintf($h_rep, $file, $mime);
                $msg = sprintf($h_unaccept, $representations);
                header("HTTP/1.1 406 Not Acceptable");
                header("Content-Type: text/html; charset=us-ascii");
                header("Content-Length: " . strlen($msg));
                print $msg;
                exit;
        }
       
        else
        {
                $filename = sprintf($map[$chosen], basename($_SERVER['SCRIPT_NAME'], '.php'));

                $goto = sprintf('%s://%s%s/%s',
                        (empty($_SERVER['HTTPS']) ? 'http' : 'https'),          # protocol
                        $_SERVER['SERVER_NAME']                                 # authority
                                .($_SERVER['SERVER_PORT']==80?'':(':'.($_SERVER['SERVER_PORT']))),
                        dirname($_SERVER['SCRIPT_NAME']),                       # directory
                        $filename                                               # file
                        );
                $msg = sprintf($h_redir, $goto);
                header("HTTP/1.1 303 See Other");
                header("Location: $goto");
                header("Content-Type: text/html; charset=us-ascii");
                header("Content-Length: " . strlen($msg));
                print $msg;
                exit;
        }
}

class ConNeg
{
        public static function negotiate ($offers, $accept=null, $death=false)
        {
                if (!isset($accept))
                {
                        $accept = $_SERVER['HTTP_ACCEPT'];
                        header('Vary: Accept');
                }
               
                $a_parsed = self::parse_accept($accept);
                $o_parsed = self::parse_accept($offers);
               
                $best = self::choose_offer($o_parsed, $a_parsed);
               
                if (!isset($best))
                {
                        if (!$death)
                                return self::offer_serialise($o_parsed[0]);
                       
                        header('HTTP/1.1 406 Not Acceptable');
                        header('Content-Type: text/plain; charset=utf-8');
                        print "Acceptable types would have been:\n\n";
                        foreach ($o_parsed as $o)
                                print self::offer_serialise($o) . "\n";
                        exit;
                }
               
                return self::offer_serialise($best);
        }

        # logically a constant, but a function is easier to comment.
        public static function STANDARD_OFFERS()
        {
                return 'application/xhtml+xml; charset=utf-8; x-serialisation=html, ' # XHTML+RDFa
                        .'text/html; charset=utf-8; q=0.9; x-serialisation=html, ' #     Equivalent to above (for now)
                        .'application/rdf+xml; x-serialisation=xml, ' # RDF/XML
                        .'text/rdf; charset=utf-8; x-serialisation=xml, ' #     Alias for above
                        .'application/xml; q=0.9; x-serialisation=xml, ' #     Equivalent to above (for now)
                        .'text/xml; charset=utf-8; q=0.9; x-serialisation=xml, ' #     Equivalent to above (for now)
                        .'application/rss+xml; x-serialisation=rss, ' # RSS 1.0 compatible RDF/XML
                        .'application/turtle; x-serialisation=turtle, ' # Turtle
                        .'application/x-turtle; x-serialisation=turtle, ' #     Alias for above
                        .'text/turtle; charset=utf-8; x-serialisation=turtle, ' #     Alias for above
                        .'text/n3; charset=utf-8; q=0.9; x-serialisation=turtle, ' #     Equivalent to above (for now)
                        .'text/rdf+n3; charset=utf-8; q=0.9; x-serialisation=turtle, ' #         Alias for above
                        .'application/json; x-serialisation=json, ' # JSON
                        .'application/x-json; x-serialisation=json, ' #     Alias for above
                        .'application/ecmascript; x-serialisation=js, ' # Javascript
                        .'application/javascript; x-serialisation=js, ' #     Alias for above
                        .'text/ecmascript; charset=utf-8; x-serialisation=js, ' #     Alias for above
                        .'text/javascript; charset=utf-8; x-serialisation=js, ' #     Alias for above
                        .'text/plain; charset=utf-8; x-serialisation=ntriples, ' # N-Triples
                        .'application/turtle; level=nt; x-serialisation=ntriples, ' #     Alias for above
                        .'application/x-turtle; level=nt; x-serialisation=ntriples, ' #     Alias for above
                        .'text/turtle; charset=utf-8; level=nt; x-serialisation=ntriples' #     Alias for above
                        ;
        }
       
        public static function serialisation ($fmt)
        {
                if (preg_match('/x-serialisation=([a-z]+)/i', $fmt, $matches))
                {
                        return $matches[1];
                }

                return 'xml';
        }

        private static function offer_serialise ($o)
        {
                $rv = array($o['_type']);
                foreach ($o as $k => $v)
                {
                        if ($k!='_type' && $k!='_position' && $k!='q')
                                $rv[] = sprintf("%s=%s", $k, $v);
                }
                return implode('; ', $rv);
        }

        private static function parse_accept ($header)
        {
                $rv = array();
                $bits = preg_split('/\s*,\s*/', $header);
                for ($i=0; isset($bits[$i]); $i++)
                {
                        $bit = trim($bits[$i]);
                       
                        $pieces = preg_split('/\s*;\s*/', $bit);
                        $type   = strtolower(trim(array_shift($pieces)));
                        $entry  = array('_position' => $i+1);
                       
                        foreach ($pieces as $piece)
                        {
                                list ($key, $val) = preg_split('/\s*\=\s*/', trim($piece));
                                if (!isset($entry[ strtolower(trim($key)) ]))
                                        $entry[ strtolower(trim($key)) ] = trim($val);
                        }
                       
                        if (!isset($entry['q']) || $entry['q'] > 1.0)
                                $entry['q'] = 1.0;
                       
                        $entry['_type'] = $type;
                        $rv[] = $entry;
                }
               
                return $rv;
        }

        private static function choose_offer ($offers, $requests)
        {
                $offer_scores = array();
               
                foreach ($offers as $offer)
                {
                        foreach ($requests as $request)
                        {
                                if (self::match_offer($offer, $request))
                                {
                                        $score = $offer;
                                        $score['q'] *= $request['q'];
                                        $score['_position'] *= $request['_position'];
                                       
                                        $offer_scores[] = $score;
                                }
                        }
                }
               
                usort($offer_scores, array(__CLASS__, 'score_sort'));
               
                return $offer_scores[0];
        }

        private static function score_sort ($a, $b)
        {
                if ((float)$a['q'] < (float)$b['q'])
                        return 1;
                if ((float)$a['q'] > (float)$b['q'])
                        return -1;
                       
                if ($a['_position'] < $b['_position'])
                        return -1;
                if ($a['_position'] > $b['_position'])
                        return 1;
               
                return 0;
        }

        private static function match_offer ($o, $r)
        {
                # Content-Type - look for a mismatch
                list ($omaj, $omin) = explode('/', $o['_type']);
                list ($rmaj, $rmin) = explode('/', $r['_type']);
                if (!($omaj==$rmaj || $omaj=='*' || $rmaj=='*'))
                        return false;
                if (!($omin==$rmin || $omin=='*' || $rmin=='*'))
                        return false;
               
                # Content-Type Parameters - look for a mismatch
                foreach ($r as $rparam=>$rvalue)
                {
                        if ($rparam != 'q' && $rparam != '_type' && $rparam != '_position')
                        {
                                if ($o[$rparam] != $rvalue)
                                        return false;
                                print "OK\n";
                        }
                }
               
                # No mismatches.
                return true;
        }
}







Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Pierre-Antoine Champin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le 05/07/2009 13:54, Toby A Inkster a écrit :
> On 5 Jul 2009, at 01:52, Pierre-Antoine Champin wrote:
>
>> I guess a PHP version would not even require that .htaccess, but
>> sorry, I'm not fluent in PHP ;)
>
>
> The situation with PHP should be much the same, though I suppose web
> hosts might be more likely to set index.php in the DirectoryIndex as a
> default.

this was my intuition as well.
However, I actually have to add the DirectoryIndex directive to have
index.php taken into account on my server.

PHP has another advantage over CGI (and WSGI): you can usually run a PHP
script from any directory of your hosted space, while CGI are usually
confined in a special directory.

> Anyway, I've done a quick port of your code to PHP. (I stripped out your
> connection negotiation code and replaced it with my own, as I figured
> out it would be faster to paste in the ConNeg class I'm familiar with
> rather than do line-by-line porting of the Python to PHP.) Here it is,
> same license - LGPL 3.

great :)

> We should start a repository somewhere of useful code for serving linked
> data.

I agree.

I note that your implementation uses absolute URIs for redirection. This
has two main advantages over mine:
- this complies with the RFC (I had missed that part ;)
- this still works when you append path elements after the script name
   (which messes the relative URI in my script)

   pa


Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Juan Sequeda :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


We should start a repository somewhere of useful code for serving linked
data.

I agree.

(I raise my hand)

If I am not wrong, this thread has given out 4 different implementations for serving linked data. I mentioned before that I wanted to post this on linkeddata.org

I will work out the logistics with Tom Heath, so we can put upload the code examples hopefully this week!



Juan Sequeda

Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Pierre-Antoine Champin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Note that I managed to have extension-less script run.

Recipe 2
--------

(advantage over the 'index.php' recipe: works with slash based
namespaces; disadvantage: 2 more lines in the .htaccess ;)

what you need is the following directive in .htaccess
(which is allowed by my webmaster)

   <Files myvoc>
     SetHandler application/x-httpd-php
   </Files>

(where myvoc is the name of your PHP file)

For CGI (resp. WSGI) scripts, replace "application/x-httpd-php" by
"cgi-script" (resp. "wsgi-script").

so with the following layout

   .../mydir/.htaccess
   .../mydir/myvoc (Toby's php script)
   .../mydir/myvoc.html
   .../mydir/myvoc.rdf

you would have the URI http://example.com/mydir/myvoc correctly
redirecting to the appropriate representation.

Of course, you can have several vocabularies living in the same
directory, all you need to do is add several <Files> directives to the
.htaccess.

   pa

PS: any IIS user volunteering to translate those recipies to IIS
configuration?

Le 05/07/2009 13:54, Toby A Inkster a écrit :

> On 5 Jul 2009, at 01:52, Pierre-Antoine Champin wrote:
>
>> I guess a PHP version would not even require that .htaccess, but
>> sorry, I'm not fluent in PHP ;)
>
>
> The situation with PHP should be much the same, though I suppose web
> hosts might be more likely to set index.php in the DirectoryIndex as a
> default.
>
> Anyway, I've done a quick port of your code to PHP. (I stripped out your
> connection negotiation code and replaced it with my own, as I figured
> out it would be faster to paste in the ConNeg class I'm familiar with
> rather than do line-by-line porting of the Python to PHP.) Here it is,
> same license - LGPL 3.
>
> We should start a repository somewhere of useful code for serving linked
> data.
>
>
>
>
>



Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Hugh Glaser :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

OK, I'll have a go :-)
Why did I think this would be fun to do on a sunny Sunday morning that has turned into afternoon?
Here are the instructions:


 1.  Create a web-accessible directory, let's say foobar, with all your .rdf, .ttl, .ntriples and .html files in it.
 2.  Copy lodpub.php and path.php into it.
 3.  Access path.php from your web server.
 4.  Follow the instruction to paste that text into .htaccess
 5.  You can remove path.php if you like, it was only there to help you get the .htaccess right.

That should be it.
The above text and files are at
http://www.rkbexplorer.com/blog/?p=11

Of course, I expect that you can tell me all sorts of problems/better ways, but I am hoping it works for many.

Some explanation:
We use a different method, and I have tried to extract the essence, and keep the code very simple.
We trap all 404 (File not Found) in the directory, and then any requests coming in for non-existent files will generate a 303 with an extension added, depending on the Accept header.
Note that you probably need the leading "/" followed by the full path from the domain root, otherwise it will just print out the text "lodpub.php";
(That is not what the apache specs seem to say, but it is what seems to happen).
If you get "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.", then it means that web server is not finding your ErrorDocument .
Put the file path.php in the same directory and point your browser at it - this will tell you what the path should be.

Note that the httpd.conf (in /etc/httpd/conf) may not let your override, if your admins have tied things down really tight.
Mine says:
    AllowOverride All

Finally, at the moment, note that I think that apache default does not put the correct MIME type on rdf files, but that is a separate issue, and it makes no difference that the 303 happened.

Best
Hugh

On 05/07/2009 01:52, "Pierre-Antoine Champin" <swlists-040405@...> wrote:

> Le 03/07/2009 15:14, Danny Ayers a écrit :
>> 2009/7/2 Bill Roberts<bill@...>:
>>> I thought I'd give the .htaccess approach a try, to see what's involved in
>>> actually setting it up.  I'm no expert on Apache, but I know the basics of
>>> how it works, I've got full access to a web server and I can read the online
>>> Apache documentation as well as the next person.
>>
>> I've tried similar, even stuff using PURLs - incredibly difficult to
>> get right. (My downtime overrides all, so I'm not even sure if I got
>> it right in the end)
>>
>> I really think we need a (copy&  paste) cheat sheet.
>>
>> Volunteers?
>
> (raising my hand) :)*
>
> Here is a quick python script that makes it easier (if not completely
> immediate). It may still requires a one-liner .htaccess, but one that (I
> think) is authorized by most webmasters.
>
> I guess a PHP version would not even require that .htaccess, but sorry,
> I'm not fluent in PHP ;)
>
> So, assuming you want to publish a vocabulary with an RDF and an HTML
> description at http://example.com/mydir/myvoc, you need to:
>
> 1. Make `myvoc` a directory at the place where your HTTP server will
>     serve it at the desired URI.
> 2. Copy the script in this directory as 'index.cgi' (or 'index.wsgi' if
>     your server as WSGI support).
> 3. In the same directory, put two files named 'index.html' and
>     'index.rdf'
>
> If it does not work now (it didn't for me),you have to tell your HTTP
> server that the directory index is index.wsgi. In apache, this is done
> by creating (if not present) a `.htaccess` file in the `myvoc`
> diractory, and adding the following line::
>
>      DirectoryIndex index.cgi
>
> (or `index.wsgi`, accordingly)
>
> There is more docs in the script itself. I think the more recipes
> (including for other httpds) we can provide with the script, the more
> useful it will be. So feel free to propose other ones.
>
>   enjoy
>
>    pa
>



path.php (240 bytes) Download Attachment
lodpub.php (4K) Download Attachment

Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Juan Sequeda :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yay!! more "easy-lod" goodness! more incentive to get this up on linkeddata.org this week!

do we have any volunteers for ruby?

Juan Sequeda, Ph.D Student
Dept. of Computer Sciences
The University of Texas at Austin
www.juansequeda.com
www.semanticwebaustin.org


On Sun, Jul 5, 2009 at 5:16 PM, Hugh Glaser <hg@...> wrote:
OK, I'll have a go :-)
Why did I think this would be fun to do on a sunny Sunday morning that has turned into afternoon?
Here are the instructions:


 1.  Create a web-accessible directory, let's say foobar, with all your .rdf, .ttl, .ntriples and .html files in it.
 2.  Copy lodpub.php and path.php into it.
 3.  Access path.php from your web server.
 4.  Follow the instruction to paste that text into .htaccess
 5.  You can remove path.php if you like, it was only there to help you get the .htaccess right.

That should be it.
The above text and files are at
http://www.rkbexplorer.com/blog/?p=11

Of course, I expect that you can tell me all sorts of problems/better ways, but I am hoping it works for many.

Some explanation:
We use a different method, and I have tried to extract the essence, and keep the code very simple.
We trap all 404 (File not Found) in the directory, and then any requests coming in for non-existent files will generate a 303 with an extension added, depending on the Accept header.
Note that you probably need the leading "/" followed by the full path from the domain root, otherwise it will just print out the text "lodpub.php";
(That is not what the apache specs seem to say, but it is what seems to happen).
If you get "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.", then it means that web server is not finding your ErrorDocument .
Put the file path.php in the same directory and point your browser at it - this will tell you what the path should be.

Note that the httpd.conf (in /etc/httpd/conf) may not let your override, if your admins have tied things down really tight.
Mine says:
   AllowOverride All

Finally, at the moment, note that I think that apache default does not put the correct MIME type on rdf files, but that is a separate issue, and it makes no difference that the 303 happened.

Best
Hugh

On 05/07/2009 01:52, "Pierre-Antoine Champin" <swlists-040405@...> wrote:

> Le 03/07/2009 15:14, Danny Ayers a écrit :
>> 2009/7/2 Bill Roberts<bill@...>:
>>> I thought I'd give the .htaccess approach a try, to see what's involved in
>>> actually setting it up.  I'm no expert on Apache, but I know the basics of
>>> how it works, I've got full access to a web server and I can read the online
>>> Apache documentation as well as the next person.
>>
>> I've tried similar, even stuff using PURLs - incredibly difficult to
>> get right. (My downtime overrides all, so I'm not even sure if I got
>> it right in the end)
>>
>> I really think we need a (copy&  paste) cheat sheet.
>>
>> Volunteers?
>
> (raising my hand) :)*
>
> Here is a quick python script that makes it easier (if not completely
> immediate). It may still requires a one-liner .htaccess, but one that (I
> think) is authorized by most webmasters.
>
> I guess a PHP version would not even require that .htaccess, but sorry,
> I'm not fluent in PHP ;)
>
> So, assuming you want to publish a vocabulary with an RDF and an HTML
> description at http://example.com/mydir/myvoc, you need to:
>
> 1. Make `myvoc` a directory at the place where your HTTP server will
>     serve it at the desired URI.
> 2. Copy the script in this directory as 'index.cgi' (or 'index.wsgi' if
>     your server as WSGI support).
> 3. In the same directory, put two files named 'index.html' and
>     'index.rdf'
>
> If it does not work now (it didn't for me),you have to tell your HTTP
> server that the directory index is index.wsgi. In apache, this is done
> by creating (if not present) a `.htaccess` file in the `myvoc`
> diractory, and adding the following line::
>
>      DirectoryIndex index.cgi
>
> (or `index.wsgi`, accordingly)
>
> There is more docs in the script itself. I think the more recipes
> (including for other httpds) we can provide with the script, the more
> useful it will be. So feel free to propose other ones.
>
>   enjoy
>
>    pa
>


Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by kidehen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Toby A Inkster wrote:

> On 5 Jul 2009, at 01:52, Pierre-Antoine Champin wrote:
>
>> I guess a PHP version would not even require that .htaccess, but
>> sorry, I'm not fluent in PHP ;)
>
>
> The situation with PHP should be much the same, though I suppose web
> hosts might be more likely to set index.php in the DirectoryIndex as a
> default.
>
> Anyway, I've done a quick port of your code to PHP. (I stripped out
> your connection negotiation code and replaced it with my own, as I
> figured out it would be faster to paste in the ConNeg class I'm
> familiar with rather than do line-by-line porting of the Python to
> PHP.) Here it is, same license - LGPL 3.
>
> We should start a repository somewhere of useful code for serving
> linked data.
Toby,

Sure!

First step should be to use "del.icio.us" (or similar services) to
bookmark you page using tag: linked_data_deployment or lod_deployment or
something along those lines. Once in place there is  beached for
RDFization into other Linked Data Spaces that ultimately will be
discoverable via the burgeoning "Web of Linked Data".

Basically, just as Kurt's done with his music data space related effort,
we do the same re. Linked Data deployment.

Also, we can then have Tom link to the del.ico.us bookmark from
<http://linkeddata.org> .

Kingsley

>
> ------------------------------------------------------------------------
>
>
>
>
>
>
>
>
>
>  


--


Regards,

Kingsley Idehen      Weblog: http://www.openlinksw.com/blog/~kidehen
President & CEO
OpenLink Software     Web: http://www.openlinksw.com






Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Richard Light :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In message <4A50AD9F.9030904@...>, Pierre-Antoine Champin
<swlists-040405@...> writes
>
>PS: any IIS user volunteering to translate those recipies to IIS
>configuration?

I have implemented the 303 redirection strategy in IIS, but using a
custom 404 "page not found" error handler.  Is that relevant to this
discussion?

Richard
--
Richard Light


Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by kidehen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Richard Light wrote:

> In message <4A50AD9F.9030904@...>, Pierre-Antoine Champin
> <swlists-040405@...> writes
>>
>> PS: any IIS user volunteering to translate those recipies to IIS
>> configuration?
>
> I have implemented the 303 redirection strategy in IIS, but using a
> custom 404 "page not found" error handler.  Is that relevant to this
> discussion?
>
> Richard
Absolutely!

Again, Linked Data isn't about Apache or any other product, programming
language, operating system etc., its about the Web :-)


--


Regards,

Kingsley Idehen      Weblog: http://www.openlinksw.com/blog/~kidehen
President & CEO
OpenLink Software     Web: http://www.openlinksw.com






Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Martin Hepp (UniBW) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Google has just changed the wording of the documentation:

http://knol.google.com/k/google-rich-snippets/google-rich-snippets/32la2chf8l79m/1#

The mentioning of cloaking risk is removed. While this is not final
clearance,
it is a nice sign that our concerns are heard.

Best
Martin


Martin Hepp (UniBW) wrote:

> Dear all:
> Fyi - I am in contact with Google as for the clarification of what
> kind of empty div/span elements are considered acceptable in the
> context of RDFa. It may take a few days to get an official statement.
> Just so that you know it is being taken care of...
>
> Martin
>
>
>
> Mark Birbeck wrote:
>> Hi Martin,
>>
>>  
>>> b) download RDFa snippet that just represents the RDF/XML content
>>> (i.e. such
>>> that it does not have to be consolidated with the "presentation
>>> level" part
>>> of the Web page.
>>>    
>>
>> By coincidence, I just read this:
>>
>>   Hidden div's -- don't do it!
>>   It can be tempting to add all the content relevant for a rich snippet
>>   in one place on the page, mark it up, and then hide the entire block
>>   of text using CSS or other techniques. Don't do this! Mark up the
>>   content where it already exists. Google will not show content from
>>   hidden div's in Rich Snippets, and worse, this can be considered
>>   cloaking by Google's spam detection systems. [1]
>>
>> Regards,
>>
>> Mark
>>
>> [1]
>> <http://knol.google.com/k/google-rich-snippets/google-rich-snippets/32la2chf8l79m/1#>
>>
>>
>>  
>
--
--------------------------------------------------------------
martin hepp
e-business & web science research group
universitaet der bundeswehr muenchen

e-mail:  mhepp@...
phone:   +49-(0)89-6004-4217
fax:     +49-(0)89-6004-4620
www:     http://www.unibw.de/ebusiness/ (group)
         http://www.heppnetz.de/ (personal)
skype:   mfhepp
twitter: mfhepp

Check out the GoodRelations vocabulary for E-Commerce on the Web of Data!
========================================================================

Webcast:
http://www.heppnetz.de/projects/goodrelations/webcast/

Talk at the Semantic Technology Conference 2009:
"Semantic Web-based E-Commerce: The GoodRelations Ontology"
http://tinyurl.com/semtech-hepp

Tool for registering your business:
http://www.ebusiness-unibw.org/tools/goodrelations-annotator/

Overview article on Semantic Universe:
http://tinyurl.com/goodrelations-universe

Project page and resources for developers:
http://purl.org/goodrelations/

Tutorial materials:
Tutorial at ESWC 2009: The Web of Data for E-Commerce in One Day: A Hands-on Introduction to the GoodRelations Ontology, RDFa, and Yahoo! SearchMonkey

http://www.ebusiness-unibw.org/wiki/GoodRelations_Tutorial_ESWC2009





[martin_hepp.vcf]

begin:vcard
fn:Martin Hepp
n:Hepp;Martin
org:Bundeswehr University Munich;E-Business and Web Science Research Group
adr:;;Werner-Heisenberg-Web 39;Neubiberg;;D-85577;Germany
email;internet:mhepp@...
tel;work:+49 89 6004 4217
tel;pager:skype: mfhepp
url:http://www.heppnetz.de
version:2.1
end:vcard



Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Pat Hayes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 5, 2009, at 10:16 AM, Hugh Glaser wrote:

> OK, I'll have a go :-)
> Why did I think this would be fun to do on a sunny Sunday morning  
> that has turned into afternoon?
> Here are the instructions:
>

And here is why I cannot follow them.

>
> 1.  Create a web-accessible directory, let's say foobar, with all  
> your .rdf, .ttl, .ntriples and .html files in it.
> 2.  Copy lodpub.php and path.php into it.

OK so far...

> 3.  Access path.php from your web server.

I can see this file, but I cannot access it. Attempting to do so gives  
me the message

Can not open file .htaccess
Reason: Could not download file (403:HTTP/1.1
403 forbidden)

I have checked with my system admin, and they tell me, Yes that is  
correct. You cannot access your .htaccess file. You cannot modify it  
or paste anything into it. Only we have access to it. No, we will not  
change this policy for you, no matter how important you think you are.  
Although they do not say it openly, the implicit message is, we don't  
give a damn what the W3C thinks you ought to be able to do on our  
website.

Now, has anyone got any OTHER ideas?  An idea that does not involve  
changing any actual code, and so can be done using a text editor on an  
HTML text file, would be a very good option.

Pat Hayes


> 4.  Follow the instruction to paste that text into .htaccess
> 5.  You can remove path.php if you like, it was only there to help  
> you get the .htaccess right.
>
> That should be it.
> The above text and files are at
> http://www.rkbexplorer.com/blog/?p=11
>
> Of course, I expect that you can tell me all sorts of problems/
> better ways, but I am hoping it works for many.
>
> Some explanation:
> We use a different method, and I have tried to extract the essence,  
> and keep the code very simple.
> We trap all 404 (File not Found) in the directory, and then any  
> requests coming in for non-existent files will generate a 303 with  
> an extension added, depending on the Accept header.
> Note that you probably need the leading "/" followed by the full  
> path from the domain root, otherwise it will just print out the text  
> "lodpub.php";
> (That is not what the apache specs seem to say, but it is what seems  
> to happen).
> If you get "Additionally, a 404 Not Found error was encountered  
> while trying to use an ErrorDocument to handle the request.", then  
> it means that web server is not finding your ErrorDocument .
> Put the file path.php in the same directory and point your browser  
> at it - this will tell you what the path should be.
>
> Note that the httpd.conf (in /etc/httpd/conf) may not let your  
> override, if your admins have tied things down really tight.
> Mine says:
>    AllowOverride All
>
> Finally, at the moment, note that I think that apache default does  
> not put the correct MIME type on rdf files, but that is a separate  
> issue, and it makes no difference that the 303 happened.
>
> Best
> Hugh
>
> On 05/07/2009 01:52, "Pierre-Antoine Champin" <swlists-040405@...
> > wrote:
>
>> Le 03/07/2009 15:14, Danny Ayers a écrit :
>>> 2009/7/2 Bill Roberts<bill@...>:
>>>> I thought I'd give the .htaccess approach a try, to see what's  
>>>> involved in
>>>> actually setting it up.  I'm no expert on Apache, but I know the  
>>>> basics of
>>>> how it works, I've got full access to a web server and I can read  
>>>> the online
>>>> Apache documentation as well as the next person.
>>>
>>> I've tried similar, even stuff using PURLs - incredibly difficult to
>>> get right. (My downtime overrides all, so I'm not even sure if I got
>>> it right in the end)
>>>
>>> I really think we need a (copy&  paste) cheat sheet.
>>>
>>> Volunteers?
>>
>> (raising my hand) :)*
>>
>> Here is a quick python script that makes it easier (if not completely
>> immediate). It may still requires a one-liner .htaccess, but one  
>> that (I
>> think) is authorized by most webmasters.
>>
>> I guess a PHP version would not even require that .htaccess, but  
>> sorry,
>> I'm not fluent in PHP ;)
>>
>> So, assuming you want to publish a vocabulary with an RDF and an HTML
>> description at http://example.com/mydir/myvoc, you need to:
>>
>> 1. Make `myvoc` a directory at the place where your HTTP server will
>>    serve it at the desired URI.
>> 2. Copy the script in this directory as 'index.cgi' (or  
>> 'index.wsgi' if
>>    your server as WSGI support).
>> 3. In the same directory, put two files named 'index.html' and
>>    'index.rdf'
>>
>> If it does not work now (it didn't for me),you have to tell your HTTP
>> server that the directory index is index.wsgi. In apache, this is  
>> done
>> by creating (if not present) a `.htaccess` file in the `myvoc`
>> diractory, and adding the following line::
>>
>>     DirectoryIndex index.cgi
>>
>> (or `index.wsgi`, accordingly)
>>
>> There is more docs in the script itself. I think the more recipes
>> (including for other httpds) we can provide with the script, the more
>> useful it will be. So feel free to propose other ones.
>>
>>  enjoy
>>
>>   pa
>>
> <path.php><lodpub.php>

------------------------------------------------------------
IHMC                                     (850)434 8903 or (650)494 3973
40 South Alcaniz St.           (850)202 4416   office
Pensacola                            (850)202 4440   fax
FL 32502                              (850)291 0667   mobile
phayesAT-SIGNihmc.us       http://www.ihmc.us/users/phayes







Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Mark Birbeck-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Pat,

> I have checked with my system admin, and they tell me, Yes that is correct.
> You cannot access your .htaccess file. You cannot modify it or paste
> anything into it. Only we have access to it. No, we will not change this
> policy for you, no matter how important you think you are. Although they do
> not say it openly, the implicit message is, we don't give a damn what the
> W3C thinks you ought to be able to do on our website.

I agree that this seems to be getting like Groundhog Day. :)

The original point of this thread seemed to me to be saying that if
.htaccess is the key to the semantic web, then it's never going to
happen.

I.e., ".htaccess is a major bottleneck".

The initial discussion around that theme was then followed by all
sorts of discussions about how people could create scripts that would
choose between different files, and deliver the correct one to the
user. But the fact remained -- as you rightly point out here -- that
you still need to modify .htaccess.


> Now, has anyone got any OTHER ideas?  An idea that does not involve changing
> any actual code, and so can be done using a text editor on an HTML text
> file, would be a very good option.

:)

Did I mention RDFa?

Regards,

Mark

--
Mark Birbeck, webBackplane

mark.birbeck@...

http://webBackplane.com/mark-birbeck

webBackplane is a trading name of Backplane Ltd. (company number
05972288, registered office: 2nd Floor, 69/85 Tabernacle Street,
London, EC2A 4RR)


Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Pierre-Antoine Champin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark,

disclaimer: I have nothing against the RDFa solution; I just don't think
that one size fits all :)

ok, the solutions proposed here (by myself and others) still involve
editing the .htaccess. However, compared to configuring HTTP
redirections using mod_rewrite, they have two advantages:

- they are shorter and hopefully easier to adapt
- they are more likely to be allowed for end users

So I think it is a progress.

Furthermore, some of the recipes may work without even touching the
.htaccess file, providing that

- executable files are automatically considered as CGI scripts
- index.php is automatically considered as a directory index

One size does not fit all, that is why we should provide several simple
recipes in which people may find the one that works for them.

This is why I'm asking (again) to IIS-users and (other httpd)-users to
provide non apache recipes as well.

Of course, the "publish it in RDFa" recipe is a perfectly legal one !

   pa

Le 08/07/2009 15:13, Mark Birbeck a écrit :

> Hi Pat,
>
>> I have checked with my system admin, and they tell me, Yes that is correct.
>> You cannot access your .htaccess file. You cannot modify it or paste
>> anything into it. Only we have access to it. No, we will not change this
>> policy for you, no matter how important you think you are. Although they do
>> not say it openly, the implicit message is, we don't give a damn what the
>> W3C thinks you ought to be able to do on our website.
>
> I agree that this seems to be getting like Groundhog Day. :)
>
> The original point of this thread seemed to me to be saying that if
> .htaccess is the key to the semantic web, then it's never going to
> happen.
>
> I.e., ".htaccess is a major bottleneck".
>
> The initial discussion around that theme was then followed by all
> sorts of discussions about how people could create scripts that would
> choose between different files, and deliver the correct one to the
> user. But the fact remained -- as you rightly point out here -- that
> you still need to modify .htaccess.
>
>
>> Now, has anyone got any OTHER ideas?  An idea that does not involve changing
>> any actual code, and so can be done using a text editor on an HTML text
>> file, would be a very good option.
>
> :)
>
> Did I mention RDFa?
>
> Regards,
>
> Mark
>



Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Toby Inkster-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2009-07-08 at 15:13 +0100, Mark Birbeck wrote:
> The original point of this thread seemed to me to be saying that if
> .htaccess is the key to the semantic web, then it's never going to
> happen.

It simply isn't the key to the semantic web though.

.htaccess is a simple way to configure Apache to do interesting things.
It happens to give you a lot of power in deciding how requests for URLs
should be translated into responses of data. If you have hosting which
allows you such advanced control over your settings, and you can create
nicer URLs, then by all means do so - and not just for RDF, but for all
your URLs. It's a Good Thing to do, and in my opinion, worth switching
hosts to achieve.

But all that isn't necessary to publish linked data. If you own
example.com, you can upload foaf.rdf and give yourself a URI like:

        <http://example.com/foaf.rdf#alice>

(Or foaf.ttl, foaf.xhtml, whatever.)

No, that's not as elegant as <http://example.com/alice> with a
connection negotiated 303 redirect to representations in various
formats, but it does work, and it won't break anything.

Let's not blow this all out of proportion.

--
Toby A Inkster
<mailto:mail@...>
<http://tobyinkster.co.uk>



Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Seth Russell-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


But all that isn't necessary to publish linked data. If you own
example.com, you can upload foaf.rdf and give yourself a URI like:

       <http://example.com/foaf.rdf#alice>


I'm going to ask a stupid question ... don't everybody laugh at once. 

Is it not true that everything past the hash (#alice) is not transmitted back to the server when a browser clicks on a hyperlink ?   If that is true, then the server would not be able to serve anything different if a browser clicked upon http://example.com/foaf.rd or if they clicked upon http://example.com/foaf.rd#
alice .   If that is true, and it probably isn't, then is not the Semantic Web crippled from using that techniqe to distinguish between resources and at the same time hyper linking between those different resources?

Ok, you can stop laughfing now.

--
Seth Russell
Thoughts about The New Semantic Web http://fastblogit.com/seth/
www.speaktomecatalog.com


Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Ian Davis-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday, July 8, 2009, Toby Inkster <tai@...> wrote:

> On Wed, 2009-07-08 at 15:13 +0100, Mark Birbeck wrote:
>> The original point of this thread seemed to me to be saying that if
>> .htaccess is the key to the semantic web, then it's never going to
>> happen.
>
> It simply isn't the key to the semantic web though.
>
> .htaccess is a simple way to configure Apache to do interesting things.
> It happens to give you a lot of power in deciding how requests for URLs
> should be translated into responses of data. If you have hosting which
> allows you such advanced control over your settings, and you can create
> nicer URLs, then by all means do so - and not just for RDF, but for all
> your URLs. It's a Good Thing to do, and in my opinion, worth switching
> hosts to achieve.
>
> But all that isn't necessary to publish linked data. If you own
> example.com, you can upload foaf.rdf and give yourself a URI like:
>
>         <http://example.com/foaf.rdf#alice>
>
> (Or foaf.ttl, foaf.xhtml, whatever.)

This just works and is how the html web grew. Write a document and
save it into a publuc spaxe. Fancy stuff like pretty URIs need more
work but are not at all necessary for linked data or the semantic web.


>
> Let's not blow this all out of proportion.

Hear hear!

> --
> Toby A Inkster
> <mailto:mail@...>
> <http://tobyinkster.co.uk>


Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by David Booth-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2009-07-08 at 15:50 +0100, Pierre-Antoine Champin wrote:
[ . . . ]
> ok, the solutions proposed here (by myself and others) still involve
> editing the .htaccess.

Once again, use of a 303-redirect service such as
http://thing-described-by.org/ or http://t-d-b.org/ 
does not require *any* configuration or .htaccess editing.  It does not
address the problem of setting the content type correctly, but it *does*
provide an easy way to generate 303 redirects, in conformance with "Cool
URIs for the Semantic Web":
http://www.w3.org/TR/cooluris/#r303gendocument 

Hmm, I thought the use of a 303-redirect service was mentioned in "Cool
URIs for the Semantic Web", but in looking back, I see it was in "Best
Practice Recipes for Publishing RDF Vocabularies":
http://www.w3.org/TR/swbp-vocab-pub/#redirect
Maybe it should be mentioned in a future version of the Cool URIs
document as well.


--
David Booth, Ph.D.
Cleveland Clinic (contractor)

Opinions expressed herein are those of the author and do not necessarily
reflect those of Cleveland Clinic.



Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Hugh Glaser :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry to hear that, Pat.

On 08/07/2009 14:51, "Pat Hayes" <phayes@...> wrote:

>
>
> On Jul 5, 2009, at 10:16 AM, Hugh Glaser wrote:
>
>> OK, I'll have a go :-)
>> Why did I think this would be fun to do on a sunny Sunday morning
>> that has turned into afternoon?
>> Here are the instructions:
>>
>
> And here is why I cannot follow them.
>
>>
>> 1.  Create a web-accessible directory, let's say foobar, with all
>> your .rdf, .ttl, .ntriples and .html files in it.
>> 2.  Copy lodpub.php and path.php into it.
>
> OK so far...
>
>> 3.  Access path.php from your web server.
>
> I can see this file, but I cannot access it. Attempting to do so gives
> me the message
>
> Can not open file .htaccess
> Reason: Could not download file (403:HTTP/1.1
> 403 forbidden)
Just a clarification, which probably doesn't help you, but just might.
When you try to access path.php, you should either get some text in which
the string htaccess appears (success), or some indication that you cannot
access path.php or run php.
I see no reason why you would get the message above trying to access
path.php.
(Unless somehow the attempt to run php has resulted in an attempt to access
.htaccess because of a local issue, in which case the system is badly
configured in its error reporting.)
I guess that what you have seen is the result of creating a file called
.htaccess on your local machine, and then trying to upload it to the server,
using some sort of web-based upload facility?
Best
Hugh

>
> I have checked with my system admin, and they tell me, Yes that is
> correct. You cannot access your .htaccess file. You cannot modify it
> or paste anything into it. Only we have access to it. No, we will not
> change this policy for you, no matter how important you think you are.
> Although they do not say it openly, the implicit message is, we don't
> give a damn what the W3C thinks you ought to be able to do on our
> website.
>
> Now, has anyone got any OTHER ideas?  An idea that does not involve
> changing any actual code, and so can be done using a text editor on an
> HTML text file, would be a very good option.
>
> Pat Hayes
>
>

>> 4.  Follow the instruction to paste that text into .htaccess
>> 5.  You can remove path.php if you like, it was only there to help
>> you get the .htaccess right.
>>
>> That should be it.
>> The above text and files are at
>> http://www.rkbexplorer.com/blog/?p=11
>>
>> Of course, I expect that you can tell me all sorts of problems/
>> better ways, but I am hoping it works for many.
>>
>> Some explanation:
>> We use a different method, and I have tried to extract the essence,
>> and keep the code very simple.
>> We trap all 404 (File not Found) in the directory, and then any
>> requests coming in for non-existent files will generate a 303 with
>> an extension added, depending on the Accept header.
>> Note that you probably need the leading "/" followed by the full
>> path from the domain root, otherwise it will just print out the text
>> "lodpub.php";
>> (That is not what the apache specs seem to say, but it is what seems
>> to happen).
>> If you get "Additionally, a 404 Not Found error was encountered
>> while trying to use an ErrorDocument to handle the request.", then
>> it means that web server is not finding your ErrorDocument .
>> Put the file path.php in the same directory and point your browser
>> at it - this will tell you what the path should be.
>>
>> Note that the httpd.conf (in /etc/httpd/conf) may not let your
>> override, if your admins have tied things down really tight.
>> Mine says:
>>    AllowOverride All
>>
>> Finally, at the moment, note that I think that apache default does
>> not put the correct MIME type on rdf files, but that is a separate
>> issue, and it makes no difference that the 303 happened.
>>
>> Best
>> Hugh
>>
>> On 05/07/2009 01:52, "Pierre-Antoine Champin" <swlists-040405@...
>>> wrote:
>>
>>> Le 03/07/2009 15:14, Danny Ayers a écrit :
>>>> 2009/7/2 Bill Roberts<bill@...>:
>>>>> I thought I'd give the .htaccess approach a try, to see what's
>>>>> involved in
>>>>> actually setting it up.  I'm no expert on Apache, but I know the
>>>>> basics of
>>>>> how it works, I've got full access to a web server and I can read
>>>>> the online
>>>>> Apache documentation as well as the next person.
>>>>
>>>> I've tried similar, even stuff using PURLs - incredibly difficult to
>>>> get right. (My downtime overrides all, so I'm not even sure if I got
>>>> it right in the end)
>>>>
>>>> I really think we need a (copy&  paste) cheat sheet.
>>>>
>>>> Volunteers?
>>>
>>> (raising my hand) :)*
>>>
>>> Here is a quick python script that makes it easier (if not completely
>>> immediate). It may still requires a one-liner .htaccess, but one
>>> that (I
>>> think) is authorized by most webmasters.
>>>
>>> I guess a PHP version would not even require that .htaccess, but
>>> sorry,
>>> I'm not fluent in PHP ;)
>>>
>>> So, assuming you want to publish a vocabulary with an RDF and an HTML
>>> description at http://example.com/mydir/myvoc, you need to:
>>>
>>> 1. Make `myvoc` a directory at the place where your HTTP server will
>>>    serve it at the desired URI.
>>> 2. Copy the script in this directory as 'index.cgi' (or
>>> 'index.wsgi' if
>>>    your server as WSGI support).
>>> 3. In the same directory, put two files named 'index.html' and
>>>    'index.rdf'
>>>
>>> If it does not work now (it didn't for me),you have to tell your HTTP
>>> server that the directory index is index.wsgi. In apache, this is
>>> done
>>> by creating (if not present) a `.htaccess` file in the `myvoc`
>>> diractory, and adding the following line::
>>>
>>>     DirectoryIndex index.cgi
>>>
>>> (or `index.wsgi`, accordingly)
>>>
>>> There is more docs in the script itself. I think the more recipes
>>> (including for other httpds) we can provide with the script, the more
>>> useful it will be. So feel free to propose other ones.
>>>
>>>  enjoy
>>>
>>>   pa
>>>
>> <path.php><lodpub.php>
>
> ------------------------------------------------------------
> IHMC                                     (850)434 8903 or (650)494 3973
> 40 South Alcaniz St.           (850)202 4416   office
> Pensacola                            (850)202 4440   fax
> FL 32502                              (850)291 0667   mobile
> phayesAT-SIGNihmc.us       http://www.ihmc.us/users/phayes
>
>
>
>
>
>



Re: .htaccess a major bottleneck to Semantic Web adoption / Was: Re: RDFa vs RDF/XML and content negotiation

by Olivier Rossel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do you mean that all deferencable URIs of a RDF document should have
their domain name to end with t-d-b.org, so their resolution leads to
the TDB server which redirects to the final location?

On Wednesday, July 8, 2009, David Booth <david@...> wrote:

> On Wed, 2009-07-08 at 15:50 +0100, Pierre-Antoine Champin wrote:
> [ . . . ]
>> ok, the solutions proposed here (by myself and others) still involve
>> editing the .htaccess.
>
> Once again, use of a 303-redirect service such as
> http://thing-described-by.org/ or http://t-d-b.org/
> does not require *any* configuration or .htaccess editing.  It does not
> address the problem of setting the content type correctly, but it *does*
> provide an easy way to generate 303 redirects, in conformance with "Cool
> URIs for the Semantic Web":
> http://www.w3.org/TR/cooluris/#r303gendocument
>
> Hmm, I thought the use of a 303-redirect service was mentioned in "Cool
> URIs for the Semantic Web", but in looking back, I see it was in "Best
> Practice Recipes for Publishing RDF Vocabularies":
> http://www.w3.org/TR/swbp-vocab-pub/#redirect
> Maybe it should be mentioned in a future version of the Cool URIs
> document as well.
>
>
> --
> David Booth, Ph.D.
> Cleveland Clinic (contractor)
>
> Opinions expressed herein are those of the author and do not necessarily
> reflect those of Cleveland Clinic.
>
>
>

< Prev | 1 - 2 - 3 - 4 - 5 - 6 | Next >