I'm considering the use of the PortableContacts schema to represent
people in Atom.
In order to do this, the PortableContacts elements need to be in an XML
namespace.
Can we pick a URL on portablecontacts.net that is used when
PortableContacts elements appear in other XML formats?
This would also make the portable contacts schema usable in RDF, though
admittedly it would then duplicate much of what FOAF does. (one might
argue that it already does, though currently with a different syntax as
well as a different schema.)
I don't think this really needs to be anything massively complicated.
The namespace URI could just be http://portablecontacts.net/ for the
sake of keeping it memorable.
In Atom I'd then expect it to look something like this:
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:pc="http://portablecontacts.net/">
<title>Martin Atkins</title>
... (other Atom elements) ...
<pc:displayName>Martin Atkins</pc:displayName>
<pc:gender>Male</pc:gender>
... (other PortableContacts elements) ...
</entry>
It's a little unfortunate that Atom has some required elements that
overlap with the PortableContacts schema, but that's for the
hypothetical "using PoCo in Atom" spec to worry about.
As I see it, all the PortableContacts spec needs to say is:
---------------------------------
If the elements defined in this specification are used within another
XML format that makes use of XML namespaces, or are used in RDF, the
elements from this specification SHOULD be in the XML namespace
"http://portablecontacts.net/". The elements retain the same meanings,
content models and processing expectations as defined in this specification.
---------------------------------
I'm not really sure where this paragraph would go in the current draft,
since there isn't actually any particular section describing in detail
the XML serialization; it's just stuck on the end of the description of
the "format" argument. It might be good to describe the two
serializations in more detail in sections of their own, which would then
give my paragraph above somewhere to live.
An open question is whether the XML serialization of the
PortableContacts *protocol* should also use this namespace. This has the
advantage that -- in theory at least -- the same parsing code can be
used regardless of where the elements are used. However, since the
primary motivation of the XML serialization is to make it easier to
process in Java and .NET, this decision ought to be driven by what
impact that has on Java and .NET developers. I don't know the answer to
that question, and I don't feel strongly either way on this issue.
This would be really great - good suggestion Martin. I asked for it
before too, since it makes a huge difference for our ability to map
between the PC formats and the RDF/FOAF world. While PC isn't itself
directly an RDF vocabulary (yet?), having an XML namespace URI for it
would allow a mapping to be made using GRDDL technology.
http://www.w3.org/TR/grddl/ (a fairly modest spec) defines some
mechanisms by which transforms, typically XSLT, can be discovered from
such a URI. You could use this to make an RDF view of your work (eg. to
exploit the SPARQL query language, the RDFa HTML notation, etc), or to
map to similar constructs in FOAF. Or both. I'd be happy to help with
any of this. As Martin mentions there are definite overlaps with FOAF,
as well as areas that each spec covers but the other doesn't attempt.
All the more reason to define some basic interop in a machine-friendly way.
For the namespace name, I recommend something short and memorable.
Having a version in the URI is a mixed blessing. I got stuck with '0.1'
in FOAF and migrations can be painful. But breaking things up by
publication year (eg. '2009' as suggested) is a common design.
cheers,
Dan
I did consider this, but figured that there's no versioning on the
serializations used by the core protocol, so if versioning is necessary
that would be the correct place to add it rather than at the XML
namespace level.
Would you agree?
Ahh yes, I didn't see that when I was scanning the spec.
That could be a reasonable choice, if we want to tie the version number
of the schema and the version number of the protocol together. (I can't
think of any reason not to, but I just wanted to make it clear that this
is what we're doing. :) )
Seems reasonable, although as Martin mentions it could bite if you find
the protocol versus the vocabulary/schema aspects of PC evolving on
different schedules.
Are you happy making /spec/1.0 dereference to an XML or XHTML document?
If I draft an XSLT doc expressing mappings to FOAF (and possibly other
schemas) could it be linked with GRDDL declarations from there?
If so I'll knock up a demo of PC data being mixed with other stuff
(FOAF+DOAP might be nice) and queried with SPARQL...
I also meant to point out the disadvantage of putting an explicit
version number on an XML namespace:
If you ever increment the version, you're instantly incompatible with
the previous version in all respects, since your elements now
effectively have different names.
Of course, this remains a hot issue within the XML community, so I'm
speaking only to my viewpoint here, but it seems to me that keeping
schemas backwards-compatible is much easier than keeping protocols
backwards-compatible, so my usual inclination is to keep versioning out
of the schema and instead just define all new versions to be a superset
of the previous version, with the possibility of deprecating
now-redundant elements.
Fair enough, but having a hypothetical version 2.0 of the
PortableContacts spec still using a namespace with 1.0 in it has the
potential to be confusing.
However, I would say that changing the namespace just to fiddle with
things like how plural fields are encoded would be irresponsible. We
should just pick one approach and stick with it; implementation
experience while creating this iteration of the spec should tell us
which is the right choice.
(And with that in mind, is anyone actually consuming the XML output of
PortableContacts right now? I'd be interested to see a Java or .NET
implementation using these amazing XML APIs I keep hearing so much about!)
Yup. We may be overthinking this :)
How about http://ns.portablecontacts.net/pc or
http://ns.portablecontacts.net/pc
This could be succeeded or augmented by numbered (or dated) versions in
the future should the need arise. And it could for now redirect to the
HTML (HTML4 currently) spec, without being directly shackled to it forever.
Putting it on a separate subdomain allows it to be managed separately
from whatever choices are made for the main site. Eg. the latter could
be made into a Drupal, Wordpress or Wiki installation without messing up
the integrity of the namespace documents. But then a simple Apache
directive could do the same.
> However, I would say that changing the namespace just to fiddle with
> things like how plural fields are encoded would be irresponsible. We
> should just pick one approach and stick with it; implementation
> experience while creating this iteration of the spec should tell us
> which is the right choice.
>
> (And with that in mind, is anyone actually consuming the XML output of
> PortableContacts right now? I'd be interested to see a Java or .NET
> implementation using these amazing XML APIs I keep hearing so much about!)
I started on an import-to-SPARQL tool that consumes the XML flavour.
http://svn.foaf-project.org/foaftown/foafablecontacts/
The XSLT barely exists, but it gets some data from Joseph's old
vcard-to-pc tool into an RDF database and queries it with SPARQL.
I think it'd need to be real XML. As I understand it (see
http://www.w3.org/TR/grddl/#ns-bind and
http://en.wikipedia.org/wiki/GRDDL#XML_.26_Transformations ) various XML
formats, or XHTML, would be fine. I guess you could probably even
content-negotiate non-XML HTML and an XHTML flavour if needed, though
that'd probably be overkill.
Actually I'm finding the GRDDL documentation focusses more on HTML-based
markups, like microformats. But the XML schema support is there, just a
little confusingly documented. One example is:
[[
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http:.../Order-1.0"
targetNamespace="http:.../Order-1.0"
version="1.0"
...
xmlns:data-view="http://www.w3.org/2003/g/data-view#"
data-view:transformation="http://www.w3.org/2003/g/embeddedRDF.xsl" >
<xsd:element name="Order" type="OrderType">
<xsd:annotation
<xsd:documentation>This element is the root
element.</xsd:documentation>
</xsd:annotation>
...
<xsd:annotation>
<xsd:appinfo>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://www.w3.org/2003/g/po-ex">
<data-view:namespaceTransformation
rdf:resource="grokPO.xsl" />
</rdf:Description>
</rdf:RDF>
</xsd:appinfo>
</xsd:annotation>
...
]]
...which is an example of XSD that can live at a namespace URI, and
which when parsed using GRDDL, reveals an RDF statement saying:
<http://www.w3.org/2003/g/po-ex> stands in a <namespaceTransformation>
relationship to the XSLT document <grokPO.xsl>. Meaning that anyone
encountering XML instance data using <http://www.w3.org/2003/g/po-ex>
can run that XSLT against the instance to extract RDF statements
compatible with SPARQL, RDFa, and merge-able with other RDF data.
...as if the current format is valid HTML rather than XHTML, and with
106 warnings. The HTML validator doesn't like <br /> and <hr />, since
these are XHTMLisms.
Probably easiest is to put a tiny little XHTML document at the ns URI,
which points to the appropriate spec page, to the project homepage, and
doesn't do a lot else.
Here is what the XHTML folk do, for example: http://www.w3.org/1999/xhtml/
Doubtless. It's also the reason others use HTML, or XHTML, or plain XML,
or even raw SQL. The art is finding a way to defragment data that's
split across these different (and all quite reasonable) environments. I
quite like CSV files, is it ok to admit that? :)
(And with that in mind, is anyone actually consuming the XML output of
PortableContacts right now? I'd be interested to see a Java or .NET
implementation using these amazing XML APIs I keep hearing so much about!)
#3 gets into what we put as the targetNamespace in the XSD. To make these equivalent, we can also go to the step of creating an XSLT that allows one to simply transform between the XMLNS. This particular XSLT would be trivial to create, but violates the equivalence spirit. Perhaps we should relax the statement to articulate that the two are wire compatible with respect to JSON, simple transformation compatible with respect to XML/Atom? I think this is an appropriate compromise as it recognizes that the two groups evolve at a different pace and have related but separate concerns.
From: portable...@googlegroups.com
[mailto:portable...@googlegroups.com] On Behalf Of Joseph Smarr
Sent: Saturday, January 03, 2009 7:42 AM
To: portable...@googlegroups.com
Subject: Re: PortableContacts schema XML namespace
Ok, how's this for a proposal:
Again—it depends on how compatible they need to be. Do they need to be XML Infoset compatible or do they simply need to be structurally similar with identical Local Names on all common representations? When this was brought up earlier on the OpenSocial list, we chose to take the latter approach (http://groups.google.com/group/opensocial-and-gadgets-spec/browse_thread/thread/27a2f9d86d55b33b).
Does Infoset compatibility help things or is structure/node name compatibility sufficient? In JavaScript, node name compatibility is good enough. The same is roughly true for .NET, Java, and other parsers. This only becomes an issue when validating the structure, and most work I’ve done with XML outside of automated serializers avoids validation when possible, treating the XSD as documentation instead of a hard requirement.
I'm not sure what this impacts from an implementation standpoint -- most
XML libraries I've dealt with have been namespace-sensitive, but I only
really deal in languages where folks would use JSON anyway -- but having
two namespaces for the same schema just seems needlessly confusing.
If OpenSocial already has the elements in a different namespace, then we
should just adopt that namespace for PortableContacts. The URI used for
the namespace is not important.
From an implementation standpoint, elements in different namespaces that
happen to have the same local name are *not* the same. Using e.g. libxml, it
is as easy to search for a fully-qualified element name as it is to search for
a given local name. I would expect new applications to be namespace-aware.
For example, there are many extensions to WebDAV and each has its own
namespace. Tags from different namespaces are frequently mixed in WebDAV
queries and responses. It is important for WebDAV applications to be
namespace-aware. (Mine are!)
Therefore, I would argue for the two schemas to describe elements in a single
standard namespace.
Furthermore, why would it be wrong if two completely separate schemas
described the same set of elements? It is common to do so with e.g. an XML
Schema schema and a Relax NG schema, one language patching the holes in the
other. Even adding Schematron in the mix is common. You end up with multiple
documents describing the same thing, which is far from being a bug.
Cheers,
Simon
--
Please try Numb, a STUN/TURN server implementation.
Free access at http://numb.viagenie.ca/.