Re: data.gov now live with RDFa

Yes, it has been removed from the page. I've been occupied with other 
things. Thanks for the suggestions Toby and Rich. I'll see what's up and 
ping you back.

Rick


Ed Summers wrote:
> Just catching up on some old email. Perhaps I'm being obtuse, but is
> there still RDFa at
> 
>   http://www.data.gov
> 
> I don't seem to see any, and neither does the distiller:
> 
>   http://www.w3.org/2007/08/pyRdfa/extract?format=turtle&uri=http://www.data.gov
> 
> //Ed
> 
> On Thu, Aug 20, 2009 at 8:16 AM, Richard Cyganiak<richard@cyganiak.de> wrote:
>> Rick,
>>
>> Toby already pointed out the issue with the dc: namespace.
>>
>> There's also this section:
>>
>> <div class="hometext" about="data.gov program" property="dc:description">
>>  The purpose of Data.gov is to increase public access ...
>> </div>
>>
>> The value of the @about attribute has to be a URI, and "data.gov program" is
>> not a URI. Fixing it is easy, but depends on what exactly you want the data
>> to say.
>>
>> 1. Maybe you want the text to be a description of the web page
>> http://www.data.gov/. Similar to the dc:title, dc:creator and dc:publisher
>> triples that are already present. In that case, you would want to use
>> about="", which is a shortcut for about="http://www.data.gov/" because an
>> empty URI will be treated as a relative URI, and therefore expands to the
>> URI of the current document. But since about="" is the default anyway, you
>> could just drop the attribute completely and still get the same triple.
>>
>> 2. Maybe you want to text to be a description of the "data.gov program", the
>> government activity/entity, and not just a description of the particular web
>> page. In that case, you would need to decide on a URI that you want to use
>> for this entity. One easy option would be about="#program", which again is a
>> relative URI and would expand to http://www.data.gov/#program. In that case,
>> it would be nice to add some more triples about the program.
>>
>> The first option might be a bit more straightforward.
>>
>> Best,
>> Richard
>>
>>
>> On 19 Aug 2009, at 11:50, rick wrote:
>>
>>> Hello All:
>>>
>>> Just to give you a heads up the data.gov home page is now live with RDFa
>>> tags.
>>>
>>> http://www.data.gov/
>>>
>>> The page has two triples. One about the page, one about the program. We
>>> used this very simplistic approach to overcome any operational barriers and
>>> develop experience in publishing RDFa tags.
>>>
>>> See below for source code that parses the triples. I used the INRIA GRDDL
>>> transform.
>>>
>>> Have fun and I'll watch this list for feedback and such.
>>>
>>> --
>>> Rick
>>>
>>> cell: 703-201-9129
>>> web:  http://www.rickmurphy.org
>>> blog: http://phaneron.rickmurphy.org
>>>
>>>> more RDFaConsumer.java
>>> /**
>>> * @(#)RDFaConsumer.java
>>> * @author rick@rickmurphy.org
>>> */
>>>
>>> package gov.data;
>>>
>>> /**
>>> */
>>>
>>> import javax.xml.parsers.DocumentBuilder;
>>> import javax.xml.parsers.DocumentBuilderFactory;
>>> import javax.xml.parsers.FactoryConfigurationError;
>>> import javax.xml.parsers.ParserConfigurationException;
>>>
>>> import org.xml.sax.SAXException;
>>> import org.xml.sax.SAXParseException;
>>>
>>> import java.text.ParseException;
>>>
>>> import java.io.UnsupportedEncodingException;
>>> import java.io.IOException;
>>>
>>> import org.w3c.dom.Document;
>>> import org.w3c.dom.Node;
>>> import org.w3c.dom.NodeList;
>>> import org.w3c.dom.Element;
>>>
>>> import javax.xml.transform.Transformer;
>>> import javax.xml.transform.TransformerFactory;
>>> import javax.xml.transform.TransformerException;
>>> import javax.xml.transform.TransformerConfigurationException;
>>> import javax.xml.transform.dom.DOMSource;
>>> import javax.xml.transform.stream.StreamResult;
>>> import javax.xml.transform.stream.StreamSource;
>>>
>>>
>>> import java.net.URL;
>>>
>>> public class RDFaConsumer{
>>>
>>>   private static String namespace;
>>>
>>>   /**
>>>    */
>>>   public RDFaConsumer(String uri){
>>>
>>>        try {
>>>
>>>            DocumentBuilderFactory factory =
>>> DocumentBuilderFactory.newInstance();
>>>           DocumentBuilder builder = factory.newDocumentBuilder();
>>>            Document input = builder.parse(new URL(uri).toString());
>>>            input.normalize();
>>>
>>>            DOMSource source = new DOMSource(input);
>>>            StreamResult result = new StreamResult(System.out);
>>>            StreamSource stylesheet = new StreamSource(new
>>> URL("http://ns.inria.fr/grddl/
>>> rdfa/2008/09/03/RDFa2RDFXML.xsl").toString());
>>>
>>>            // Use a Transformer for output
>>>            TransformerFactory tFactory = TransformerFactory.newInstance();
>>>            Transformer transformer = tFactory.newTransformer(stylesheet);
>>>            transformer.transform(source, result);
>>>
>>>            // transform the dom into RDF/XML
>>>            traverse(input);
>>>
>>>       } catch (SAXParseException spe) {
>>>            System.out.println("sax parse ex: " + spe);
>>>       } catch (SAXException sxe) {
>>>            System.out.println("sax ex: " + sxe);
>>>       } catch (ParserConfigurationException pce) {
>>>            System.out.println("parser config ex: " + pce);
>>>       }catch (UnsupportedEncodingException ude) {
>>>            System.out.println("unsupported encoding ex: " + ude);
>>>       } catch (IOException ioe) {
>>>            System.out.println("io ex: " + ioe);
>>>       } catch (TransformerConfigurationException tc) {
>>>            System.out.println("transformer config ex: " + tc);
>>>       } catch (TransformerException te) {
>>>            System.out.println("trasnformer ex: " + te);
>>>       }
>>>
>>>   }//RDFaConsumer
>>>
>>>   /**
>>>    */
>>>   public static void main(String[] args){
>>>
>>>        new RDFaConsumer(args[0]);
>>>
>>>   }//main
>>>
>>>   /**
>>>    */
>>>   public void traverse(Node node){
>>>
>>>       // is there anything to do?
>>>       if (node == null) {
>>>           return;
>>>       }
>>>
>>>       int type = node.getNodeType();
>>>       switch (type) {
>>>        case Node.DOCUMENT_NODE: {;
>>>               Document document = (Document)node;
>>>               traverse(document.getDocumentElement());
>>>               break;
>>>        }
>>>
>>>        case Node.ELEMENT_NODE: {
>>>
>>>            if(node.getNodeName().equals("")){
>>>
>>>                NodeList childNodes = node.getChildNodes();
>>>
>>>                break;
>>>
>>>            }
>>>        }
>>>
>>>        case Node.ENTITY_REFERENCE_NODE: {
>>>            Node child = node.getFirstChild();
>>>            while (child != null) {
>>>                traverse(child);
>>>                child = child.getNextSibling();
>>>            }
>>>            break;
>>>        }
>>>
>>>        case Node.CDATA_SECTION_NODE: {
>>>
>>>            // no work here
>>>            break;
>>>        }
>>>
>>>        }
>>>
>>>   }//traverse
>>>
>>>   /**
>>>    */
>>>   public void getRDFaHTML(){}//getRDFaHTML
>>>
>>> }//RDFaConsumer
>>>
>>>
>>>
>>
>>
> 
> 

-- 
Rick

cell: 703-201-9129
web:  http://www.rickmurphy.org
blog: http://phaneron.rickmurphy.org

Received on Wednesday, 2 September 2009 02:33:38 UTC