<?xml version ='1.0' encoding='UTF-8'?>
<!--
 -
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -
 -  Copyright (C) 1998-2018 OpenLink Software
 -
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -
 -
-->
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <sql:header xmlns:sql='urn:schemas-openlink-com:xml-sql'>
	<sql:param name=":sne">-1</sql:param>
	<sql:param name=":atype"> </sql:param>
    </sql:header>
    <foaf:Person rdf:about="">
    <sql:sqlx xmlns:sql='urn:schemas-openlink-com:xml-sql' sql:xsl="foaf.xsl"><![CDATA[
	select
			    xmlelement ('http://www.w3.org/2000/01/rdf-schema#:seeAlso',
			    	xmlattributes (
			    	'http://'|| WA_GET_HOST ()|| '/dataspace/'||wa_identity_dstype(u_name)||'/'|| u_name || '/foaf.rdf'
				as 'http://www.w3.org/1999/02/22-rdf-syntax-ns#:resource'))
	    from sn_person, sys_users, WA_USER_INFO where sne_org_id = u_id and u_id = WAUI_U_ID
	    and sne_id = :sne
	    ]]></sql:sqlx>

    <sql:sqlx xmlns:sql='urn:schemas-openlink-com:xml-sql'><![CDATA[

	  select
	   xmlelement ('http://www.w3.org/2000/01/rdf-schema#:seeAlso',
	   xmlelement ('http://openlinksw.com/ods/1.0/:'|| wa_type_to_app (WAI_TYPE_NAME),
		xmlattributes (
			'http://'|| WA_GET_HOST ()|| '/dataspace/'||wa_identity_dstype(U_NAME)||'/' ||
			U_NAME || '/' || wa_type_to_app (WAI_TYPE_NAME) || '/' ||
			wa_utf8_to_wide (WAI_NAME) || '/foaf.rdf'
			as 'http://www.w3.org/1999/02/22-rdf-syntax-ns#:about')

		,xmlelement ('http://purl.org/dc/elements/1.1/:title', wa_utf8_to_wide (WAI_NAME)),
		xmlelement ('http://purl.org/dc/elements/1.1/:description', wa_utf8_to_wide (WAI_DESCRIPTION)),
		xmlelement ('http://openlinksw.com/ods/1.0/:owner',
		      xmlattributes (
			'http://'|| WA_GET_HOST ()|| '/dataspace/'||wa_identity_dstype(U_NAME)||'/' || U_NAME || '/foaf.rdf'
			as 'http://www.w3.org/1999/02/22-rdf-syntax-ns#:resource'))
		))
		from (select WAI_TYPE_NAME,WAI_NAME,WAI_DESCRIPTION,U_NAME from WA_MEMBER, WA_INSTANCE, sn_entity, SYS_USERS where WAM_INST = WAI_NAME and WAM_USER = U_ID and sne_name = u_name and sne_id = :sne and WAM_MEMBER_TYPE = 1 and WAI_TYPE_NAME = :atype order by 1) sub
	]]></sql:sqlx>
  </foaf:Person>
</rdf:RDF>
