Requirements for the syntax:
<person rdf:instance="uuid:...">
<name>
<firstname>Poo</firstname>
<lastname>Strawman</lastname>
</name>
<birthday>1999-05-24</birthday>
<address>
<city>Boston</city>
<street>Who knows</street>
</address>
</person>
The RDF model of the example is:
Tag interpretation does not switch back and forth between class name and property name. Instead, RDF processor can determine in a context-free fashion that the tag name is a class iff it carries rdf:instance. In all other cases, tag name denotes a property.
Complete parsing algorithmDefinition: The function "URI getUniqueURI(Element el)" is a one-to-one function that returns a unique URI for a given XML element (relative to the URI of the document). The function could be based on the XPath specs.Definition: The function "Resource getSubject(Element el)" is defined as follows:
Definition: The function "RDFNode getObject(Element el)" is defined as follows:
void generateRDF(Element el) {
if hasRDFInstanceAtt(el) {
createTriple( valueOfRDFInstanceAtt(el), rdf:type, el.getTagName() ); // ***
} else { // has no rdf:instance
if hasRDFForAtt(el)
subject = valueOfRDFForAtt(el);
else
subject = getSubject(el.getParent());
createTriple( subject, el, getObject(el) );
}
for every ch in children(el)
generateRDF(ch);
}
***: do not explicitly generate triples of the kind (subject, rdf:type, rdfs:Resource)
FIXME: shoud we prohibit that both child and parent have rdf:instance?
is equivalent to
<rdfs:Resource rdf:instance="http://www.w3.org/Home/Lassila">
<Creator>Ora Lassila</Creator>
</rdfs:Resource>
To mix RDF with XML the parser needs a clue wrt whether the XML elements under consideration are RDF-transparent or should be evaluated as RDF. It would be helpful to have a mechanism for the parser to make this distinction based on the namespace of the element (I'm tempted to say something like "rdfns:dc=..." albeit I'm aware of the problems of this approach).
If there is such mechanism, the above algorithm can be modified to "see through" all non-RDF tags (we are talking about hints for the parser, so what about (mis)using processing instructions for that purpose a la <?rdfns http://... ?rdfns>).
Example:
<t:WebPage xmlns="<HTML namespace>" xmlns:rdf="..." xmlns:t="..." xmlns:dc="..."
rdf:instance="<URL of this page>">
<html>
<head>
<title>
<dc:Title>My homepage</dc:Title>
</title>
</head>
<h1>...</h1>
...
<p/><hr/>
Last modified by: <dc:Creator>Me</dc:Creator>
</html>
</t:WebPage>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3