<?xml version="1.0" encoding="UTF-8"?>
<!--  $Id: comm_para.xsd,v 1.4 2011/01/12 18:14:41 ginger Exp $--> 
<xs:schema 
targetNamespace="http://ns.nsdl.org/ncs/comm_para" 
xmlns="http://ns.nsdl.org/ncs/comm_para" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" 
attributeFormDefault="unqualified" 
version="0.1">
	<xs:annotation>
		<xs:documentation>********************************************</xs:documentation>
		<xs:documentation>***** SCHEMA DEVELOPMENT  *****</xs:documentation>
		<xs:documentation>********************************************</xs:documentation>
		<xs:documentation>Created: 2011-01-06</xs:documentation>
		<xs:documentation>Author: Katy Ginger, University Corporation for Atmospheric Research (UCAR), ginger@ucar.edu</xs:documentation>
		<xs:documentation>Purpose: support the exchange of summative paradata (information about resource use)</xs:documentation>
		<xs:documentation>Copyright for this file: See LICENSE AND COPYRIGHT at the end of this file.</xs:documentation>
	</xs:annotation>
		
		<xs:annotation>
		<xs:documentation>****************************************************</xs:documentation>
		<xs:documentation>***** HISTORY of IMPORTANT CHANGES *****</xs:documentation>
		<xs:documentation>****************************************************</xs:documentation>
		<xs:documentation>none yet</xs:documentation>
	</xs:annotation>

