Commit a9b84fe2 by Robbie Hott

Added Java ingest tool code

parent 37b9a04a
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="schematron"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>SNAC-Java-Parser</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SNAC-EAC-Parser</groupId>
<artifactId>SNAC-EAC-Parser</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>org.json</artifactId>
<version>chargebee-1.0</version>
</dependency>
<dependency>
<groupId>com.helger</groupId>
<artifactId>ph-schematron-validator</artifactId>
<version>5.0.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.8.0-beta2</version>
</dependency>
</dependencies>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron"
xmlns:cpf="urn:isbn:1-931666-33-4"
xmlns:snac="http://socialarchive.iath.virginia.edu/"
xmlns:xlink="http://www.w3.org/1999/xlink"
queryBinding='xslt2'
schemaVersion='ISO19757-3'>
<title>SNAC EAC-CPF Profile Instance Validation</title>
<ns prefix="cpf" uri="urn:isbn:1-931666-33-4"/>
<ns prefix="xlink" uri="http://www.w3.org/1999/xlink"/>
<!-- FILENAME: SNAC_EAC-CPF_ValidationProfile.sch -->
<!-- CREATED: 2016-05-31 -->
<!-- CREATED BY: michael.rush@yale.edu -->
<!-- NOTES: Does not check for presence of absence of ID attributes.
Does not check for snac namespace attributes. -->
<pattern>
<rule context="*">
<!--<assert test="not(@xml:lang)">The XML:LANG attribute is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(@xml:base)">The XML:BASE attribute is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:objectBinWrap)">The OBJECTBINWRAP element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:alternativeSet)">The ALTERNATIVESET element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:multipleIdentities)">The MUTLIPLEIDNETITIES element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:dateSet)">The DATESET element is not supported by the SNAC EAC-CPF profile.</assert>-->
</rule>
</pattern>
<pattern>
<rule context="cpf:control">
<assert test="not(cpf:publicationStatus)">The PUBLICATIONSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:localTypeDeclaration)">The LOCALTYPEDECLARATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:localControl)">The LOCALCONTROL element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:otherRecordId">
<assert test="@localType">The LOCALTYPE attribute on the OTHERRECORDID element is required by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:maintenanceAgency">
<assert test="not(cpf:agencyCode)">The AGENCYCODE element in the MAINTENANCEAGENCY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:otherAgencyCode)">The OTHERAGENCYCODE element in the MAINTENANCEAGENCY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the MAINTENANCEAGENCY element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:languageDeclaration">
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LANGUAGEDECLARATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:languageDeclaration/cpf:language">
<assert test="text()">A text value inside the LANGUAGEDECLARATION/LANGUAGE element is required by the SNAC EAC-CPF profile. </assert>
</rule>
<rule context="cpf:languageDeclaration/cpf:script">
<!-- Require script/text() or not. Examples are inconsistent. -->
<!--<assert test="text()">A text value inside the LANGUAGEDECLARATION/SCRIPT element is required by the SNAC EAC-CPF profile. </assert>-->
</rule>
</pattern>
<pattern>
<rule context="cpf:conventionDeclaration">
<assert test="not(cpf:abbreviation)">The ABBREVIATION element in the CONVENTIONDECLARATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the CONVENTIONDECLARATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:maintenanceEvent">
<!-- Require eventDescription? Inconsistent usage in provided examples. -->
<!--<assert test="cpf:eventDescription">The EVENTDESCRIPTION element in the MAINTENANCEEVENT element is required by the SNAC EAC-CPF profile.</assert>-->
</rule>
<rule context="cpf:eventDateTime">
<!--<assert test="not(@standardDateTime)">The STANDARDDATETIME attribute on the EVENTDATETIME element is not supported by the SNAC EAC-CPF profile.</assert>-->
</rule>
</pattern>
<pattern>
<rule context="cpf:source">
<assert test="not(@xlink:title)">The XLINK:TITLE attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:actuate)">The XLINK:ACTUATE attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:show)">The XLINK:SHOW attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:role)">The XLINK:ROLE attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:arcrole)">The XLINK:ARCROLE attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:sourceEntry)">The SOURCEENTRY element in the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>-->
</rule>
</pattern>
<pattern>
<rule context="cpf:cpfDescription">
<assert test="not(cpf:alternativeSet)">The ALTERNATIVESET element in the CPFDESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:identity">
<assert test="not(@localType)">The LOCALTYPE attribue on the IDENTITY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@identityType)">The IDENTITYTYPE attribute on the IDENTITY element is not supported by the SNAC EAC-CPF profile</assert>
<!--<assert test="not(cpf:entityId)">The ENTITYID element in the IDENTITY elemet is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(cpf:nameEntryParallel)">The NAMEENTRYPARALLEL element in the IDENTITY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the IDENTITY element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:nameEntry">
<!--<assert test="not(@scriptCode)">The SCRIPTCODE attribute on the NAMEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(@transliteration)">The TRANSLITERATION attribute on the NAMEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@localType)">The LOCALTYPE attribute on the NAMEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:useDates)">The USEDATES element in the NAMEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(cpf:preferredForm)">The PREFERREDFORM attribute in the NAMEENTRY lement is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:part">
<assert test="not(@localType)">The LOCALTYPE attribute on the PART element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:description">
<assert test="not(cpf:places)">The PLACES element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:localDescriptions)">The LOCALDESCRIPTIONS element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:legalStatus)">The LEGALSTATUS element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(cpf:legalStatuses)">The LEGALSTATUSES element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:function)">The FUNCTION element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(cpf:functions)">The FUNCTIONS element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:languagesUsed)">The LANGUAGESUSED element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:occupations)">The OCCUPATIONS element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:mandate)">The MANDATE element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(cpf:mandates)">The MANDATES element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:structureOrGenealogy)">The STRUCTUREORGENEALOGY element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>-->
<!--<assert test="not(cpf:generalContext)">The GENERALCONTEXT element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>-->
</rule>
</pattern>
<pattern>
<rule context="cpf:existDates">
<assert test="not(@localType)">The LOCALTYPE attribute in the EXISTDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the EXISTDATES element is not supported by the SNAC EAC-CPF profile.</assert>-->
</rule>
</pattern>
<pattern>
<rule context="cpf:places">
<assert test="not(@localType)">The LOCALTYPE attribute on the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The LIST element in the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:place">
<!--<assert test="not(cpf:placeRole)">The PLACEROLE element in the PLACE element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(cpf:address)">The ADDRESS element in the PLACE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the PLACE element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:dateRange)">The DATERANGE element in the PLACE element is not xxx</assert>-->
<assert test="not(cpf:dateSet)">The DATESET element in the PLACE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the PLACE element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the PLACE element is not supported by the SNAC EAC-CPF profile.</assert>-->
</rule>
</pattern>
<pattern>
<rule context="cpf:localDescriptions">
<assert test="not(@localType)">The LOCALTYPE attribute on the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The LIST element in the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:localDescription">
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the LOCALDESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element in the LOCALDESCRIPTION element is not xxx</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the LOCALDESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the LOCALDESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LOCALDESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:languagesUsed">
<assert test="not(@localType)">The LOCALTYPE attribute on the LANGUAGESUSED element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LANGUAGESUSED element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:languageUsed">
<assert test="not(@localType)">The LOCALTYPE attribute on the LANGUAGEUSED element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LANGUAGEUSED element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:occupations">
<assert test="not(@localType)">The LOCALTYPE attribute on the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The list element in the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:occupation">
<assert test="not(@localType)">The LOCALTYPE attribute on the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:legalstatuses">
<assert test="not(@localType)">The LOCALTYPE attribute on the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The list element in the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:legalstatus">
<assert test="not(@localType)">The LOCALTYPE attribute on the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:functions">
<assert test="not(@localType)">The LOCALTYPE attribute on the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The list element in the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:function">
<assert test="not(@localType)">The LOCALTYPE attribute on the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:mandates">
<assert test="not(@localType)">The LOCALTYPE attribute on the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The list element in the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:mandate">
<assert test="not(@localType)">The LOCALTYPE attribute on the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>-->
</rule>
</pattern>
<pattern>
<rule context="cpf:structureOrGenealogy">
<assert test="not(@localType)">The LOCALTYPE attribute on the STRUCTUREORGENEALOGY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the STRUCTUREORGENEALOGY element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:generalContext">
<assert test="not(@localType)">The LOCALTYPE attribute on the GENERALCONTEXT element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the GENERALCONTEXT element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:biogHist">
<assert test="not(@localType)">The LOCALTYPE attribute on the BIOGHIST element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:abstract)">The ABSTRACT element in the BIOGHIST element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:chronList)">The CHRONLIST element in the BIOGHIST element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the BIOGHIST element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:relations">
<assert test="not(cpf:functionRelation)">The FUNCTIONRELATION element in the RELATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:cpfRelation">
<!--<assert test="not(@cpfRelationType)">The CPFRELATIONTYPE attribute on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:arcrole">The XLINK:ARCROLE attribute on the CPFRELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:role">The XLINK:ROLE attribute on the CPFRELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:title)">The XLINK:TITLE attribute on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:actuate)">The XLINK:ACTUATE attribute on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:show)">The XLINK:SHOW attribute on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(cpf:dateRange)">The DATERANGE element on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(cpf:dateSet)">The DATESET element on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:resourceRelation">
<!--<assert test="not(@resourceRelationType)">The RESOURCERELATIONTYPE attribute on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:arcrole">The XLINK:ARCROLE attribute on the RESOURCERELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:role">The XLINK:ROLE attribute on the RESOURCERELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:title)">The XLINK:TITLE attribute on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:actuate)">The XLINK:ACTUATE attribute on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:show)">The XLINK:SHOW attribute on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:functionRelation">
<assert test="not(@functionRelationType)">The FUNCTIONRELATIONTYPE attribute on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:arcrole">The XLINK:ARCROLE attribute on the FUNCTIONRELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:role">The XLINK:ROLE attribute on the FUNCTIONRELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:title)">The XLINK:TITLE attribute on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:actuate)">The XLINK:ACTUATE attribute on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:show)">The XLINK:SHOW attribute on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:relationEntry">
<!--<assert test="not(@localType)">The LOCALTYPE attribute on the RELATIONENTRY element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(@scriptCode)">The SCRIPTCODE attribute on the RELATIONENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@transliteration)">The TRANSLITERATION attribute on the RELATIONENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:objectXMLWrap">
</rule>
</pattern>
<!-- m.dates -->
<pattern>
<rule context="cpf:dateSingle">
<assert test="not(@localType)">The LOCALTYPE attribute on the DATESINGLE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@notBefore)">The NOTBEFORE attribute on the DATESINGLE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@notAfter)">The NOTAFTER attribute on the DATESINGLE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@standardDate">The STANDARDDATE attribute on the DATESINGLE element is required by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:dateRange">
<assert test="not(@localType)">The LOCALTYPE attribute on the DATERANGE element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:fromDate">
<assert test="not(@notBefore)">The NOTBEFORE attribute on the FROMDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@notAfter)">The NOTAFTER attribute on the FROMDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@standardDate">The STANDARDDATE attribute on the FROMDATE element is required by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:toDate">
<assert test="not(@notBefore)">The NOTBEFORE attribute on the TODATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@notAfter)">The NOTAFTER attribute on the TODATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@standardDate">The STANDARDDATE attribute on the TODATE element is required by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:dateSet">
<assert test="not(@localType)">The LOCALTYPE attribute on the DATESET element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<!-- m.simpleDescription -->
<pattern>
<rule context="cpf:term">
<assert test="not(@scriptCode)">The SCRIPTCODE attribute on the TERM element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@transliteration)">The TRANSLITERATION attribute on the TERM element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the TERM element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(@vocabularySource)">The VOCABULARYSOURCE attribute on the TERM element is not supported by the SNAC EAC-CPF profile.</assert>-->
</rule>
<rule context="cpf:citation">
<assert test="not(@xlink:type)">The XLINK:TYPE attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:href)">The XLINK:HREF attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:title)">The XLINK:TITLE attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:actuate)">The XLINK:ACTUATE attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:show)">The XLINK:SHOW attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:role)">The XLINK:ROLE attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:arcrole)">The XLINK:ARCROLE attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:descriptiveNote">
</rule>
</pattern>
<!-- m.discursiveSet -->
<pattern>
<rule context="cpf:p">
</rule>
<rule context="cpf:outline">
<assert test="not(@localType)">The LOCALTYPE attribute on the OUTLINE element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:level">
<assert test="not(@localType)">The LOCALTYPE attribute on the LEVEL element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:item">
<assert test="not(@localType)">The LOCALTYPE attribute on the ITEM element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:list">
<assert test="not(@localType)">The LOCALTYPE attribute on the LIST element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<!-- m.mixedContent -->
<pattern>
<rule context="cpf:span">
<assert test="@localType or @style">Either the LOCALTYPE attribute or the STYLE attribute is required on the SPAN element by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:chronList">
<assert test="not(@localType)">The LOCALTYPE attribute on the CHRONLIST element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:event">
<assert test="not(@localType)">The LOCALTYPE attribute on the EVENT element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:placeEntry">
<assert test="not(@scriptCode)">The SCRIPTCODE attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@transliteration)">The TRANSLITERATION attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<!--<assert test="not(@localType)">The LOCALTYPE attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>-->
<!--<assert test="not(@vocabularySource)">The VOCABULARYSOURCE attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>-->
<assert test="not(@accuracy)">The ACCURACY attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@latitude)">The LATTITUDE attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@longitude)">The LONGITUDE attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@altitude)">The ALTITUDE attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
</schema>
\ No newline at end of file
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2" schemaVersion="ISO19757-3">
<title>SNAC EAC-CPF Profile Instance Validation</title>
<ns prefix="cpf" uri="urn:isbn:1-931666-33-4"></ns>
<ns prefix="xlink" uri="http://www.w3.org/1999/xlink"></ns>
<pattern>
<rule context="*">
<assert test="not(@xml:base)">The XML:BASE attribute is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:objectBinWrap)">The OBJECTBINWRAP element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:alternativeSet)">The ALTERNATIVESET element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:multipleIdentities)">The MUTLIPLEIDNETITIES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:control">
<assert test="not(cpf:publicationStatus)">The PUBLICATIONSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:localTypeDeclaration)">The LOCALTYPEDECLARATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:localControl)">The LOCALCONTROL element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:otherRecordId">
<assert test="@localType">The LOCALTYPE attribute on the OTHERRECORDID element is required by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:maintenanceAgency">
<assert test="not(cpf:agencyCode)">The AGENCYCODE element in the MAINTENANCEAGENCY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:otherAgencyCode)">The OTHERAGENCYCODE element in the MAINTENANCEAGENCY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the MAINTENANCEAGENCY element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:languageDeclaration">
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LANGUAGEDECLARATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:languageDeclaration/cpf:language">
<assert test="text()">A text value inside the LANGUAGEDECLARATION/LANGUAGE element is required by the SNAC EAC-CPF profile. </assert>
</rule>
<rule context="cpf:languageDeclaration/cpf:script">
</rule>
</pattern>
<pattern>
<rule context="cpf:conventionDeclaration">
<assert test="not(cpf:abbreviation)">The ABBREVIATION element in the CONVENTIONDECLARATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the CONVENTIONDECLARATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:maintenanceEvent">
</rule>
<rule context="cpf:eventDateTime">
</rule>
</pattern>
<pattern>
<rule context="cpf:source">
<assert test="not(@xlink:title)">The XLINK:TITLE attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:actuate)">The XLINK:ACTUATE attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:show)">The XLINK:SHOW attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:role)">The XLINK:ROLE attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:arcrole)">The XLINK:ARCROLE attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:sourceEntry)">The SOURCEENTRY element in the SOURCE element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:cpfDescription">
<assert test="not(cpf:alternativeSet)">The ALTERNATIVESET element in the CPFDESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:identity">
<assert test="not(@localType)">The LOCALTYPE attribue on the IDENTITY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@identityType)">The IDENTITYTYPE attribute on the IDENTITY element is not supported by the SNAC EAC-CPF profile</assert>
<assert test="not(cpf:nameEntryParallel)">The NAMEENTRYPARALLEL element in the IDENTITY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the IDENTITY element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:nameEntry">
<assert test="not(@transliteration)">The TRANSLITERATION attribute on the NAMEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@localType)">The LOCALTYPE attribute on the NAMEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:preferredForm)">The PREFERREDFORM attribute in the NAMEENTRY lement is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:part">
<assert test="not(@localType)">The LOCALTYPE attribute on the PART element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:description">
<assert test="not(cpf:places)">The PLACES element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:localDescriptions)">The LOCALDESCRIPTIONS element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:legalStatuses)">The LEGALSTATUSES element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:functions)">The FUNCTIONS element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:languagesUsed)">The LANGUAGESUSED element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:occupations)">The OCCUPATIONS element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:mandates)">The MANDATES element in the DESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:existDates">
<assert test="not(@localType)">The LOCALTYPE attribute in the EXISTDATES element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:places">
<assert test="not(@localType)">The LOCALTYPE attribute on the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The LIST element in the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the PLACES element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:place">
<assert test="not(cpf:address)">The ADDRESS element in the PLACE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the PLACE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the PLACE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the PLACE element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:localDescriptions">
<assert test="not(@localType)">The LOCALTYPE attribute on the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The LIST element in the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the LOCALDESCRIPTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:localDescription">
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the LOCALDESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element in the LOCALDESCRIPTION element is not xxx</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the LOCALDESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the LOCALDESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LOCALDESCRIPTION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:languagesUsed">
<assert test="not(@localType)">The LOCALTYPE attribute on the LANGUAGESUSED element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LANGUAGESUSED element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:languageUsed">
<assert test="not(@localType)">The LOCALTYPE attribute on the LANGUAGEUSED element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LANGUAGEUSED element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:occupations">
<assert test="not(@localType)">The LOCALTYPE attribute on the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The list element in the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the OCCUPATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:occupation">
<assert test="not(@localType)">The LOCALTYPE attribute on the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the OCCUPATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:legalstatuses">
<assert test="not(@localType)">The LOCALTYPE attribute on the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The list element in the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the LEGALSTATUSES element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:legalstatus">
<assert test="not(@localType)">The LOCALTYPE attribute on the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the LEGALSTATUS element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:functions">
<assert test="not(@localType)">The LOCALTYPE attribute on the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The list element in the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the FUNCTIONS element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:function">
<assert test="not(@localType)">The LOCALTYPE attribute on the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the FUNCTION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:mandates">
<assert test="not(@localType)">The LOCALTYPE attribute on the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:descriptiveNote)">The DESCRIPTIVENOTE element in the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:p)">The P element in the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:list)">The list element in the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the MANDATES element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:mandate">
<assert test="not(@localType)">The LOCALTYPE attribute on the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:citation)">The CITATION element in the MANDATE element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:structureOrGenealogy">
<assert test="not(@localType)">The LOCALTYPE attribute on the STRUCTUREORGENEALOGY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the STRUCTUREORGENEALOGY element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:generalContext">
<assert test="not(@localType)">The LOCALTYPE attribute on the GENERALCONTEXT element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the GENERALCONTEXT element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:biogHist">
<assert test="not(@localType)">The LOCALTYPE attribute on the BIOGHIST element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:abstract)">The ABSTRACT element in the BIOGHIST element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:chronList)">The CHRONLIST element in the BIOGHIST element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:outline)">The OUTLINE element in the BIOGHIST element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:relations">
<assert test="not(cpf:functionRelation)">The FUNCTIONRELATION element in the RELATIONS element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:cpfRelation">
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:arcrole">The XLINK:ARCROLE attribute on the CPFRELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:role">The XLINK:ROLE attribute on the CPFRELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:title)">The XLINK:TITLE attribute on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:actuate)">The XLINK:ACTUATE attribute on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:show)">The XLINK:SHOW attribute on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element on the CPFRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:resourceRelation">
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:arcrole">The XLINK:ARCROLE attribute on the RESOURCERELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:role">The XLINK:ROLE attribute on the RESOURCERELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:title)">The XLINK:TITLE attribute on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:actuate)">The XLINK:ACTUATE attribute on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:show)">The XLINK:SHOW attribute on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element on the RESOURCERELATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:functionRelation">
<assert test="not(@functionRelationType)">The FUNCTIONRELATIONTYPE attribute on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:arcrole">The XLINK:ARCROLE attribute on the FUNCTIONRELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="@xlink:role">The XLINK:ROLE attribute on the FUNCTIONRELATION element is required by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:title)">The XLINK:TITLE attribute on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:actuate)">The XLINK:ACTUATE attribute on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:show)">The XLINK:SHOW attribute on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSingle)">The DATESINGLE element on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateRange)">The DATERANGE element on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:dateSet)">The DATESET element on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(cpf:placeEntry)">The PLACEENTRY element on the FUNCTIONRELATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:relationEntry">
<assert test="not(@scriptCode)">The SCRIPTCODE attribute on the RELATIONENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@transliteration)">The TRANSLITERATION attribute on the RELATIONENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:objectXMLWrap">
</rule>
</pattern>
<pattern>
<rule context="cpf:dateSingle">
<assert test="not(@localType)">The LOCALTYPE attribute on the DATESINGLE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@notBefore)">The NOTBEFORE attribute on the DATESINGLE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@notAfter)">The NOTAFTER attribute on the DATESINGLE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@standardDate">The STANDARDDATE attribute on the DATESINGLE element is required by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:dateRange">
<assert test="not(@localType)">The LOCALTYPE attribute on the DATERANGE element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:fromDate">
<assert test="not(@notBefore)">The NOTBEFORE attribute on the FROMDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@notAfter)">The NOTAFTER attribute on the FROMDATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@standardDate">The STANDARDDATE attribute on the FROMDATE element is required by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:toDate">
<assert test="not(@notBefore)">The NOTBEFORE attribute on the TODATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@notAfter)">The NOTAFTER attribute on the TODATE element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="@standardDate">The STANDARDDATE attribute on the TODATE element is required by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:dateSet">
<assert test="not(@localType)">The LOCALTYPE attribute on the DATESET element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:term">
<assert test="not(@scriptCode)">The SCRIPTCODE attribute on the TERM element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@transliteration)">The TRANSLITERATION attribute on the TERM element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the TERM element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:citation">
<assert test="not(@xlink:type)">The XLINK:TYPE attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:href)">The XLINK:HREF attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:title)">The XLINK:TITLE attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:actuate)">The XLINK:ACTUATE attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:show)">The XLINK:SHOW attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:role)">The XLINK:ROLE attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@xlink:arcrole)">The XLINK:ARCROLE attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@lastDateTimeVerified)">The LASTDATETIMEVERIFIED attribute on the CITATION element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:descriptiveNote">
</rule>
</pattern>
<pattern>
<rule context="cpf:p">
</rule>
<rule context="cpf:outline">
<assert test="not(@localType)">The LOCALTYPE attribute on the OUTLINE element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:level">
<assert test="not(@localType)">The LOCALTYPE attribute on the LEVEL element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:item">
<assert test="not(@localType)">The LOCALTYPE attribute on the ITEM element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:list">
<assert test="not(@localType)">The LOCALTYPE attribute on the LIST element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:span">
<assert test="@localType or @style">Either the LOCALTYPE attribute or the STYLE attribute is required on the SPAN element by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:chronList">
<assert test="not(@localType)">The LOCALTYPE attribute on the CHRONLIST element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
<rule context="cpf:event">
<assert test="not(@localType)">The LOCALTYPE attribute on the EVENT element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
<pattern>
<rule context="cpf:placeEntry">
<assert test="not(@scriptCode)">The SCRIPTCODE attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@transliteration)">The TRANSLITERATION attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@accuracy)">The ACCURACY attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@latitude)">The LATTITUDE attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@longitude)">The LONGITUDE attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
<assert test="not(@altitude)">The ALTITUDE attribute on the PLACEENTRY element is not supported by the SNAC EAC-CPF profile.</assert>
</rule>
</pattern>
</schema>
\ No newline at end of file
/**
* SNAC Reconciliation Example (CBW Java Example)
*
* For the full license, see the LICENSE file in the repository root
*
* @author Robbie Hott
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
* @copyright 2017 the Rector and Visitors of the University of Virginia, and
* the Regents of the University of California
*/
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
* CBW Reconciler UI
*
* This is the GUI interface class that prompts the user to choose CSV files to reconcile against SNAC.
*
* @author Robbie Hott
*
*/
public class SNACInfoWindow extends javax.swing.JFrame {
/**
* Serial ID
*/
private static final long serialVersionUID = -8115653654144568030L;
/**
* GUI Variables
*/
private JPanel titlePanel;
private JLabel titleLabel;
private JPanel bodyPanel;
private JPanel parserPanel;
private JTextArea parsedDisplay;
private String title;
private String text;
{
//Set Look & Feel
try {
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
// Silently ignoring errors
}
}
/**
* Constructor
*
* Calls JFrame's constructor and then initializes and displays the GUI
*/
public SNACInfoWindow(String title, String text) {
super();
this.title = title;
this.text = text;
initGUI();
}
public static void showWindow(String title, String text) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
SNACInfoWindow inst = new SNACInfoWindow(title, text);
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}
/**
* Initialize GUI
*
* Builds the JFrame to display to the user.
*/
public void initGUI() {
try {
BorderLayout thisLayout = new BorderLayout();
getContentPane().setLayout(thisLayout);
{
titlePanel = new JPanel();
getContentPane().add(titlePanel, BorderLayout.NORTH);
titlePanel.setSize(900, 40);
{
titleLabel = new JLabel("<html><body style='text-align: center; font-size: 20px; margin: 0px; padding: 0px;'>" + title + "</body></html>", SwingConstants.CENTER);
titlePanel.add(titleLabel);
titleLabel.setPreferredSize(new java.awt.Dimension(900, 40));
}
}
//continue building GUI
bodyPanel = new JPanel();
FlowLayout bodyPanelLayout = new FlowLayout();
getContentPane().add(bodyPanel, BorderLayout.CENTER);
bodyPanel.setLayout(bodyPanelLayout);
{
parserPanel = new JPanel();
bodyPanel.add(parserPanel);
parserPanel.setSize(900, 700);
parserPanel.setPreferredSize(new java.awt.Dimension(900, 700));
parsedDisplay = new JTextArea();
parsedDisplay.setText(text.toString());
JScrollPane sp = new JScrollPane(parsedDisplay);
sp.setPreferredSize(new java.awt.Dimension(900, 700));
parserPanel.add(sp);
}
this.setSize(900, 800);
} catch (Exception e) {
// Silently ignoring errors
}
}
}
/**
* SNAC Reconciliation Example (CBW Java Example)
*
* For the full license, see the LICENSE file in the repository root
*
* @author Robbie Hott
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
* @copyright 2017 the Rector and Visitors of the University of Virginia, and
* the Regents of the University of California
*/
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
* CBW Reconciler UI
*
* This is the GUI interface class that prompts the user to choose CSV files to reconcile against SNAC.
*
* @author Robbie Hott
*
*/
public class SNACJavaParser extends javax.swing.JFrame {
/**
* Serial ID
*/
private static final long serialVersionUID = -8115653654144568030L;
/**
* GUI Variables
*/
private JPanel title;
private JLabel titleLabel;
private JPanel bodyPanel;
private JPanel parserPanel;
private JSeparator jSeparator2;
private JButton parseWithSNAC;
private JSeparator jSeparator3;
private JProgressBar parseProgressBar;
private JSeparator jSeparator4;
private JLabel parseProgressLabel;
private JSeparator jSeparator1;
private JLabel fromXMLFileLabel;
private JLabel fromXMLFileLocationLabel;
private JButton fromXMLFileButton;
private JLabel toJSONFileLabel;
private JLabel toJSONFileLocationLabel;
private JButton toJSONFileButton;
/**
* Reconciliation File Variables
*/
private String fromXMLFile;
private String toJSONFile;
{
//Set Look & Feel
try {
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
// Silently ignoring errors
}
}
/**
* Main Method
*
* Creates an instance of this GUI and starts the example
*
* @param args Command-line arguments
* @throws IOException
* @throws SecurityException
*/
public static void main(String[] args) throws SecurityException, IOException {
//Mac Niceness
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "SNAC EAC-CPF Utility");
Handler fh = new FileHandler("log2.txt");
Logger.getLogger("").addHandler(fh);
Logger.getLogger("").setLevel(Level.INFO);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
SNACJavaParser inst = new SNACJavaParser();
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}
/**
* Constructor
*
* Calls JFrame's constructor and then initializes and displays the GUI
*/
public SNACJavaParser() {
super();
initGUI();
}
/**
* Initialize GUI
*
* Builds the JFrame to display to the user.
*/
private void initGUI() {
try {
BorderLayout thisLayout = new BorderLayout();
getContentPane().setLayout(thisLayout);
{
title = new JPanel();
getContentPane().add(title, BorderLayout.NORTH);
title.setSize(700, 100);
{
titleLabel = new JLabel("<html><body style='text-align: center;'><p style='font-size: 25px;'>SNAC EAC-CPF Utility</p><p style='color: #B40404'>Pre-Alpha Test Version</p></body></html>", SwingConstants.CENTER);
title.add(titleLabel);
titleLabel.setPreferredSize(new java.awt.Dimension(700, 100));
}
}
//continue building GUI
bodyPanel = new JPanel();
FlowLayout bodyPanelLayout = new FlowLayout();
getContentPane().add(bodyPanel, BorderLayout.CENTER);
bodyPanel.setLayout(bodyPanelLayout);
{
parserPanel = new JPanel();
bodyPanel.add(parserPanel);
parserPanel.setSize(700, 200);
parserPanel.setPreferredSize(new java.awt.Dimension(700, 200));
// lookup buttons
{
fromXMLFileLabel = new JLabel();
parserPanel.add(fromXMLFileLabel);
fromXMLFileLabel.setText("EAC-CPF XML File: ");
}
{
fromXMLFileLocationLabel = new JLabel();
parserPanel.add(fromXMLFileLocationLabel);
fromXMLFileLocationLabel.setText("<choose>");
}
{
fromXMLFileButton = new JButton();
parserPanel.add(fromXMLFileButton);
fromXMLFileButton.setText("Browse");
fromXMLFileButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
// Pop up a file chooser for the user to pick a CSV file
JFileChooser chooser2 = new JFileChooser();
chooser2.setDialogType(JFileChooser.OPEN_DIALOG);
chooser2.setDialogTitle("Choose an XML File.");
chooser2.setFileFilter(new FileNameExtensionFilter("EAC-CPF XML Files", "xml"));
int returnVal = chooser2.showOpenDialog(null);
if(returnVal == JFileChooser.APPROVE_OPTION) {
fromXMLFile = chooser2.getSelectedFile().getAbsolutePath();
fromXMLFileLocationLabel.setText(fromXMLFile);
}
}
});
}
{
jSeparator1 = new JSeparator();
parserPanel.add(jSeparator1);
jSeparator1.setPreferredSize(new java.awt.Dimension(700, 6));
}
{
toJSONFileLabel = new JLabel();
parserPanel.add(toJSONFileLabel);
toJSONFileLabel.setText("Destination JSON File: ");
}
{
toJSONFileLocationLabel = new JLabel();
parserPanel.add(toJSONFileLocationLabel);
toJSONFileLocationLabel.setText("<optional>");
}
{
toJSONFileButton = new JButton();
parserPanel.add(toJSONFileButton);
toJSONFileButton.setText("Browse");
toJSONFileButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
// Pop up a file chooser for the user to find a directory and
// enter a filename for the destination CSV.
JFileChooser chooser2 = new JFileChooser();
chooser2.setDialogTitle("Choose a Destination JSON File (optional).");
chooser2.setDialogType(JFileChooser.SAVE_DIALOG);
chooser2.setFileFilter(new FileNameExtensionFilter("JSON Constellation Files","json"));
int returnVal = chooser2.showSaveDialog(null);
if(returnVal == JFileChooser.APPROVE_OPTION) {
toJSONFile = chooser2.getSelectedFile().getAbsolutePath();
toJSONFileLocationLabel.setText(toJSONFile);
}
}
});
}
{
jSeparator2 = new JSeparator();
parserPanel.add(jSeparator2);
jSeparator2.setPreferredSize(new java.awt.Dimension(700, 6));
}
{
parseWithSNAC = new JButton();
parserPanel.add(parseWithSNAC);
parseWithSNAC.setText("Schematron Validate");
parseWithSNAC.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
// If a to and from file are set, then stand up a reconcile worker to
// do the work and reconcile against snac. This GUI will be updated on
// the progress of the worker.
if (fromXMLFile != null) {
parseProgressBar.setValue(0);
parseProgressLabel.setText("Starting...");
try {
// do the reconcile loop in the background
final SNACJavaSchematronValidator rw = new SNACJavaSchematronValidator(fromXMLFile, toJSONFile, true);
rw.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(
PropertyChangeEvent evt) {
if ("progress" == evt.getPropertyName()) {
int progress = (Integer) evt.getNewValue();
parseProgressBar.setValue(progress);
parseProgressLabel.setText(rw.getProgressText());
}
}
});
rw.execute();
} catch (Exception e) {
// Silently ignoring errors
}
}
}
});
}
// Reconcile with SNAC button
{
parseWithSNAC = new JButton();
parserPanel.add(parseWithSNAC);
parseWithSNAC.setText("Parse with SNAC");
parseWithSNAC.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
// If a to and from file are set, then stand up a reconcile worker to
// do the work and reconcile against snac. This GUI will be updated on
// the progress of the worker.
if (fromXMLFile != null) {
try {
parseProgressBar.setValue(0);
parseProgressLabel.setText("Starting...");
// do the reconcile loop in the background
final SNACJavaParserWorker rw = new SNACJavaParserWorker(fromXMLFile, toJSONFile, true);
rw.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(
PropertyChangeEvent evt) {
if ("progress" == evt.getPropertyName()) {
int progress = (Integer) evt.getNewValue();
parseProgressBar.setValue(progress);
parseProgressLabel.setText(rw.getProgressText());
}
}
});
rw.execute();
} catch (Exception e) {
// Silently ignoring errors
}
}
}
});
}
{
jSeparator3 = new JSeparator();
parserPanel.add(jSeparator3);
jSeparator3.setPreferredSize(new java.awt.Dimension(700, 6));
}
{
parseProgressBar = new JProgressBar(0, 100);
parseProgressBar.setValue(0);
parseProgressBar.setStringPainted(true);
parserPanel.add(parseProgressBar);
parseProgressBar.setPreferredSize(new java.awt.Dimension(600, 20));
}
{
jSeparator4 = new JSeparator();
parserPanel.add(jSeparator4);
jSeparator4.setPreferredSize(new java.awt.Dimension(700, 0));
}
{
parseProgressLabel = new JLabel();
parserPanel.add(parseProgressLabel);
}
}
this.setSize(700, 400);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("SNAC EAC-CPF Utility");
} catch (Exception e) {
// Silently ignoring errors
}
}
}
/**
* SNAC Reconciliation Example (CBW Java Example)
*
* For the full license, see the LICENSE file in the repository root
*
* @author Robbie Hott
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
* @copyright 2017 the Rector and Visitors of the University of Virginia, and
* the Regents of the University of California
*/
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
* CBW Reconciler UI
*
* This is the GUI interface class that prompts the user to choose CSV files to reconcile against SNAC.
*
* @author Robbie Hott
*
*/
public class SNACJavaParserConstellationWindow extends javax.swing.JFrame {
/**
* Serial ID
*/
private static final long serialVersionUID = -8115653654144568030L;
/**
* GUI Variables
*/
private JPanel title;
private JLabel titleLabel;
private JPanel bodyPanel;
private JPanel parserPanel;
private JTextArea parsedDisplay;
{
//Set Look & Feel
try {
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
// Silently ignoring errors
}
}
/**
* Constructor
*
* Calls JFrame's constructor and then initializes and displays the GUI
*/
public SNACJavaParserConstellationWindow(String constellation) {
super();
initGUI(constellation);
}
public static void showConstellation(String constellation) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
SNACJavaParserConstellationWindow inst = new SNACJavaParserConstellationWindow(constellation);
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}
/**
* Initialize GUI
*
* Builds the JFrame to display to the user.
*/
public void initGUI(String constellation) {
try {
BorderLayout thisLayout = new BorderLayout();
getContentPane().setLayout(thisLayout);
{
title = new JPanel();
getContentPane().add(title, BorderLayout.NORTH);
title.setSize(900, 40);
{
titleLabel = new JLabel("<html><body style='text-align: center; font-size: 20px; margin: 0px; padding: 0px;'>Parsed Constellation</body></html>", SwingConstants.CENTER);
title.add(titleLabel);
titleLabel.setPreferredSize(new java.awt.Dimension(900, 40));
}
}
//continue building GUI
bodyPanel = new JPanel();
FlowLayout bodyPanelLayout = new FlowLayout();
getContentPane().add(bodyPanel, BorderLayout.CENTER);
bodyPanel.setLayout(bodyPanelLayout);
{
parserPanel = new JPanel();
bodyPanel.add(parserPanel);
parserPanel.setSize(900, 700);
parserPanel.setPreferredSize(new java.awt.Dimension(900, 700));
parsedDisplay = new JTextArea();
parsedDisplay.setText(constellation.toString());
JScrollPane sp = new JScrollPane(parsedDisplay);
sp.setPreferredSize(new java.awt.Dimension(900, 700));
parserPanel.add(sp);
}
this.setSize(900, 800);
} catch (Exception e) {
// Silently ignoring errors
}
}
}
/**
* SNAC Reconciliation Example (CBW Java Example)
*
* For the full license, see the LICENSE file in the repository root
*
* @author Robbie Hott
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
* @copyright 2017 the Rector and Visitors of the University of Virginia, and
* the Regents of the University of California
*/
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
* CBW Reconciler UI
*
* This is the GUI interface class that prompts the user to choose CSV files to reconcile against SNAC.
*
* @author Robbie Hott
*
*/
public class SNACJavaParserErrorWindow extends javax.swing.JFrame {
/**
* Serial ID
*/
private static final long serialVersionUID = -8115653654144568030L;
/**
* GUI Variables
*/
private JPanel title;
private JLabel titleLabel;
private JPanel bodyPanel;
private JPanel parserPanel;
private JTextArea parseErrors;
{
//Set Look & Feel
try {
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
// Silently ignoring errors
}
}
/**
* Constructor
*
* Calls JFrame's constructor and then initializes and displays the GUI
*/
public SNACJavaParserErrorWindow(String errors) {
super();
initGUI(errors);
}
public static void showErrors(String errors) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
SNACJavaParserErrorWindow inst = new SNACJavaParserErrorWindow(errors);
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}
/**
* Initialize GUI
*
* Builds the JFrame to display to the user.
*/
public void initGUI(String errors) {
try {
BorderLayout thisLayout = new BorderLayout();
getContentPane().setLayout(thisLayout);
{
title = new JPanel();
getContentPane().add(title, BorderLayout.NORTH);
title.setSize(900, 40);
{
titleLabel = new JLabel("<html><body style='text-align: center; font-size: 20px;'>Parse Errors</body></html>", SwingConstants.CENTER);
title.add(titleLabel);
titleLabel.setPreferredSize(new java.awt.Dimension(900, 40));
}
}
//continue building GUI
bodyPanel = new JPanel();
FlowLayout bodyPanelLayout = new FlowLayout();
getContentPane().add(bodyPanel, BorderLayout.CENTER);
bodyPanel.setLayout(bodyPanelLayout);
{
parserPanel = new JPanel();
bodyPanel.add(parserPanel);
parserPanel.setSize(900, 700);
parserPanel.setPreferredSize(new java.awt.Dimension(900, 700));
parseErrors = new JTextArea();
parseErrors.setText(errors.toString());
JScrollPane sp = new JScrollPane(parseErrors);
sp.setPreferredSize(new java.awt.Dimension(900, 700));
parserPanel.add(sp);
}
this.setSize(900, 800);
} catch (Exception e) {
// Silently ignoring errors
}
}
}
/**
* SNAC Reconciliation Example (CBW Java Example)
*
* For the full license, see the LICENSE file in the repository root
*
* @author Robbie Hott
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
* @copyright 2017 the Rector and Visitors of the University of Virginia, and
* the Regents of the University of California
*/
import java.io.BufferedInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.SwingWorker;
import org.json.JSONException;
import org.json.JSONObject;
/**
* CBW Reconcile Worker
*
* This class does the actual work of connecting to SNAC and requesting for reconciliation.
* It also handles the result from the server (JSON) and parses the data into a CSV.
*
* @author Robbie Hott
*
*/
public class SNACJavaParserWorker extends SwingWorker<Void, Void> {
/**
* Filenames to use
*/
private String fromFile;
private String toFile;
private Boolean displayResult;
/**
* Progress of the reconciliation
*/
double progress;
/**
* Where the application is currently looking
*/
String progressText;
/**
* Constructor
*
* Create a new worker using the given from and to filenames.
*
* @param from CSV file to read from
* @param to CSV file to write to
*/
public SNACJavaParserWorker (String from, String to, Boolean displayResult) {
fromFile = from;
toFile = to;
progress = 0.0;
progressText = "";
this.displayResult = displayResult;
}
/**
* Background worker
*
* SwingWorker calls this method when it spawns the new worker thread. This method
* then calls the actual reconcile method to perform the reconcilation.
*/
public Void doInBackground() {
try {
reconcile();
} catch (Exception e) {
// Silently ignoring errors
}
return null;
}
/**
* Set the progress text
*
* @param text String to use for the progress text
*/
private void setProgressText(String text) {
progressText = text;
}
/**
* Get progress text
*
* Returns the current progress status (what individual in the CSV file the system is currently looking at)
*
* @return The progress text
*/
public String getProgressText() {
return progressText;
}
/**
* Main Reconcile Method
*
* This method performs the heart of the client-side reconciliation process.
*
* @throws Exception
*/
private void reconcile() throws Exception {
setProgress(0);
setProgressText("Reading XML file");
String xmlContents = new String(Files.readAllBytes(Paths.get(fromFile)), StandardCharsets.UTF_8);
setProgress(10);
setProgressText("Encoding XML file");
String base64Encoded = new String(Base64.getEncoder().encode(xmlContents.getBytes()));
setProgress(20);
setProgressText("Querying SNAC-Alpha");
// Create the JSON query string for the SNAC RestAPI
String query = "{"+
"\"command\" : \"parse_eac\"," +
"\"file\" : { " +
"\"content\" : \"" + base64Encoded + "\"," +
"\"mime-type\" : \"text/xml\"" +
"}" +
"}";
//System.err.println(query);
// Perform connection to SNAC
HttpURLConnection httpcon = (HttpURLConnection) ((new URL("http://snac-dev.iath.virginia.edu/alpha/rest/").openConnection()));
httpcon.setDoOutput(true);
httpcon.setRequestProperty("Content-Type", "application/json");
httpcon.setRequestMethod("PUT");
httpcon.connect();
setProgress(50);
setProgressText("Reading response from SNAC-Alpha");
// Write the query to the RestAPI
byte[] outputBytes = query.getBytes("UTF-8");
OutputStream os = httpcon.getOutputStream();
os.write(outputBytes);
os.close();
setProgress(60);
// Read the response from the RestAPI
String resultStr = null;
try {
InputStream in = new BufferedInputStream(httpcon.getInputStream());
resultStr = org.apache.commons.io.IOUtils.toString(in, "UTF-8");
in.close();
} catch (Exception e) {
e.printStackTrace(System.err);
setProgress(99);
setProgressText("SNAC-Alpha could not parse input: Invalid XML File");
return;
}
setProgress(65);
JSONObject resultObj = null;
try {
resultObj = new JSONObject(resultStr);
} catch (JSONException je) {
setProgress(99);
setProgressText("SNAC-Alpha returned with an error");
System.err.println(resultStr);
return;
}
setProgress(70);
// Close the connection
httpcon.disconnect();
setProgress(75);
setProgressText("Parsing response from SNAC");
// If reconciliation succeeded, then process the results
// Use a pre-packaged writer to write out the CSV file
FileWriter writer = null;
if (toFile != null)
writer = new FileWriter(toFile);
if (resultObj.has("constellation") && resultObj.has("result")) {
setProgress(85);
setProgressText("Writing JSON file from SNAC");
if (writer != null)
writer.write(resultObj.getJSONObject("constellation").toString(4));
if (displayResult)
SNACInfoWindow.showWindow("Parsed Constellation" ,resultObj.getJSONObject("constellation").toString(4));
}
// Close the CSV Writer
if (writer != null)
writer.close();
// Update the progress to 100%
if (resultObj.has("result") && resultObj.getString("result").equals("success"))
progressText = "Complete";
else
progressText = "Complete -- with errors";
setProgress(100);
String errors = "";
if (resultObj.has("unparsed")) {
for (int j = 0; j < resultObj.getJSONArray("unparsed").length(); j++) {
String line = resultObj.getJSONArray("unparsed").getString(j).trim();
if (!line.isEmpty())
errors += line + "\r\n";
}
}
if (!errors.isEmpty())
SNACInfoWindow.showWindow("Parse Errors", errors);
}
}
/**
* SNAC Reconciliation Example (CBW Java Example)
*
* For the full license, see the LICENSE file in the repository root
*
* @author Robbie Hott
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
* @copyright 2017 the Rector and Visitors of the University of Virginia, and
* the Regents of the University of California
*/
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import javax.swing.SwingWorker;
import javax.xml.transform.stream.StreamSource;
import org.json.JSONObject;
import org.oclc.purl.dsdl.svrl.FailedAssert;
import org.oclc.purl.dsdl.svrl.SchematronOutputType;
import com.helger.schematron.ISchematronResource;
import com.helger.schematron.pure.SchematronResourcePure;
import com.helger.schematron.xslt.SchematronResourceSCH;
/**
* CBW Reconcile Worker
*
* This class does the actual work of connecting to SNAC and requesting for reconciliation.
* It also handles the result from the server (JSON) and parses the data into a CSV.
*
* @author Robbie Hott
*
*/
public class SNACJavaSchematronValidator extends SwingWorker<Void, Void> {
/**
* Filenames to use
*/
private String fromFile;
private String toFile;
private Boolean displayResult;
/**
* Progress of the reconciliation
*/
double progress;
/**
* Where the application is currently looking
*/
String progressText;
/**
* Constructor
*
* Create a new worker using the given from and to filenames.
*
* @param from CSV file to read from
* @param to CSV file to write to
*/
public SNACJavaSchematronValidator (String from, String to, Boolean displayResult) {
fromFile = from;
toFile = to;
progress = 0.0;
progressText = "";
this.displayResult = displayResult;
}
/**
* Background worker
*
* SwingWorker calls this method when it spawns the new worker thread. This method
* then calls the actual reconcile method to perform the reconcilation.
*/
public Void doInBackground() {
try {
validate();
} catch (Exception e) {
// Silently ignoring errors
}
return null;
}
/**
* Set the progress text
*
* @param text String to use for the progress text
*/
private void setProgressText(String text) {
progressText = text;
}
/**
* Get progress text
*
* Returns the current progress status (what individual in the CSV file the system is currently looking at)
*
* @return The progress text
*/
public String getProgressText() {
return progressText;
}
/**
* Main Reconcile Method
*
* This method performs the heart of the client-side reconciliation process.
*
* @throws Exception
*/
private void validate() throws Exception {
setProgress(0);
setProgressText("Reading XML file");
//InputStream schematronStream = getClass().getResourceAsStream("SNAC_EAC-CPF_ValidationProfile.sch");
//File schematron = new File(SNACJavaSchematronValidator.class.getResource("SNAC_EAC-CPF_ValidationProfile.sch"));
//File schematron = new File("schematron/SNAC_EAC-CPF_ValidationProfile.sch");
File xmlFile = new File(fromFile);
// final ISchematronResource aResPure = SchematronResourcePure.fromFile (schematron);
// if (!aResPure.isValidSchematron ()) {
// FileReader r = new FileReader(schematron);
// String text = new String(Files.readAllBytes(schematron.toPath()), StandardCharsets.UTF_8);
// System.err.println(text);
// progressText = "Invalid Schematron!";
// setProgress(100);
// return;
// }
final ISchematronResource aResSCH = SchematronResourceSCH.fromClassPath("SNAC_EAC-CPF_ValidationProfile.sch");
//final ISchematronResource aResSCH = SchematronResourceSCH. .fromFile(schematron);
if (!aResSCH.isValidSchematron ()) {
//FileReader r = new FileReader(schematron);
//String text = new String(Files.readAllBytes(schematron.toPath()), StandardCharsets.UTF_8);
//System.err.println(text);
progressText = "Invalid Schematron!";
setProgress(100);
return;
}
boolean result = aResSCH.getSchematronValidity(new StreamSource(xmlFile)).isValid ();
String validationErrors = "";
SchematronOutputType sot = aResSCH.applySchematronValidationToSVRL(new StreamSource(xmlFile));
List<Object> failedAsserts = sot.getActivePatternAndFiredRuleAndFailedAssert();
for (Object object : failedAsserts) {
if (object instanceof FailedAssert) {
FailedAssert failedAssert = (FailedAssert) object;
validationErrors += failedAssert.getText() + "\r\n";
//System.out.println(failedAssert.getTest());
}
}
// FileWriter writer = null;
// if (toFile != null)
// writer = new FileWriter(toFile);
//
// if (displayResult)
// SNACJavaParserConstellationWindow.showConstellation("");
//
// // Close the CSV Writer
// if (writer != null)
// writer.close();
// Update the progress to 100%
if (result)
progressText = "Validated Successfully";
else {
SNACInfoWindow.showWindow("Validation Errors", validationErrors);
progressText = "Invalid XML File";
}
setProgress(100);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment