You are viewing a plain text version of this content. The canonical link for it is here.
Posted to triplesoup-commits@incubator.apache.org by le...@apache.org on 2007/04/13 08:56:16 UTC
svn commit: r528394 [28/35] - in
/incubator/triplesoup/donations/TRIPLES-3-RDFStore: ./ dbms/ dbms/client/
dbms/client/t/ dbms/dbmsproxy/ dbms/deamon/ dbms/doc/ dbms/include/
dbms/libdbms/ dbms/utils/ doc/ include/ lib/ lib/DBD/ lib/RDFStore/
lib/RDFSt...
Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/samples/xslt/rdfExtractify.xsl
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/samples/xslt/rdfExtractify.xsl?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/samples/xslt/rdfExtractify.xsl (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/samples/xslt/rdfExtractify.xsl Fri Apr 13 01:56:01 2007
@@ -0,0 +1,1250 @@
+<?xml version="1.0" ?>
+<!--
+ http://www.openhealth.org/RDF/extract/rdfExtractity.xsl
+ Copyright (c) 2000 Jonathan Borden, The Open Healthcare Group and GroveLogic, LLC. all rights reserved
+ licensed under the Open Health Community License http://www.openhealth.org/license
+
+ Version 2000-09-20
+
+ * Implements RDF 'extraction' from RDF into <rdf:Statement>s
+ - default rdf:parseType = 'Resource'
+ * When this is run on its output, implements reification
+ * Implements XLink2RDF conversion - this version includes extended links
+
+ This version incorporates (xsl:include-s) Jason Diamond's <ja...@injektilo.org> rdf.xsl parser
+ - (excellent code!!)
+ - modified to implement 'alternative' RDF serialization syntax
+ - outputs rdf:Statement's
+ - handles bagID
+ - allows arbitrary elements as children of containers
+ Includes also from Dan Connolly's rdfp.xsl
+
+ link2rdf.xsl includes XLink - > RDF implementation
+
+ Parameters:
+ trace - when present inserts trace info into output stream
+ explicitPathIndices = 'ChildSeq' (default) when null, attribute values id generated xpointer()
+ defaultParseType = 'Resource' alternative 'Literal' any other gives M&S1.0 behavior
+
+-->
+<!-- jonathan@openhealth.org -->
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY alt-minimum-one-member "Alts need at least one member">
+<!ENTITY container-member-attributes-vs-elements "containers with member attributes cannot have elements">
+]>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:rdfx="http://www.openhealth.org/RDF/extract#"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:saxon="http://icl.com/saxon"
+>
+ <!--
+ exclude-result-prefixes='xsl rdfx xlink saxon'
+ -->
+ <!--exclude-result-prefixes='xsl rdf rdfs rdfx xlink saxon' by AR 2000/09/25 -->
+
+<xsl:output method="xml" indent="yes"/>
+ <xsl:variable name='rdfNS' select='"http://www.w3.org/1999/02/22-rdf-syntax-ns#"'/>
+ <xsl:variable name='rdfsNS' select='"http://www.w3.org/2000/01/rdf-schema#"'/>
+ <xsl:variable name='xlinkNS' select='"http://www.w3.org/1999/xlink"'/>
+ <xsl:variable name='uriReferenceType' select='"http://www.w3.org/1999/XMLSchema#datatype_uriReference"'/>
+ <xsl:variable name='stringType' select='"http://www.w3.org/1999/XMLSchema#datatype_string"'/>
+ <xsl:variable name="rdfsLiteralType" select='concat($rdfsNS,"Literal")'/>
+ <xsl:variable name="rdfsResourceType" select='concat($rdfsNS,"Resource")'/>
+ <xsl:variable name="xmlNS" select="'http://www.w3.org/XML/1998/namespace'" />
+ <xsl:variable name="rdfType" select="concat($rdfNS,'type')"/>
+ <xsl:variable name="rdfValue" select="concat($rdfNS,'value')"/>
+ <xsl:variable name="rdfsClass" select="concat($rdfsNS,'Class')"/>
+ <xsl:variable name="xlinkBase" select="'http://www.w3.org/1999/xlink/properties/linkbase'"/>
+
+<xsl:param name="explicitPathIndices" select="'ChildSeq'"/>
+<xsl:param name="trace" select="'true'" /><!-- select="'true'"-->
+<xsl:param name="QNameTrace"/><!-- select="'true'" -->
+<xsl:param name="defaultParseType" select="'Resource'"/><!-- -->
+<xsl:include href="rdf.xsl"/>
+<!--<xsl:include href="link2rdf.xsl"/>-->
+<!-- -->
+
+<xsl:template match="/rdf:RDF">
+<rdf:RDF>
+<xsl:if test="$trace">[TRACE /rdf:RDF]</xsl:if>
+ <xsl:apply-templates select="*" mode="objects"/>
+</rdf:RDF>
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="rdf:RDF">
+<rdf:RDF>
+<xsl:if test="$trace">[TRACE rdf:RDF]</xsl:if>
+ <xsl:apply-templates select="*" mode="objects"/>
+</rdf:RDF>
+</xsl:template>
+
+<!-- -->
+<!-- -->
+
+<xsl:template match="/*">
+<rdf:RDF>
+<xsl:if test="$trace">[TRACE /* (<xsl:value-of select="name()" />)]</xsl:if>
+ <xsl:apply-templates select="." mode="objects"/>
+</rdf:RDF>
+</xsl:template>
+
+<!-- -->
+<xsl:template match="rdf:Description" mode="objects">
+<xsl:if test="$trace">[TRACE rdf:Description]</xsl:if>
+ <xsl:call-template name="generate-description-statements"/>
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="rdf:Description[@about or @rdf:about]" mode="objects">
+<xsl:if test="$trace">[TRACE rdf:Description[@about] ]</xsl:if>
+ <xsl:call-template name="generate-description-statements"/>
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="*[@rdf:about]" mode="objects">
+<xsl:if test="$trace">[TRACE *[@rdf:about] (<xsl:value-of select="name()" />) ]</xsl:if>
+ <xsl:call-template name="generate-type-statement">
+ <xsl:with-param name="subject" select="@rdf:about"/>
+ <xsl:with-param name="type"><xsl:call-template name="QNameToURI" /></xsl:with-param><!-- select="concat(namespace-uri(), local-name())"/>-->
+ </xsl:call-template>
+ <xsl:call-template name="generate-statements"/>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="*" mode="objects">
+ <xsl:param name="parse-type" select="$defaultParseType"/>
+<xsl:if test="$trace">[TRACE * (<xsl:value-of select="name()" />) ]</xsl:if>
+ <xsl:if test="$parse-type='Resource'">
+ <xsl:call-template name="generate-type-statement">
+ <xsl:with-param name="subject"><xsl:call-template name="nodeIdentifier"/></xsl:with-param>
+ <xsl:with-param name="type"><xsl:call-template name="QNameToURI" /></xsl:with-param><!-- select="concat(namespace-uri(), local-name())"/>-->
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:call-template name="generate-statements"/>
+
+</xsl:template>
+<!-- -->
+
+<xsl:template match="rdf:Description[@rdf:aboutEach]" mode="objects">
+<xsl:if test="$trace">[TRACE rdf:Description[@rdf:aboutEach] ]</xsl:if>
+<xsl:call-template name="generate-statements-about-each">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="about-each" select="@rdf:aboutEach"/>
+</xsl:call-template>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="*[@rdf:aboutEach]" mode="objects">
+<xsl:if test="$trace">[TRACE *[@rdf:aboutEach] <xsl:value-of select="name()" />]</xsl:if>
+<xsl:call-template name="generate-statements-about-each">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="about-each" select="@rdf:aboutEach"/>
+ <xsl:with-param name="type"><xsl:call-template name="QNameToURI" /></xsl:with-param><!-- select="concat(namespace-uri(), local-name())"/> -->
+</xsl:call-template>
+
+</xsl:template>
+
+
+<!-- -->
+
+<xsl:template match="rdf:Bag | rdf:Seq | rdf:Alt" mode="objects">
+<xsl:if test="$trace">[TRACE container <xsl:value-of select="name()" /> ]</xsl:if>
+<xsl:variable name="subject">
+ <xsl:call-template name="container-uri">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+</xsl:variable>
+
+<xsl:call-template name="generate-type-statement">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="type"><xsl:call-template name="QNameToURI" /></xsl:with-param>
+</xsl:call-template>
+
+<!-- make sure Alts have at least one member -->
+<!--<xsl:if test="local-name() = 'Alt' and count(rdf:li) = 0">
+ <xsl:message terminate="yes">&alt-minimum-one-member;</xsl:message>
+</xsl:if>-->
+<!-- jab rdf syntax -->
+<xsl:if test="local-name() = 'Alt' and count(*) = 0">
+ <xsl:message terminate="yes">&alt-minimum-one-member;</xsl:message>
+</xsl:if>
+
+
+<!-- make sure there are not both member attributes and elements -->
+<xsl:choose>
+ <xsl:when test="@rdf:*[starts-with(local-name(), '_')]">
+ <xsl:choose>
+ <xsl:when test="*">
+ <xsl:message terminate="yes">&container-member-attributes-vs-elements;</xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="@rdf:*" mode="member-attributes">
+ <xsl:with-param name="subject" select="$subject"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- jab rdf syntax <xsl:apply-templates select="rdf:li" mode="members">-->
+ <xsl:apply-templates select="*" mode="members">
+ <xsl:with-param name="container" select="$subject"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+</xsl:choose>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="@*" mode="property-attributes">
+ <xsl:param name="subject"/>
+ <xsl:variable name="attribute-namespace-uri" select="namespace-uri()"/>
+<xsl:if test="$trace">[TRACE @* <xsl:value-of select="name()" /> property-attributes]</xsl:if>
+ <xsl:if test="($attribute-namespace-uri != $rdfNS) and ($attribute-namespace-uri != $xmlNS) and ($attribute-namespace-uri != $xlinkNS)">
+ <xsl:if test="($attribute-namespace-uri != '') or ((local-name() != 'about') and (local-name() != 'ID') and (local-name() != 'bagID') and (local-name() != 'aboutEach'))">
+ <xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate-namespace-uri" select="$attribute-namespace-uri"/>
+ <xsl:with-param name="predicate-local-name" select="local-name()"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ <xsl:with-param name="object" select="."/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+</xsl:template>
+<!-- ************************************************************************** -->
+<!-- -->
+<xsl:template match="*" mode="property-elements">
+ <xsl:param name="subject"><xsl:call-template name="nodeIdentifier"/></xsl:param>
+<xsl:if test="$trace">[TRACE * name=<xsl:value-of select="name()" /> property-elements]</xsl:if>
+ <xsl:call-template name="generate-for-default-parse-type">
+ <xsl:with-param name="subject" select="$subject"/>
+ </xsl:call-template>
+</xsl:template>
+<!-- ************************************************************************** -->
+<!-- -->
+<xsl:template match="*[@rdf:*]" mode="property-elements">
+<xsl:if test="$trace">[TRACE *[@rdf:*] name=<xsl:value-of select="name()" />]</xsl:if>
+</xsl:template>
+<!-- -->
+<xsl:template match="*[@*]" mode="property-elements">
+ <xsl:param name="subject"><xsl:call-template name="nodeIdentifier"/></xsl:param>
+<xsl:if test="$trace">[TRACE *[@*] name=<xsl:value-of select="name()" /> property-elements]</xsl:if>
+ <xsl:call-template name="generate-for-default-parse-type">
+ <xsl:with-param name="subject" select="$subject"/>
+ </xsl:call-template>
+</xsl:template>
+<!-- ************************************************************************** -->
+<xsl:template match="rdf:*[@rdf:*]" mode="property-elements">
+<xsl:if test="$trace">
+[TRACE rdf:*[@rdf:*] name=<xsl:value-of select="name()" />]
+(<xsl:for-each select="attribute::rdf:*"><xsl:value-of select="name()" />=<xsl:value-of select="." />,</xsl:for-each>)
+</xsl:if>
+</xsl:template>
+<!-- -->
+<xsl:template match="rdf:*[@*]" mode="property-elements">
+ <xsl:param name="subject"><xsl:call-template name="nodeIdentifier"/></xsl:param>
+<xsl:if test="$trace">[TRACE rdf:*[@*] name=<xsl:value-of select="name()" /> property-elements]</xsl:if>
+ <xsl:call-template name="generate-for-default-parse-type">
+ <xsl:with-param name="subject" select="$subject"/>
+ </xsl:call-template>
+</xsl:template>
+<!-- -->
+<!-- jab set parse-type for children -->
+<xsl:template match="rdf:*[@resource]" mode="property-elements">
+ <xsl:param name="subject"/>
+<xsl:if test="$trace">[TRACE rdf:*[@resource] name=<xsl:value-of select="name()" /> property-elements]</xsl:if>
+<xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate-namespace-uri" select="namespace-uri()"/>
+ <xsl:with-param name="predicate-local-name" select="local-name()"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ <xsl:with-param name="object" select="@resource"/>
+</xsl:call-template>
+
+<xsl:apply-templates select="." mode="objects">
+ <xsl:with-param name="parse-type" select="'RDF1.0-base'"/>
+</xsl:apply-templates>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="rdf:*[@rdf:resource]" mode="property-elements">
+ <xsl:param name="subject"/>
+<xsl:if test="$trace">[TRACE rdf:*[@rdf:resource] property-elements]</xsl:if>
+<xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate-namespace-uri" select="namespace-uri()"/>
+ <xsl:with-param name="predicate-local-name" select="local-name()"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ <xsl:with-param name="object" select="@rdf:resource"/>
+</xsl:call-template>
+
+<xsl:apply-templates select="." mode="objects">
+ <xsl:with-param name="parse-type" select="'RDF1.0-base'"/>
+</xsl:apply-templates>
+
+</xsl:template>
+
+<!-- jab -->
+<xsl:template match="*[@rdf:type]" mode="property-elements">
+ <xsl:param name="subject"><xsl:call-template name="nodeIdentifier"/></xsl:param>
+<xsl:if test="$trace">[TRACE *[@rdf:type] name=<xsl:value-of select="name()" /> property-elements]</xsl:if>
+ <xsl:call-template name="generate-for-default-parse-type">
+ <xsl:with-param name="subject" select="$subject"/>
+ </xsl:call-template>
+</xsl:template>
+<!-- ************************************************************************** -->
+<xsl:template name="generate-for-default-parse-type">
+ <xsl:param name="subject"><xsl:call-template name="nodeIdentifier" /></xsl:param>
+ <xsl:param name="parse-type" select="$defaultParseType"/>
+ <xsl:param name="type">
+ <xsl:choose>
+ <xsl:when test="@rdf:type"><xsl:value-of select="@rdf:type" /></xsl:when>
+ <xsl:when test="rdf:type[@rdf:resource]"><xsl:value-of select="rdf:type/@rdf:resource" /></xsl:when>
+ <xsl:when test="rdf:type"><xsl:value-of select="rdf:type" /></xsl:when>
+ <xsl:otherwise><xsl:call-template name="QNameToURI" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+
+
+<xsl:choose>
+ <xsl:when test="$parse-type='Resource'">
+<xsl:variable name="object">
+ <xsl:choose>
+ <xsl:when test="@rdf:resource"><xsl:value-of select="@rdf:resource" /></xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="resource-uri">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate-namespace-uri" select="namespace-uri()"/>
+ <xsl:with-param name="predicate-local-name" select="local-name()"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ <xsl:with-param name="object" select="$object"/>
+</xsl:call-template>
+<xsl:call-template name="generate-type-statement">
+ <xsl:with-param name="subject"><xsl:call-template name="nodeIdentifier"/></xsl:with-param>
+ <xsl:with-param name="type" select="$type" /><!-- select="concat(namespace-uri(), local-name())"/>-->
+</xsl:call-template>
+<xsl:call-template name="generate-statements">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="subject" select="$object"/>
+</xsl:call-template>
+
+ </xsl:when>
+ <xsl:when test="$parse-type='Literal'">
+<xsl:call-template name="statement">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate" select="$type" />
+ <xsl:with-param name="object-type" select="'literal'"/>
+ <xsl:with-param name="object" select="*|text()"/>
+</xsl:call-template>
+
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate-namespace-uri" select="namespace-uri()"/>
+ <xsl:with-param name="predicate-local-name" select="local-name()"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ <xsl:with-param name="object" select="."/>
+ </xsl:call-template>
+ </xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="*[@rdf:parseType='Literal']" mode="property-elements">
+ <xsl:param name="subject" />
+ <xsl:param name="type">
+ <xsl:choose>
+ <xsl:when test="@rdf:type"><xsl:value-of select="@rdf:type" /></xsl:when>
+ <xsl:when test="rdf:type[@rdf:resource]"><xsl:value-of select="rdf:type/@rdf:resource" /></xsl:when>
+ <xsl:when test="rdf:type"><xsl:value-of select="rdf:type" /></xsl:when>
+ <xsl:otherwise><xsl:call-template name="QNameToURI" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+
+<xsl:call-template name="statement">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate"><xsl:call-template name="QNameToURI"/></xsl:with-param>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ <xsl:with-param name="object" select="*|text()"/>
+</xsl:call-template>
+
+<xsl:call-template name="generate-type-statement">
+ <xsl:with-param name="subject"><xsl:call-template name="nodeIdentifier"/></xsl:with-param>
+ <xsl:with-param name="type" select="$type"/><!-- select="concat(namespace-uri(), local-name())"/>-->
+</xsl:call-template>
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="*[@rdf:parseType='Resource']" mode="property-elements">
+ <xsl:param name="subject" />
+ <xsl:param name="type">
+ <xsl:choose>
+ <xsl:when test="@rdf:type"><xsl:value-of select="@rdf:type" /></xsl:when>
+ <xsl:when test="rdf:type[@rdf:resource]"><xsl:value-of select="rdf:type/@rdf:resource" /></xsl:when>
+ <xsl:when test="rdf:type"><xsl:value-of select="rdf:type" /></xsl:when>
+ <xsl:otherwise><xsl:call-template name="QNameToURI" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+
+<xsl:if test="$trace">[TRACE *[@rdf:parseType='Resource'] name=<xsl:value-of select="name()" />]</xsl:if>
+<xsl:variable name="object">
+ <xsl:choose>
+ <!-- jab -->
+ <xsl:when test="@rdf:resource"><xsl:value-of select="@rdf:resource" /></xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="resource-uri">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate-namespace-uri" select="namespace-uri()"/>
+ <xsl:with-param name="predicate-local-name" select="local-name()"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ <xsl:with-param name="object" select="$object"/>
+</xsl:call-template>
+<xsl:call-template name="generate-type-statement">
+ <xsl:with-param name="subject"><xsl:call-template name="nodeIdentifier"/></xsl:with-param>
+ <xsl:with-param name="type" select="$type" /><!-- select="concat(namespace-uri(), local-name())"/>-->
+</xsl:call-template>
+<xsl:call-template name="generate-statements">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="subject" select="$object"/>
+</xsl:call-template>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="*[@xlink:arcrole='http://www.w3.org/1999/xlink/properties/linkbase']" mode="property-elements">
+ <xsl:apply-templates select="document(@xlink:href)/*[@xlink:type]" mode="property-elements"/>
+</xsl:template>
+
+<xsl:template match="*[@xlink:type='simple']" mode="property-elements">
+ <xsl:call-template name="xlink-simple"/>
+</xsl:template>
+
+<xsl:template match="*[@xlink:type='extended']" mode="property-elements">
+ <xsl:apply-templates select="*" mode="xlink-extended"/>
+</xsl:template>
+
+<!-- -->
+<!-- jab this is an optimization for special elements which don't need to be a node -->
+<!-- not needed for XML2RDF ? is skipping leaf nodes #type
+<xsl:template match="*[not(*) and not(@*)]" mode="property-elements">
+ <xsl:param name="subject" />
+<xsl:if test="$trace">[TRACE *[not(*) and not(@*)] name=<xsl:value-of select="name()" />]</xsl:if>
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate"><xsl:call-template name="QNameToURI"/></xsl:with-param>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="text()"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ </xsl:call-template>
+</xsl:template>
+-->
+<!-- -->
+<xsl:template match="*[@rdf:value and not(*) and (count(@*)=1) and text()[string-length(normalize-space())=0]]" mode="property-elements">
+ <xsl:param name="subject" />
+<xsl:if test="$trace">[TRACE *[@rdf:value and not(*) and count(@*)=1] name=<xsl:value-of select="name()" />]</xsl:if>
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate"><xsl:call-template name="QNameToURI"/></xsl:with-param>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="@rdf:value"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ </xsl:call-template>
+</xsl:template>
+<!-- *********************************************************************** -->
+<!-- jab alt syntax -->
+<!-- -->
+
+<xsl:template match="*[@resource]" mode="members">
+ <xsl:param name="container"/>
+<xsl:if test="$trace">[TRACE *[@resource] <xsl:value-of select="name()" /> members]</xsl:if>
+<xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$container"/>
+ <xsl:with-param name="predicate-namespace-uri" select="$rdf"/>
+ <xsl:with-param name="predicate-local-name" select="concat('_', position())"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ <xsl:with-param name="object" select="@resource"/>
+</xsl:call-template>
+
+</xsl:template>
+
+<!-- -->
+
+<!-- this is mostly a copy of the previous template with the resource
+attribute explicitly in the rdf namespace. this isn't legal according to the
+spec but it probably should be. -->
+
+<xsl:template match="*[@rdf:resource]" mode="members">
+ <xsl:param name="container"/>
+<xsl:if test="$trace">[TRACE *[@rdf:resource] <xsl:value-of select="name()" /> members]</xsl:if>
+<xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$container"/>
+ <xsl:with-param name="predicate-namespace-uri" select="$rdf"/>
+ <xsl:with-param name="predicate-local-name" select="concat('_', position())"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ <xsl:with-param name="object" select="@rdf:resource"/>
+</xsl:call-template>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="*" mode="members">
+ <xsl:param name="container"/>
+<xsl:if test="$trace">[TRACE * <xsl:value-of select="name()" /> members]</xsl:if>
+<xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$container"/>
+ <xsl:with-param name="predicate-namespace-uri" select="$rdf"/>
+ <xsl:with-param name="predicate-local-name" select="concat('_', position())"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ <xsl:with-param name="object" select="."/>
+</xsl:call-template>
+
+</xsl:template>
+<!-- -->
+
+<xsl:template match="*[*]" mode="members">
+ <xsl:param name="container"/>
+<xsl:if test="$trace">[TRACE *[*] <xsl:value-of select="name()" /> members]</xsl:if>
+ <xsl:variable name="object"><xsl:call-template name="nodeIdentifier"/></xsl:variable>
+ <xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$container"/>
+ <xsl:with-param name="predicate-namespace-uri" select="$rdf"/>
+ <xsl:with-param name="predicate-local-name" select="concat('_', position())"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ <xsl:with-param name="object" select="$object"/>
+ </xsl:call-template>
+ <xsl:call-template name="generate-type-statement">
+ <xsl:with-param name="subject" select="$object" />
+ <xsl:with-param name="type"><xsl:call-template name="QNameToURI" /></xsl:with-param>
+ </xsl:call-template>
+ <xsl:apply-templates select="*" mode="property-elements">
+ <xsl:with-param name="subject" select="$object"/>
+ </xsl:apply-templates>
+</xsl:template>
+<!-- -->
+
+<xsl:template match="*[@*]" mode="members">
+ <xsl:param name="container"/>
+<xsl:if test="$trace">[TRACE *[@*] <xsl:value-of select="name()" /> members]</xsl:if>
+ <xsl:variable name="object"><xsl:call-template name="nodeIdentifier"/></xsl:variable>
+ <xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$container"/>
+ <xsl:with-param name="predicate-namespace-uri" select="$rdf"/>
+ <xsl:with-param name="predicate-local-name" select="concat('_', position())"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ <xsl:with-param name="object" select="$object"/>
+ </xsl:call-template>
+ <xsl:call-template name="generate-type-statement">
+ <xsl:with-param name="subject" select="$object" />
+ <xsl:with-param name="type"><xsl:call-template name="QNameToURI" /></xsl:with-param>
+ </xsl:call-template>
+ <xsl:apply-templates select="@*" mode="property-attributes">
+ <xsl:with-param name="subject" select="$object"/>
+ </xsl:apply-templates>
+</xsl:template>
+
+<!-- -->
+
+<xsl:template match="rdf:li" mode="members">
+ <xsl:param name="container"/>
+<xsl:if test="$trace">[TRACE rdf:li members]</xsl:if>
+<xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$container"/>
+ <xsl:with-param name="predicate-namespace-uri" select="$rdf"/>
+ <xsl:with-param name="predicate-local-name" select="concat('_', position())"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ <xsl:with-param name="object" select="."/>
+</xsl:call-template>
+</xsl:template>
+<!-- -->
+
+<xsl:template match="rdf:li[@*]" mode="members">
+ <xsl:param name="container"/>
+<xsl:if test="$trace">[TRACE rdf:li[@*] <xsl:value-of select="name()" /> members]</xsl:if>
+ <xsl:variable name="object"><xsl:call-template name="nodeIdentifier"/></xsl:variable>
+ <xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$container"/>
+ <xsl:with-param name="predicate-namespace-uri" select="$rdf"/>
+ <xsl:with-param name="predicate-local-name" select="concat('_', position())"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ <xsl:with-param name="object" select="$object"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="@*" mode="property-attributes">
+ <xsl:with-param name="subject" select="$object"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="." mode="property-elements">
+ <xsl:with-param name="subject" select="$container"/>
+ </xsl:apply-templates>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template name="resource-uri">
+ <xsl:param name="node" select="."/>
+
+<xsl:choose>
+ <xsl:when test="namespace-uri($node) = $rdf and $node/@about">
+ <xsl:value-of select="$node/@about"/>
+ </xsl:when>
+ <xsl:when test="$node/@rdf:about">
+ <xsl:value-of select="$node/@rdf:about"/>
+ </xsl:when>
+ <xsl:when test="namespace-uri($node) = $rdf and $node/@resource">
+ <xsl:value-of select="$node/@resource"/>
+ </xsl:when>
+ <xsl:when test="namespace-uri($node) != $rdf and $node/@rdf:resource">
+ <xsl:value-of select="$node/@rdf:resource"/>
+ </xsl:when>
+ <!--<xsl:when test="namespace-uri($node) != $rdf and $node/@rdf:about">
+ <xsl:value-of select="$node/@rdf:about"/>
+ </xsl:when>-->
+ <xsl:when test="$node/@ID">
+ <xsl:value-of select="concat('#', $node/@ID)"/>
+ </xsl:when>
+ <xsl:when test="$node/@rdf:ID">
+ <xsl:value-of select="concat('#', $node/@rdf:ID)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="nodeIdentifier">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ <!--<xsl:call-template name="anonymous-uri">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>-->
+ </xsl:otherwise>
+</xsl:choose>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template name="container-uri">
+ <xsl:param name="node" select="."/>
+
+<xsl:choose>
+ <xsl:when test="namespace-uri($node) = $rdf and $node/@ID">
+ <xsl:value-of select="concat('#', $node/@ID)"/>
+ </xsl:when>
+ <xsl:when test="namespace-uri($node) != $rdf and $node/@rdf:ID">
+ <xsl:value-of select="concat('#', $node/@rdf:ID)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="nodeIdentifier">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ <!--<xsl:call-template name="anonymous-uri">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>-->
+ </xsl:otherwise>
+</xsl:choose>
+
+</xsl:template>
+
+
+<!-- -->
+
+<xsl:template name="generate-statement-string">
+ <xsl:param name="subject"/>
+ <xsl:param name="predicate-namespace-uri"/>
+ <xsl:param name="predicate-local-name"/>
+ <xsl:param name="object-type"/>
+ <xsl:param name="object"/>
+ <!--<xsl:variable name="otype">
+ <xsl:choose>
+ <xsl:when test="$object-type='literal'"><xsl:value-of select="$rdfsLiteralType" /></xsl:when>
+ <xsl:when test="$object-type='resource'"><xsl:value-of select="$rdfsResourceType" /></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$object-type" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>-->
+<xsl:if test="$trace">
+[TRACE gen-stat-string
+ pred(ns,loc)=<xsl:value-of select="$predicate-namespace-uri" />:<xsl:value-of select="$predicate-local-name" />
+]
+</xsl:if>
+<xsl:call-template name="statement">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate"><xsl:call-template name="QNameToURI"><xsl:with-param name="namespace-name" select="$predicate-namespace-uri"/><xsl:with-param name="local-name" select="$predicate-local-name"/></xsl:call-template></xsl:with-param>
+ <xsl:with-param name="object-type" select="$object-type"/>
+ <xsl:with-param name="object" select="string($object)"/>
+</xsl:call-template>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template name="generate-statement">
+ <xsl:param name="subject"/>
+ <xsl:param name="predicate-namespace-uri"/>
+ <xsl:param name="predicate-local-name"/>
+ <xsl:param name="object-type"/>
+ <xsl:param name="object"/>
+<xsl:if test="$trace">[TRACE gen-statement
+ name=<xsl:value-of select="name()" />
+ predicate=<xsl:value-of select="$predicate-namespace-uri" />:<xsl:value-of select="$predicate-local-name" />
+ subject=<xsl:value-of select="$subject" />
+ object=<xsl:value-of select="$object" />
+]</xsl:if>
+
+<xsl:call-template name="statement">
+ <xsl:with-param name="predicate"><xsl:call-template name="QNameToURI"><xsl:with-param name="namespace-name" select="$predicate-namespace-uri"/><xsl:with-param name="local-name" select="$predicate-local-name"/></xsl:call-template></xsl:with-param><!--<xsl:value-of select="concat($predicate-namespace-uri, $predicate-local-name)"/>-->
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="$object"/>
+ <xsl:with-param name="object-type" select="$object-type"/>
+ </xsl:call-template>
+</xsl:template>
+<!-- ******************************************************************* -->
+<xsl:template name="statement">
+ <xsl:param name="subject"/>
+ <xsl:param name="predicate"/>
+ <xsl:param name="object-type"/>
+ <xsl:param name="object"/>
+
+<rdf:Statement>
+ <rdf:predicate rdf:resource="{$predicate}" />
+ <rdf:subject rdf:resource="{$subject}"/>
+ <xsl:choose>
+ <xsl:when test="$object-type='literal'">
+ <rdf:object><xsl:copy-of select="$object"/></rdf:object>
+ </xsl:when>
+ <xsl:when test="$object-type='resource'">
+ <rdf:object rdf:resource="{$object}" />
+ </xsl:when>
+ </xsl:choose>
+</rdf:Statement>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template name="generate-description-statements">
+
+ <xsl:param name="node" select="."/>
+ <xsl:param name="subject">
+ <xsl:call-template name="resource-uri">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ </xsl:param>
+<xsl:if test="$trace">[TRACE gen-description-statements
+ node=<xsl:value-of select="name($node)" />
+ subject=<xsl:value-of select="$subject" />
+]</xsl:if>
+ <xsl:variable name="reified-statement"><xsl:value-of select="$node/@bagID"/></xsl:variable>
+
+ <xsl:apply-templates select="$node/@*" mode="property-attributes">
+ <xsl:with-param name="subject" select="$subject"/>
+ </xsl:apply-templates>
+
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($reified-statement))>0">
+ <rdf:Bag ID="{$reified-statement}">
+ <xsl:apply-templates select="$node/*" mode="property-elements">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="reified-statement" select="$reified-statement"/>
+ <xsl:with-param name="parse-type" select="'RDF1.0-base'"/>
+ </xsl:apply-templates>
+ </rdf:Bag>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$node/*" mode="property-elements">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="reified-statement" select="$reified-statement"/>
+ <xsl:with-param name="parse-type" select="'RDF1.0-base'"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+<xsl:if test="$trace">[-- gen-description-statments]</xsl:if>
+</xsl:template>
+<!-- -->
+
+<xsl:template name="generate-statements-about-each">
+ <xsl:param name="node"/>
+ <xsl:param name="about-each"/>
+ <xsl:param name="type"/>
+<xsl:variable name="id">
+ <xsl:choose>
+ <xsl:when test="starts-with($about-each, '#')">
+ <xsl:value-of select="substring-after($about-each, '#')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$about-each"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<!--<xsl:for-each select="//rdf:*[@ID=$id]/rdf:li">-->
+<!-- jab - alt syntax -->
+<xsl:for-each select="//rdf:*[@ID=$id]/*">
+ <xsl:variable name="res">
+ <xsl:choose>
+ <xsl:when test="@rdf:resource"><xsl:value-of select="@rdf:resource" /></xsl:when>
+ <xsl:when test="(namespace-uri()=$rdfNS) and (@resource)"><xsl:value-of select="@resource" /></xsl:when>
+ <xsl:otherwise><xsl:call-template name="nodeIdentifier"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$type">
+ <xsl:call-template name="generate-type-statement">
+ <xsl:with-param name="subject" select="$res"/>
+ <xsl:with-param name="type" select="$type"/>
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:call-template name="generate-statements">
+ <xsl:with-param name="node" select="$node"/>
+ <xsl:with-param name="subject" select="$res"/>
+ </xsl:call-template>
+
+</xsl:for-each>
+
+</xsl:template>
+
+<!-- -->
+
+<xsl:template name="generate-statements">
+
+ <xsl:param name="node" select="."/>
+ <xsl:param name="subject">
+ <xsl:call-template name="resource-uri">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ </xsl:param>
+<xsl:if test="$trace">
+[TRACE gen-statements
+ node=<xsl:value-of select="name($node)" />
+ subject=<xsl:value-of select="$subject" />
+]
+</xsl:if>
+<xsl:variable name="reified-statement">
+ <xsl:value-of select="$node/@bagID"/>
+</xsl:variable>
+
+<xsl:apply-templates select="$node/@*" mode="property-attributes">
+ <xsl:with-param name="subject" select="$subject"/>
+</xsl:apply-templates>
+
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($reified-statement))>0">
+ <rdf:Bag ID="{$reified-statement}">
+ <xsl:apply-templates select="$node/*" mode="property-elements">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="reified-statement" select="$reified-statement"/>
+ <xsl:with-param name="parse-type" select="'RDF1.0-base'"/>
+ </xsl:apply-templates>
+ </rdf:Bag>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$node/*" mode="property-elements">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="reified-statement" select="$reified-statement"/>
+ <xsl:with-param name="parse-type" select="$defaultParseType"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="$defaultParseType='Resource'">
+ <xsl:for-each select='text()[string-length(normalize-space())>0]'>
+ <xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate-namespace-uri" select="$rdf"/>
+ <xsl:with-param name="predicate-local-name" select="'value'"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ <xsl:with-param name="object" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ </xsl:choose>
+<xsl:if test="$trace">
+[-- gen-statements]
+</xsl:if>
+</xsl:template>
+<!-- *************************************************************************
+ XLink templates
+ ************************************************************************* -->
+ <!-- XLink 2 RDF here -->
+<!-- per http://www.w3.org/XML/2000/09/xlink2rdf.htm -->
+<!-- <xsl:param name="subject"/> -->
+
+
+<xsl:template name="xlink-simple">
+
+ <xsl:param name="subject"><xsl:call-template name="nodeIdentifier"/></xsl:param>
+ <xsl:variable name="object" select="@xlink:href"/>
+
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate">
+ <xsl:choose>
+ <xsl:when test="@xlink:arcrole"><xsl:value-of select="@xlink:arcrole" /></xsl:when>
+ <xsl:otherwise><xsl:call-template name="QNameToURI"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="@xlink:href"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ </xsl:call-template>
+ <xsl:if test="@xlink:role">
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="$rdfType"/>
+ <xsl:with-param name="subject" select="@xlink:href"/>
+ <xsl:with-param name="object" select="@xlink:role"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ </xsl:call-template>
+ <!--<rdf:Statement>
+ <rdf:predicate><xsl:value-of select="$rdfType" /></rdf:predicate>
+ <rdf:subject><xsl:value-of select="@xlink:href"/></rdf:subject>
+ <rdf:object rdf:type="{$rdfsResourceType}"><xsl:value-of select="@xlink:role" /></rdf:object>
+ </rdf:Statement>-->
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="$rdfType"/>
+ <xsl:with-param name="subject" select="@xlink:role"/>
+ <xsl:with-param name="object" select="$rdfsClass"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ </xsl:call-template>
+
+ </xsl:if>
+<!--
+<xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate-namespace-uri" select="namespace-uri()"/>
+ <xsl:with-param name="predicate-local-name" select="local-name()"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ <xsl:with-param name="object" select="$object"/>
+</xsl:call-template>
+-->
+
+<xsl:call-template name="generate-statements">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="subject" select="$object"/>
+</xsl:call-template>
+
+</xsl:template>
+<!-- this is special for linkbase processing -->
+<xsl:template match="*[(@xlink:type='simple') and not(../@xlink:type='extended')]" mode="xlink-extended">
+ <xsl:apply-templates select="." mode="property-elements"/>
+</xsl:template>
+<xsl:template match="*[@xlink:type='arc']" mode="xlink-extended">
+ <xsl:param name="predicate"><xsl:call-template name="get-predicate" /></xsl:param>
+ <xsl:variable name="base" select=".."/>
+ <xsl:variable name="from" select="@xlink:from"/>
+ <xsl:variable name="to" select="@xlink:to" />
+<xsl:if test="$trace">[TRACE xlink:type'arc' predicate=<xsl:value-of select="$predicate" />]</xsl:if>
+ <xsl:for-each select="$base/*[((@xlink:type='resource') or (@xlink:type='locator')) and (not($from) or (@xlink:label=$from))]">
+ <xsl:variable name="this-from" select="."/>
+ <xsl:variable name="subject"><xsl:call-template name="get-subject-object" /></xsl:variable>
+ <xsl:for-each select="$base/*[((@xlink:type='resource') or (@xlink:type='locator')) and (not($to) or (@xlink:label=$to))]">
+ <xsl:variable name="this-to" select="."/>
+ <xsl:variable name="object"><xsl:call-template name="get-subject-object"/></xsl:variable>
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="$predicate"/>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="$object"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ </xsl:call-template>
+
+
+ </xsl:for-each>
+ </xsl:for-each>
+</xsl:template>
+<xsl:template match="*[(@xlink:type='arc') and (@xlink:arcrole='http://www.w3.org/1999/xlink/properties/linkbase')]" mode="xlink-extended">
+<xsl:if test="$trace">[TRACE xlink arcrole=linkbase]</xsl:if>
+ <xsl:apply-templates select="document(@xlink:href)" mode="xlink-extended"/>
+</xsl:template>
+<xsl:template match="*[@xlink:type='locator']" mode="xlink-extended">
+ <xsl:variable name="subject" select="@xlink:href"/>
+ <xsl:variable name="object">
+ <xsl:choose>
+ <xsl:when test="@xlink:role"><xsl:value-of select="@xlink:role" /></xsl:when>
+ <xsl:otherwise><xsl:call-template name="QNameToURI" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="@xlink:role">
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="$rdfType"/>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="@xlink:role"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="$rdfType"/>
+ <xsl:with-param name="subject" select="@xlink:role"/>
+ <xsl:with-param name="object" select="$rdfsClass"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ </xsl:call-template>
+
+ </xsl:if>
+ <xsl:if test="@xlink:label">
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="concat($xlinkNS,'#','label')"/>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="@xlink:label"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ </xsl:call-template>
+
+ </xsl:if>
+ <xsl:if test="@xlink:title">
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="concat($xlinkNS,'#','title')"/>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="@xlink:title"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ </xsl:call-template>
+
+ </xsl:if>
+ <xsl:apply-templates select="*[@xlink:type='title']" mode="xlink-extended"/>
+ <xsl:call-template name="generate-statements-noxlink">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="subject" select="$object"/>
+ </xsl:call-template>
+
+</xsl:template>
+<xsl:template match="*[@xlink:type='resource']" mode="xlink-extended">
+ <xsl:variable name="subject"><xsl:call-template name="QNameToURI" /></xsl:variable>
+ <xsl:variable name="object">
+ <xsl:choose>
+ <xsl:when test="@xlink:role"><xsl:value-of select="@xlink:role" /></xsl:when>
+ <xsl:otherwise><xsl:call-template name="QNameToURI" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="@xlink:role">
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="$rdfType"/>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="@xlink:role"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ </xsl:call-template>
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="$rdfType"/>
+ <xsl:with-param name="subject" select="@xlink:role"/>
+ <xsl:with-param name="object" select="$rdfsClass"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="@xlink:label">
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="concat($xlinkNS,'#','label')"/>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="@xlink:label"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="@xlink:title">
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="concat($xlinkNS,'#','title')"/>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="@xlink:title"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:apply-templates select="*[@xlink:type='title']" mode="xlink-extended"/>
+
+ <xsl:call-template name="generate-statements-noxlink">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="subject" select="$object"/>
+ </xsl:call-template>
+
+</xsl:template>
+<xsl:template match="*[@xlink:type='title']" mode="xlink-extended">
+ <xsl:variable name="subject"><xsl:call-template name="QNameToURI"><xsl:with-param name="node" select=".." /></xsl:call-template></xsl:variable>
+ <xsl:variable name="object"><xsl:call-template name="QNameToURI"/></xsl:variable>
+<xsl:if test="$trace">[TRACE *[xlink:type='title']
+ subject=<xsl:value-of select="$subject" />:<xsl:value-of select="name(..)" />
+ object=<xsl:value-of select="$object" />
+]</xsl:if>
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="concat($xlinkNS,'#','title')"/>
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="object" select="$object"/>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ </xsl:call-template>
+
+ <xsl:choose>
+ <!-- if XML content then process -->
+ <xsl:when test="*">
+ <xsl:for-each select="*">
+ <xsl:if test="$trace">[TRACE "*" name=<xsl:value-of select="name()" />]</xsl:if>
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="$rdfValue"/>
+ <xsl:with-param name="subject" select="$object"/>
+ <xsl:with-param name="object"><xsl:call-template name="nodeIdentifier" /></xsl:with-param>
+ <xsl:with-param name="object-type" select="'resource'"/>
+ </xsl:call-template>
+
+
+ <xsl:apply-templates select="." mode="objects"/>
+ </xsl:for-each>
+ </xsl:when>
+ <!-- otherwise literal content set to rdf:value -->
+ <xsl:when test="text()[string-length(normalize-space())>0]">
+ <xsl:for-each select="text()[string-length(normalize-space())>0]">
+ <xsl:call-template name="statement">
+ <xsl:with-param name="predicate" select="$rdfValue"/>
+ <xsl:with-param name="subject" select="$object"/>
+ <xsl:with-param name="object" select="."/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ </xsl:call-template>
+
+ </xsl:for-each>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+<xsl:template name="get-predicate">
+<xsl:if test="$trace">
+[TRACE get-predicate
+ node=<xsl:value-of select="name()" />
+ arcrole=<xsl:value-of select="@xlink:arcrole" />
+]
+</xsl:if>
+ <xsl:choose>
+ <xsl:when test="@xlink:arcrole"><xsl:value-of select="@xlink:arcrole" /></xsl:when>
+ <xsl:otherwise><xsl:call-template name="QNameToURI"/></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+<xsl:template name="get-subject-object">
+ <xsl:choose>
+ <xsl:when test="@xlink:type='locator'"><xsl:value-of select="@xlink:href" /></xsl:when>
+ <xsl:when test="@xlink:type='resource'"><xsl:call-template name="QNameToURI"/></xsl:when>
+ <xsl:otherwise><error>Unknown xlink:type for subject or object</error></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+<!-- -->
+
+<xsl:template name="generate-statements-noxlink">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="subject">
+ <xsl:call-template name="resource-uri">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ </xsl:param>
+<xsl:if test="$trace">[TRACE gen-stat-noxlink
+ subject=<xsl:value-of select="$subject" />
+]</xsl:if>
+<xsl:variable name="reified-statement">
+ <xsl:value-of select="$node/@bagID"/>
+</xsl:variable>
+
+<xsl:apply-templates select="$node/@*" mode="property-attributes">
+ <xsl:with-param name="subject" select="$subject"/>
+</xsl:apply-templates>
+
+<xsl:apply-templates select="$node/*[not(@xlink:*)]" mode="property-elements">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="reified-statement" select="$reified-statement"/>
+</xsl:apply-templates>
+ <xsl:choose>
+ <xsl:when test="$defaultParseType='Resource'">
+ <xsl:for-each select='text()[string-length(normalize-space())>0]'>
+ <xsl:call-template name="generate-statement-string">
+ <xsl:with-param name="subject" select="$subject"/>
+ <xsl:with-param name="predicate-namespace-uri" select="$rdf"/>
+ <xsl:with-param name="predicate-local-name" select="'value'"/>
+ <xsl:with-param name="object-type" select="'literal'"/>
+ <xsl:with-param name="object" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<!-- *************************************************************************
+ Function templates
+ ************************************************************************* -->
+<xsl:template name="childSeq">
+ <xsl:param name="node" select="."/>
+ <xsl:for-each select="$node/ancestor-or-self::*">/<xsl:value-of select="1 + count(preceding-sibling::*)"/></xsl:for-each>
+</xsl:template>
+<!-- -->
+<xsl:template name="nodeIdentifier">
+ <xsl:param name="node" select="."/>
+ <xsl:choose>
+ <!--<xsl:when test="@rdf:instance"><xsl:value-of select="@rdf:instance" /></xsl:when>-->
+ <xsl:when test="$node/@rdf:resource"><xsl:value-of select="$node/@rdf:resource" /></xsl:when>
+ <xsl:when test="$node/@ID">#<xsl:value-of select="$node/@ID" /></xsl:when>
+ <xsl:when test="$node/@rdf:ID">#<xsl:value-of select="$node/@rdf:ID" /></xsl:when>
+ <xsl:when test="$explicitPathIndices='ChildSeq'">#<xsl:call-template name="childSeq" ><xsl:with-param name="node" select="$node"/></xsl:call-template></xsl:when>
+ <xsl:otherwise>#xpointer(<xsl:call-template name="pathName" ><xsl:with-param name="node" select="$node"/></xsl:call-template>)</xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+<!-- -->
+<xsl:template name="QNameToURI">
+ <xsl:param name="sep" select="'#'"/>
+ <xsl:param name="node" select="."/>
+ <xsl:param name="namespace-name" select="namespace-uri($node)"/>
+ <xsl:param name="local-name" select="local-name($node)"/>
+ <xsl:variable name="nslen" select="string-length($namespace-name)"/>
+ <xsl:variable name="base">
+ <xsl:choose>
+ <xsl:when test="$nslen > 0"></xsl:when>
+ <xsl:when test="$node/ancestor-or-self::*/@xml:base"><xsl:value-of select="$node/ancestor-or-self::*/@xml:base" /></xsl:when>
+<!--
+ <xsl:when test="function-available('saxon:system-id')"><xsl:value-of select="saxon:system-id()" /></xsl:when>
+-->
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="lastNSChar" select="substring($namespace-name,$nslen)"/>
+<xsl:if test="$QNameTrace">[TRACE qnuri
+ node=<xsl:value-of select="name($node)" />
+ nsn=<xsl:value-of select="$namespace-name" />
+ ln=<xsl:value-of select="$local-name" />
+]</xsl:if>
+ <xsl:choose>
+ <!--<xsl:when test="$node/@ID">#<xsl:value-of select="$node/@ID" /></xsl:when>
+ <xsl:when test="$node/@rdf:ID">#<xsl:value-of select="$node/@rdf:ID" /></xsl:when>-->
+ <xsl:when test="$nslen = 0"><xsl:value-of select="concat($base,'#',$local-name)" /></xsl:when>
+ <xsl:when test="($lastNSChar='#') or ($lastNSChar='/') or ($lastNSChar='\')"><xsl:value-of select="concat($namespace-name,$local-name)" /></xsl:when>
+ <xsl:otherwise><xsl:value-of select="concat($namespace-name,$sep,$local-name)" /></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+<!-- -->
+<xsl:template name="pathName">
+ <xsl:param name="node" select="."/>
+ <xsl:for-each select="$node/ancestor-or-self::*">
+ <xsl:variable name="nodename" select="name()" />
+ <xsl:text>/</xsl:text>
+ <xsl:value-of select="$nodename" />
+ <xsl:choose>
+ <xsl:when test="$explicitPathIndices">
+ <xsl:text>[</xsl:text>
+ <xsl:value-of select="1 + count(preceding-sibling::*[name() = $nodename])"/>
+ <xsl:text>]</xsl:text>
+ </xsl:when>
+ <xsl:when test="@*[not(namespace-uri()=$rdfNS) and not(namespace-uri() = $xlinkNS)]">
+ <xsl:text>[</xsl:text>
+ <xsl:for-each select="@*[not(namespace-uri()=$rdfNS) and not(namespace-uri() = $xlinkNS)]">@<xsl:value-of select="name()" />='<xsl:value-of select="." />'<xsl:if test="not(position() = last())"> and </xsl:if></xsl:for-each>
+ <xsl:text>]</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+</xsl:template>
+</xsl:stylesheet>
Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/samples/xslt/rdf_Syntax_and_Names.htm
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/samples/xslt/rdf_Syntax_and_Names.htm?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/samples/xslt/rdf_Syntax_and_Names.htm (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/samples/xslt/rdf_Syntax_and_Names.htm Fri Apr 13 01:56:01 2007
@@ -0,0 +1,868 @@
+<!DOCTYPE html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<HTML>
+
+<HEAD>
+
+<TITLE>Simplified syntax mapping RDF to XML</TITLE>
+
+<META name="keywords" content="XML,RDF,XLink"><LINK href="../OHCG_Style.css" rel="stylesheet"/>
+
+</HEAD>
+
+<BODY link="#0000ff" vlink="#800080">
+
+<H2>Extracting and reifying RDF from XML</H2>
+
+<H3>Serializing RDF and edge labelled graphs in XML</H3>
+
+<P>One of the issues in serializing RDF to XML, and extracting RDF from
+
+arbitrary or colloquial XML is that the XML object model (DOM) is a node
+
+labelled graph and the RDF object model forms an edge labelled graph.</P>
+
+<P>Several mechanism have been proposed to simplifiy the RDF syntax: After
+
+implementing Sergey Melnik's <A href="http://www-db.stanford.edu/~melnik/rdf/syntax.html">simplified RDF
+
+syntax</A> using Tim Connolly's rdfp.xsl as a base, I have subsequently
+
+implemented Tim Berniers-Lee's <A href="http://www.w3.org/DesignIssues/Syntax.html">strawman syntax</A>:</P>
+
+<P>"The major difference between this syntax and <A href="http://www.w3.org/TR/REC-rdf-syntax/">RDF 1.0 M&S</A> is that RDF edges correspond to
+
+elements, and RDF nodes are implicit. It is basically as the M&S syntax with
+
+<CODE>parseType=resource</CODE>is a default."</P>
+
+<P>This proposal, with
+
+its attendant implementation has the following properties:</P>
+
+<OL>
+
+ <LI>Uses rdf:type='Resource' as default</LI>
+
+ <LI>Does not add to current rdf vocabulary</LI>
+
+ <LI>Implements XLink2RDF proposal (now with extended
+
+ links)</LI>
+
+ <LI>Implements rdf:aboutEach, rdf collections and bagID</LI>
+
+ <LI>Transforms to <rdf:Statement><rdf:predicate
+
+ .../>...</rdf:Statement> form</LI>
+
+ <LI>Transforms colloqial XML into
+
+ RDF Statements</LI>
+
+ <LI>*** Transformation of the output of a transformation results in
+
+ <STRONG>reification</STRONG></LI>
+
+</OL>
+
+<H3>The XSLT implementation</H3>
+
+<P>The current XSLT implementation incorporates Jason Diamond's original <A href="http://injektilo.org/rdf/rdf.xsl">rdf.xsl</A> (nice work!). I have placed a copy at <A href="http://www.openhealth.org/RDF/rdf.xsl">http://www.openhealth.org/RDF/rdf.xsl</A>
+
+which is <xsl:include>d into the current implementation:</P>
+
+<P> <A href="http://www.openhealth.org/RDF/rdfExtractify.xsl">http://www.openhealth.org/RDF/rdfExtractify.xsl</A></P>
+
+<P>To use, also download <A href="http://www.openhealth.org/RDF/rdf.xsl">http://www.openhealth.org/RDF/rdf.xsl</A> into the same directory</P>
+
+<!--<H4>Try it out</H4>
+
+<form action="http://www.w3.org/2000/06/webdata/xslt" method="GET">
+
+ <input type="hidden" name="xslfile" value="http://www.openhealth.org/RDF/rdfExtractify.xsl" />
+
+ <p>XML or RDF file: <input type="text" name="xmlfile" size="48" /></p>
+
+ <p><input type="submit" value="extractify" /></p>
+
+</form>-->
+
+<P> </P><H3>How to name anonymous class instances?</H3>
+
+<P>In the Melnick proposal, class instances are named by use of the rdf:instance
+
+attribute. When we indicate that an element maps to a class instance through use
+
+of the rdf:type instance the member appears anonymous, or is it? As in the
+
+XLink2RDF proposal, nodes can be named using XPointer fragment identifiers.
+
+XPointers can be generated from an element using several techniques:</P>
+
+<OL>
+
+ <LI><A href="http://www.w3.org/TR/xptr#bare-names">'Bare names'</A> Value of ID or rdf:ID attribute e.g. #foo</LI>
+
+ <LI><A href="http://www.w3.org/TR/xptr#child-seqs">ChildSeq</A> e.g. #/1/1/1</LI>
+
+ <LI>XPath indices e.g. #xpointer(/foo[1]/bar[2])</LI>
+
+ <LI>XPathattributese.g.#xpointer(/foo[@bar='123']/baz[@bop='whatever'])</LI>
+
+</OL>
+
+<P>An example XML document using simplified RDF syntax</P>
+
+<PRE><t:person
+
+ rdf:about="http://www.openhealth.org/people/JohnDoe.xml"
+
+ xmlns:t="http://www.openhealth.org/types">
+
+ <t:name rdf:type="PersonName">
+
+ <t:first>John</t:first>
+
+ <t:last>Doe</t:last>
+
+ </t:name>
+
+ <t:pid t:entity="NEMC">123-45-6789</t:pid>
+
+ <t:SSN>000-11-1234</t:SSN>
+
+ <t:patient rdf:type="Role">
+
+ <t:primary-care-physician rdf:resource=".../DrJones.xml" />
+
+ </t:patient>
+
+ <t:address rdf:type="Address" loc="home">
+
+ <t:street>750 Washington Street</t:street>
+
+ <t:city>Boston</t:city>
+
+ <t:state>MA</t:state>
+
+ </t:address>
+
+</t:person>
+
+</PRE>
+
+<P>And transformed via rdfExtractify:</P>
+
+<P><rdf:RDF
+
+xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject
+
+rdf:resource="http://www.openhealth.org/people/JohnDoe.xml"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/types#person"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#name"/><BR>
+
+<rdf:subject
+
+rdf:resource="http://www.openhealth.org/people/JohnDoe.xml"/><BR>
+
+<rdf:object rdf:resource="#/1/1"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/1"/><BR>
+
+<rdf:object rdf:resource="PersonName"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#first"/><BR>
+
+<rdf:subject rdf:resource="#/1/1"/><BR>
+
+<rdf:object>John</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#last"/><BR>
+
+<rdf:subject rdf:resource="#/1/1"/><BR>
+
+<rdf:object>Doe</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#pid"/><BR>
+
+<rdf:subject
+
+rdf:resource="http://www.openhealth.org/people/JohnDoe.xml"/><BR>
+
+<rdf:object rdf:resource="#/1/2"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/2"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/types#pid"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#entity"/><BR>
+
+<rdf:subject rdf:resource="#/1/2"/><BR>
+
+<rdf:object>NEMC</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#value"/><BR>
+
+<rdf:subject rdf:resource="#/1/2"/><BR>
+
+<rdf:object>123-45-6789</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#SSN"/><BR>
+
+<rdf:subject
+
+rdf:resource="http://www.openhealth.org/people/JohnDoe.xml"/><BR>
+
+<rdf:object>000-11-1234</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#patient"/><BR>
+
+<rdf:subject
+
+rdf:resource="http://www.openhealth.org/people/JohnDoe.xml"/><BR>
+
+<rdf:object rdf:resource="#/1/4"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/4"/><BR>
+
+<rdf:object rdf:resource="Role"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#primary-care-physician"/><BR>
+
+<rdf:subject rdf:resource="#/1/4"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/people/DrJones.xml"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject
+
+rdf:resource="http://www.openhealth.org/people/DrJones.xml"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/types#primary-care-physician"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#address"/><BR>
+
+<rdf:subject
+
+rdf:resource="http://www.openhealth.org/people/JohnDoe.xml"/><BR>
+
+<rdf:object rdf:resource="#/1/5"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/5"/><BR>
+
+<rdf:object rdf:resource="Address"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="file:/D:/rdf/test.xml#loc"/><BR>
+
+<rdf:subject rdf:resource="#/1/5"/><BR>
+
+<rdf:object>home</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#street"/><BR>
+
+<rdf:subject rdf:resource="#/1/5"/><BR>
+
+<rdf:object>750 Washington Street</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#city"/><BR>
+
+<rdf:subject rdf:resource="#/1/5"/><BR>
+
+<rdf:object>Boston</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.openhealth.org/types#state"/><BR>
+
+<rdf:subject rdf:resource="#/1/5"/><BR>
+
+<rdf:object>MA</rdf:object><BR>
+
+</rdf:Statement><BR></rdf:RDF></P>
+
+<P>And the reified result:</P>
+
+<P><rdf:RDF
+
+xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/1"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/><BR>
+
+<rdf:subject rdf:resource="#/1/1"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"/><BR>
+
+<rdf:subject rdf:resource="#/1/1"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/people/JohnDoe.xml"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/1"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/types#person"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/2"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/><BR>
+
+<rdf:subject rdf:resource="#/1/2"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/types#name"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"/><BR>
+
+<rdf:subject rdf:resource="#/1/2"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/people/JohnDoe.xml"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/2"/><BR>
+
+<rdf:object rdf:resource="#/1/1"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/3"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/><BR>
+
+<rdf:subject rdf:resource="#/1/3"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"/><BR>
+
+<rdf:subject rdf:resource="#/1/3"/><BR>
+
+<rdf:object rdf:resource="#/1/1"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/3"/><BR>
+
+<rdf:object rdf:resource="PersonName"/><BR>
+
+</rdf:Statement><BR> ...</P>
+
+<P> <rdf:Statement><BR>
+
+<rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/13"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/people/DrJones.xml"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/14"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/><BR>
+
+<rdf:subject rdf:resource="#/1/14"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"/><BR>
+
+<rdf:subject rdf:resource="#/1/14"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/people/DrJones.xml"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/14"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/types#primary-care-physician"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/15"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/><BR>
+
+<rdf:subject rdf:resource="#/1/15"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/types#address"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"/><BR>
+
+<rdf:subject rdf:resource="#/1/15"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/people/JohnDoe.xml"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/15"/><BR>
+
+<rdf:object rdf:resource="#/1/5"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/16"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/><BR>
+
+<rdf:subject rdf:resource="#/1/16"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"/><BR>
+
+<rdf:subject rdf:resource="#/1/16"/><BR>
+
+<rdf:object rdf:resource="#/1/5"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/16"/><BR>
+
+<rdf:object rdf:resource="Address"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/17"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/><BR>
+
+<rdf:subject rdf:resource="#/1/17"/><BR>
+
+<rdf:object rdf:resource="file:/D:/rdf/test.xml#loc"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"/><BR>
+
+<rdf:subject rdf:resource="#/1/17"/><BR>
+
+<rdf:object rdf:resource="#/1/5"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/17"/><BR>
+
+<rdf:object>home</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/18"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/><BR>
+
+<rdf:subject rdf:resource="#/1/18"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/types#street"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"/><BR>
+
+<rdf:subject rdf:resource="#/1/18"/><BR>
+
+<rdf:object rdf:resource="#/1/5"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/18"/><BR>
+
+<rdf:object>750 Washington Street</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/19"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/><BR>
+
+<rdf:subject rdf:resource="#/1/19"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/types#city"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"/><BR>
+
+<rdf:subject rdf:resource="#/1/19"/><BR>
+
+<rdf:object rdf:resource="#/1/5"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/19"/><BR>
+
+<rdf:object>Boston</rdf:object><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/><BR>
+
+<rdf:subject rdf:resource="#/1/20"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"/><BR>
+
+<rdf:subject rdf:resource="#/1/20"/><BR>
+
+<rdf:object
+
+rdf:resource="http://www.openhealth.org/types#state"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"/><BR>
+
+<rdf:subject rdf:resource="#/1/20"/><BR>
+
+<rdf:object rdf:resource="#/1/5"/><BR>
+
+</rdf:Statement><BR>
+
+<rdf:Statement><BR> <rdf:predicate
+
+rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"/><BR>
+
+<rdf:subject rdf:resource="#/1/20"/><BR>
+
+<rdf:object>MA</rdf:object><BR>
+
+</rdf:Statement><BR></rdf:RDF></P>
+
+<P><IMG src="person graph.GIF"></P>
+
+<P> </P>
+
+<P>Comments are welcome</P>
+
+<P>Jonathan Borden</P>
+
+<P><A href="mailto:jonathan@openhealth.org">jonathan@openhealth.org</A></P>
+
+<P>September 21, 2000</P>
+
+</BODY>
+
+</HTML>
+