<xs:annotation>
		<xs:documentation>******************************************************</xs:documentation>
		<xs:documentation>***** INCLUDED/ IMPORTED SCHEMAS  *****</xs:documentation>
		<xs:documentation>******************************************************</xs:documentation>
	</xs:annotation>


	<xs:annotation>
		<xs:documentation>***************************************************</xs:documentation>
		<xs:documentation>*****  COMPLEX TYPES   *****</xs:documentation>
		<xs:documentation>***************************************************</xs:documentation>
		<xs:documentation>paradataRecordType - is the ROOT type</xs:documentation>
		<xs:documentation>dateType - is part of paradataRecordType</xs:documentation>
		<xs:documentation>paradataType - is part of paradataRecordType</xs:documentation>
	</xs:annotation>

	<xs:annotation>
		<xs:documentation>*********************************</xs:documentation>
		<xs:documentation>*****  ROOT ELEMENT *****</xs:documentation>
		<xs:documentation>*********************************</xs:documentation>
			<xs:documentation>commParadata - the root element of the community paradata record</xs:documentation>
	</xs:annotation>
	<xs:element name="commParadata" type="paradataRecordType"/>


	<xs:complexType name="paradataRecordType">
		<xs:annotation>
			<xs:documentation>*****  paradataRecordType  *****</xs:documentation>
			<xs:documentation>paradataRecordType - the root element type for the community paradata record</xs:documentation>
			<xs:documentation>recordId - a unique identification number used to identify an individual paradata record</xs:documentation>
			<xs:documentation>date - calendar date for the creation or modification of the paradata record</xs:documentation>
			<xs:documentation>title - the title of the paradata/annotation if one exists or is appropriate</xs:documentation>
			<xs:documentation>paradataProvidedForId - an individual rating of a resource or an average rating of a resource</xs:documentation>
			<xs:documentation>paradataReferenceURL - a URL to a landing page that has the summary of paradata information from a particular provider</xs:documentation>
			<xs:documentation>paradataResourceURL - a URL to the resource to which the paradata applies</xs:documentation>
			<xs:documentation>paradataProvidedForName - the title of the resource to which the paradata applies</xs:documentation>
			<xs:documentation>paradata - a set of several usage statistics/information about a resource</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="recordId" type="xs:string" minOccurs="1" maxOccurs="1"/>
 			<xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
 			<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
			<xs:element name="date" type="dateType" minOccurs="1" maxOccurs="1"/>
			<xs:element name="paradataProvidedForId" type="xs:string" minOccurs="1" maxOccurs="1"/>
 			<xs:element name="paradataReferenceURL" type="xs:anyURI" minOccurs="1" maxOccurs="1"/><!--might want to restrict using urlType below-->
 			<xs:element name="paradataResourceURL" type="xs:anyURI" minOccurs="1" maxOccurs="1"/><!--might want to restrict using urlType below-->
			<xs:element name="paradataProvidedForName" type="xs:string" minOccurs="0" maxOccurs="1"/>
 			<xs:element name="paradata" type="paradataType" minOccurs="0" maxOccurs="1"/>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="paradataType">
		<xs:annotation>
			<xs:documentation>*****  paradataType  *****</xs:documentation>
			<xs:documentation>numViews - the number of times the resource was accessed</xs:documentation>
			<xs:documentation>numFavorited - the number of times the resource has been favorited by a user</xs:documentation>
			<xs:documentation>numComments - the number of comments associated with the resource</xs:documentation>
			<xs:documentation>numFullAccesses - the number of times the resource has been interacted with (fully accessed); that is, the user either watched the video, downloaded the object or went to the actual resource</xs:documentation>
			<xs:documentation>numTimesWatched - the number of people who are following the resources</xs:documentation>
			<xs:documentation>numEmbedsInCurriculum - the number of times the resource has been included in curriculum/unit</xs:documentation>
			<xs:documentation>numEmbedsInContent - the number of times the resource has been in a derivative work</xs:documentation>
			<xs:documentation>numEmbedsInUnknown - the number of times the resource has been integrated into another resource</xs:documentation>
			<xs:documentation>numAddedToCollection - the number of times the resource has been added to a user's personal list, collection, or group etc.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="numViews" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
			<xs:element name="numFavorited" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
 			<xs:element name="numComments" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
 			<xs:element name="numFullAccesses" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
 			<xs:element name="numTimesWatched" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
			<xs:element name="numEmbedsInCurriculum" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
			<xs:element name="numEmbedsInContent" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
			<xs:element name="numEmbedsInUnknown" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
			<xs:element name="numAddedToCollection" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="dateType">
		<xs:annotation>
			<xs:documentation>*****  dateType  *****</xs:documentation>
			<xs:documentation>dateType - calendar date for the creation or modification of the metadata record</xs:documentation>
			<xs:documentation>created - the creation date of the annotation metadata record</xs:documentation>
			<xs:documentation>modified	- the modification date of the annotation metadata record</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="created" type="union.dateType" use="required"/>
				<xs:attribute name="modified" type="union.dateType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>


	<xs:annotation>
		<xs:documentation>***********************************************</xs:documentation>
		<xs:documentation>***** Simple Types (alpha order) *********</xs:documentation>
		<xs:documentation>***********************************************</xs:documentation>
		<xs:documentation>union.dateType - calendar dates of the form YYYY, YYYY-MM, YYYY-MM-DD; part of annotationRecordType</xs:documentation>
		<xs:documentation>urlType - enforces a URL format as content</xs:documentation>
	</xs:annotation>

	<xs:simpleType name="union.dateType">
		<xs:annotation>
			<xs:documentation>union.dateType - calendar dates of the form YYYY, YYYY-MM, YYYY-MM-DD or YYYY-MM-DDThh:mm:ss</xs:documentation>
		</xs:annotation>
		<xs:union memberTypes="xs:date xs:gYearMonth xs:gYear xs:dateTime"/>
	</xs:simpleType>

	<xs:simpleType name="urlType">
		<xs:annotation>
			<xs:documentation>Sources for constructing the pattern</xs:documentation>
			<xs:documentation>http://geekswithblogs.net/casualjim/archive/2005/12/01/61722.aspx; ^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\w+@)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&amp;\w+=\w+)*)?</xs:documentation>
			<xs:documentation>http://www.nshb.net/node/252; /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
</xs:documentation>
			<xs:documentation>http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html</xs:documentation>
			<xs:documentation>http://www.dotnetcoders.com/web/Learning/Regex/exHrefExtractor.aspx</xs:documentation>
			<xs:documentation>In XML schema, there are no ^ or $ characters to limit a match to the beginning or end of of a line as there are in Perl. So removed ^, $ and escaped slashes.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="(http://|https://|ftp://)+([a-zA-Z0-9])+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,5}((:[0-9]{1,5})?/.*)?"/> 
			<!--allows port numbers, dashes but no spaces or underscores in domain or directory part-->
		</xs:restriction>
	</xs:simpleType> 

</xs:schema>
<!--LICENSE AND COPYRIGHT
The contents of this file are subject to the Educational Community License v1.0 (the "License"); you may not use this file except in compliance with the License. You should obtain a copy of the License from http://www.opensource.org/licenses/ecl1.php. Files distributed under the License are distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Copyright 2002-2011 by Digital Learning Sciences, University Corporation for Atmospheric Research (UCAR). All rights reserved.-->
