+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 21

The Semantic Web & XHTML+RDFa

This is a discussion on The Semantic Web & XHTML+RDFa within the Webmaster Discussion forums, part of the Find a Webmaster / Web Developer / Job Requests category; On 16 October 2008 the W3C announced XHTML+RDFa as a recommendation . IMO this is an important milestone in the ...

  1. #1
    Banned jamesicus is on a distinguished road
    Join Date
    Oct 2008
    Posts
    11

    Default The Semantic Web & XHTML+RDFa

    On 16 October 2008 the W3C announced XHTML+RDFa as a recommendation. IMO this is an important milestone in the process of implementing the Semantic Web. The Doctype/DTD is now cataloged and usable by the W3C Markup Validator.

    By way of example of the use of basic constructs and syntax, I have composed a validated XHTML+RDFa page -- just general information for those who might be interested in the development of the Semantic Web.

    James

  2. #2
    Senior Staff Hunter1 has a brilliant future Hunter1 has a brilliant future Hunter1 has a brilliant future Hunter1 has a brilliant future Hunter1 has a brilliant future Hunter1 has a brilliant future Hunter1 has a brilliant future Hunter1 has a brilliant future Hunter1 has a brilliant future Hunter1 has a brilliant future Hunter1 has a brilliant future Hunter1's Avatar
    Join Date
    Mar 2007
    Location
    Indiana USA
    Posts
    1,108

    Default

    I have been following this a bit as well.

    This new system will make older sites that have outdated coding become up to date with very little work. There are a lot of sites out there that would like to enjoy the modern reading of their code but they do not have the option to change or update their script but this will change that.

    There are also some downfalls that I can see from this but we will see here very soon what the effects and possibilities are going to be.

    Good post!

  3. #3
    New Hunter Webnauts is on a distinguished road
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    9

    Thumbs up

    Quote Originally Posted by Hunter1 View Post
    I have been following this a bit as well.

    This new system will make older sites that have outdated coding become up to date with very little work. There are a lot of sites out there that would like to enjoy the modern reading of their code but they do not have the option to change or update their script but this will change that.

    There are also some downfalls that I can see from this but we will see here very soon what the effects and possibilities are going to be.

    Good post!
    Great post James!

    Hunter, reading the post I thought straight away to modify my site's markup to XHTML+RDFa. Wouldn't that be a good idea? Which are the downfalls?

  4. #4
    Banned jamesicus is on a distinguished road
    Join Date
    Oct 2008
    Posts
    11

    Default

    Quote Originally Posted by Webnauts View Post
    Great post James!
    Thanks, Webnauts.

    .......... I thought straight away to modify my site's markup to XHTML+RDFa. Wouldn't that be a good idea? Which are the downfalls?
    If I may interject .......... I don't think it would be a good idea at this time. There is a big learning curve involved in using XHTML+RDFa in a practical way. I suggest you start off reading the RDF references in my Semantic Web sidngture link and especially RDFa in XHTML: Syntax and Processing -- the concepts are pretty complicated and you may have to re-read it a couple of times before you do full incorporation. But, it will be a good exercise because the Semantic Web is the next major development IMO.

    James

  5. #5
    Banned jamesicus is on a distinguished road
    Join Date
    Oct 2008
    Posts
    11

    Default

    BTW, if you would like to see Triples and Graphs (and source code) used in conjunction with RDF/XML (referenced in the W3C XHTML+RDF link in my previous post) depicted go to this W3C Validation result

    James

  6. #6
    New Hunter Webnauts is on a distinguished road
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    9

    Red face XHTML+RDFa

    James I think I was too quick. I began implementing it on my web site.

    I know I have to read the documentation and implement several stuff, but for a start I just added on my all my pages the following PHP script, taking care of the HTML (ascii) codes of my pages:

    <?php
    $charset = "utf-8";
    $mime = "text/html";

    function fix_code($buffer) {
    return (str_replace(" />", ">", $buffer));
    }

    if(stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
    # if there's a Q value for "application/xhtml+xml" then also
    # retrieve the Q value for "text/html"
    if(preg_match("/application\/xhtml\+xml;q=0(\.[1-9]+)/i",
    $_SERVER["HTTP_ACCEPT"], $matches)) {
    $xhtml_q = $matches[1];
    if(preg_match("/text\/html;q=0(\.[1-9]+)/i",
    $_SERVER["HTTP_ACCEPT"], $matches)) {
    $html_q = $matches[1];
    # if the Q value for XHTML is greater than or equal to that
    # for HTML then use the "application/xhtml+xml" mimetype
    if($xhtml_q >= $html_q) {
    $mime = "application/xhtml+xml";
    }
    }
    # if there was no Q value, then just use the
    # "application/xhtml+xml" mimetype
    } else {
    $mime = "application/xhtml+xml";
    }
    }

    # special check for the W3C_Validator
    if (stristr($_SERVER["HTTP_USER_AGENT"],"W3C_Validator")) {
    $mime = "application/xhtml+xml";
    }

    # set the prolog_type according to the mime type which was determined
    if($mime == "application/xhtml+xml") {
    $prolog_type = "<?xml version='1.0' encoding='$charset'?>
    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML+RDFa 1.0//EN' 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' version='XHTML+RDFa 1.0' xml:lang='en'>";
    } else {
    ob_start("fix_code");
    $prolog_type = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>";
    }
    # finally, output the mime type and prolog type
    header("Content-Type: $mime;charset=$charset");
    header("Vary: Accept");
    print $prolog_type;
    ?>

    I tested already with diverse browsers and I have not noticed any compatibility issues. Do you think that what I am doing would harm in any way?

  7. #7
    Banned jamesicus is on a distinguished road
    Join Date
    Oct 2008
    Posts
    11

    Default

    Quote Originally Posted by Webnauts View Post
    James I think I was too quick. I began implementing it on my web site.

    I know I have to read the documentation and implement several stuff, but for a start I just added on my all my pages the following PHP script, taking care of the HTML (ascii) codes of my pages .......... I tested already with diverse browsers and I have not noticed any compatibility issues. Do you think that what I am doing would harm in any way?
    Not at all, Webnauts -- great job! (Valid XHTML+RDFa too!)

    (Of course you don't have any RDFa syntax added yet)

    James
    Last edited by jamesicus; 10-25-2008 at 09:01 PM. Reason: added forgotten text

  8. #8
    New Hunter Webnauts is on a distinguished road
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    9

    Default

    Quote Originally Posted by jamesicus View Post
    Not at all, Webnauts -- great job! (Valid XHTML+RDFa too!)
    Great!


    Quote Originally Posted by jamesicus View Post
    (Of course you don't have any RDFa syntax added yet)
    You are right. That is the next step.

    Thanks, John :)

  9. #9
    New Hunter Webnauts is on a distinguished road
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    9

    Question

    James I have a question. I do not use for my "h1" tags the "title" tags content.

    I have for example the title "SEO Workers - Search Engine Optimization Consulting Company" and for the h1 tag "SEO & Custom Web Design Experts for Better Search Engine Rankings"


    Since I wanted to add a property to my h1 tag, I guess I need to add a meta tag for s dc.title.

    What should I use there for the property? The content of my "title" or of the "h1" tag?

  10. #10
    Banned jamesicus is on a distinguished road
    Join Date
    Oct 2008
    Posts
    11

    Default

    Quote Originally Posted by Webnauts View Post
    James I have a question. I do not use for my "h1" tags the "title" tags content.

    I have for example the title "SEO Workers - Search Engine Optimization Consulting Company" and for the h1 tag "SEO & Custom Web Design Experts for Better Search Engine Rankings"


    Since I wanted to add a property to my h1 tag, I guess I need to add a meta tag for s dc.title.

    What should I use there for the property? The content of my "title" or of the "h1" tag?
    Check out Dublin Core (DC) Metadata Element Set first, John.

    James

  11. #11
    New Hunter Webnauts is on a distinguished road
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    9

    Default

    I checked Dublin core. Thanks James.

    I guess I have one very last question that is giving me a headache:

    http://www.w3.org/2005/08/online_xsl...eoworkers.com/

    I get an error: unparseable - text/plain not visibly XML. Can you tell what that can be?

  12. #12
    New Hunter Webnauts is on a distinguished road
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    9

    Default

    Do you think you can help me with a php script, since I can't get mine working properly?

  13. #13
    Banned jamesicus is on a distinguished road
    Join Date
    Oct 2008
    Posts
    11

    Default

    Sorry I didn't get back to you sooner, Webnauts. I will have to study your page further.

    Webnauts and Hunter1: Thanks. I composed this page to illustrate the use of the XHTML+RDFa Doctype/DTD, and the syntax of three primary RDFa elements: | about | property | typeof | together with an example FOAF (Friend Of A Friend) and Creative Commons constructs -- for those who might want to experiment with creating XHTML+RDFa pages after reading the W3C RDFa Primer and RDFa recommendation RDFa in XHTML: Syntax and Processing.

    This is actually my own attempt to understand how XHTML+RDFa documents are constructed and function.

    James

  14. #14
    New Hunter Webnauts is on a distinguished road
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    9

    Default

    Quote Originally Posted by jamesicus View Post
    Sorry I didn't get back to you sooner, Webnauts. I will have to study your page further.

    Webnauts and Hunter1: Thanks. I composed this page to illustrate the use of the XHTML+RDFa Doctype/DTD, and the syntax of three primary RDFa elements: | about | property | typeof | together with an example FOAF (Friend Of A Friend) and Creative Commons constructs -- for those who might want to experiment with creating XHTML+RDFa pages after reading the W3C RDFa Primer and RDFa recommendation RDFa in XHTML: Syntax and Processing.

    This is actually my own attempt to understand how XHTML+RDFa documents are constructed and function.

    James
    Hi James,

    I switched back to XHMTL Strict because I could not get my PHP parser working correctly.

    If I had an appropriate functional parser, I would not have had to change back. I know already the above you have mentioned FOAF, etc).

    Do you think you could share the parser script? I would even pay a fee.

    Thanks a lot in advance,

    John

  15. #15
    Banned jamesicus is on a distinguished road
    Join Date
    Oct 2008
    Posts
    11

    Default

    Quote Originally Posted by Webnauts View Post
    .......... I switched back to XHMTL Strict because I could not get my PHP parser working correctly .......... Do you think you could share the parser script? I would even pay a fee ..........
    I don't know what you mean by "parser script", John. I will be happy to share any coding, scripts, etc. -- no charge of course.

    James

  16. #16
    New Hunter Webnauts is on a distinguished road
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    9

    Default

    The PHP script I am about is for serving up XHTML with the correct MIME type, and being cross browser compatible.

    This one did not do the work as it should so far :

    <?php
    $charset = "utf-8";
    $mime = "text/html;";

    function fix_code($buffer) {
    return (str_replace(" />", ">", $buffer));
    }

    if(stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
    # if there's a Q value for "application/xhtml+xml" then also
    # retrieve the Q value for "text/html"
    if(preg_match("/application\/xhtml\+xml;q=0(\.[1-9]+)/i",
    $_SERVER["HTTP_ACCEPT"], $matches)) {
    $xhtml_q = $matches[1];
    if(preg_match("/text\/html;q=0(\.[1-9]+)/i",
    $_SERVER["HTTP_ACCEPT"], $matches)) {
    $html_q = $matches[1];
    # if the Q value for XHTML is greater than or equal to that
    # for HTML then use the "application/xhtml+xml" mimetype
    if($xhtml_q >= $html_q) {
    $mime = "application/xhtml+xml";
    }
    }
    # if there was no Q value, then just use the
    # "application/xhtml+xml" mimetype
    } else {
    $mime = "application/xhtml+xml";
    }
    }

    # special check for the W3C_Validator
    if (stristr($_SERVER["HTTP_USER_AGENT"],"W3C_Validator")) {
    $mime = "application/xhtml+xml";
    }

    # set the prolog_type according to the mime type which was determined
    if($mime == "application/xhtml+xml") {
    $prolog_type = "<?xml version=\"1.0\" encoding=\"$charset\"?>
    <?xml-stylesheet type=\"text/xsl\" href=\"/copy.xsl\"?>
    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML+RDFa 1.0//EN' 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' version='XHTML+RDFa 1.0' xml:lang='en'>";
    }
    else {
    ob_start("fix_code");
    $prolog_type = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>";
    }
    # finally, output the mime type and prolog type
    header("Content-Type: $mime;charset=$charset");
    header("Vary: Negotiate,Accept,");
    print $prolog_type;
    ?>

    I am sure you are using a script for that. Do you understand what I mean?

    Thanks James. :)
    Last edited by Webnauts; 11-04-2008 at 01:25 AM.

  17. #17
    Banned jamesicus is on a distinguished road
    Join Date
    Oct 2008
    Posts
    11

    Default

    Quote Originally Posted by Webnauts View Post
    The PHP script I am about is for serving up XHTML with the correct MIME type, and being cross browser compatible .......... Do you understand what I mean? ..........
    Ah, yes, John. I use various iterations for serving XHTML via content negotiation. Here is the simple core form for XHTML+RDFa -- modify it as you wish, John.

    <?php

    # For MSIE browsers
    if (stristr($_SERVER["HTTP_USER_AGENT"],"MSIE")) {
    $mime = "text/html";
    $charset = "utf-8";
    $prolog_type = "
    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML+RDFa 1.0//EN'
    'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' version='XHTML+RDFa 1.0'
    xml:lang='en'>";
    }

    # For other browsers
    else {
    $mime = "application/xhtml+xml";
    $charset = "utf-8";
    $prolog_type = "<?xml version='1.0' encoding='$charset'?>
    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML+RDFa 1.0//EN'
    'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' version='XHTML+RDFa 1.0'
    xml:lang='en'>";
    }

    # Generate the mime type and prolog type
    header("Content-Type: $mime; charset=$charset");
    header("Vary: Negotiate, Accept");
    print $prolog_type;

    ?>

  18. #18
    Banned jamesicus is on a distinguished road
    Join Date
    Oct 2008
    Posts
    11

    Default

    John -- or for serving XHTML 1.0 (strict) via content-negotiation:

    <?php

    # For MSIE browsers
    if (stristr($_SERVER["HTTP_USER_AGENT"],"MSIE")) {
    $mime = "text/html";
    $charset = "utf-8";
    $prolog_type = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
    'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-us' lang='en-us'>";
    }

    # For other browsers
    else {
    $mime = "application/xhtml+xml";
    $charset = "utf-8";
    $prolog_type = "<?xml version='1.0' encoding='$charset'?>
    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
    'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-us' lang='en-us'>";
    }

    # Generate the mime type and prolog type
    header("Content-Type: $mime; charset=$charset");
    header("Vary: Negotiate, Accept");
    print $prolog_type;

    ?>

  19. #19
    New Hunter Webnauts is on a distinguished road
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    9

    Default

    James did anybody ever tell you that you RULE? I assume yes.
    But just in case I am wrong, then I must admit that you rule!

    Thank you so much for the excellent support! I implemented a test page and it works great!

    Please PM me your paypal. I would love to buy you a beer. Or anything else you wish. :)

  20. #20
    Banned jamesicus is on a distinguished road
    Join Date
    Oct 2008
    Posts
    11

    Default

    Quote Originally Posted by Webnauts View Post
    .......... I must admit that you rule! ..........
    I will read this to my wife and cat -- they don't understand that! :)

    Please PM me your paypal. I would love to buy you a beer ..........
    Thanks, John -- no need for that -- but maybe we will quaff one together some day!

    Use Web-Sniffer View HTTP Request and Response Header to check how your pages are being served -- just specify the User-Agent (Browser) you wish to check for and leave everything else at default. Among other things, the content (MIME) type and character encoding will be displayed along with the page source code.

    James

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts