Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Add xsd directory #489

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
591 changes: 591 additions & 0 deletions Metadata_XSD/POD_v1_1.xsd

Large diffs are not rendered by default.

131 changes: 131 additions & 0 deletions Metadata_XSD/POD_v1_1.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">

<xsl:output encoding="UTF-8" method="text"/>
<xsl:strip-space elements="*"/>

<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="catalog">
{
<xsl:apply-templates select="type | context | id" />
<xsl:apply-templates select="conformsTo | describedBy"/>
"dataset":[
<xsl:apply-templates select="dataset"/>
]
}
</xsl:template>

<xsl:template match="context | id">
"@<xsl:value-of select="local-name()"/>":"<xsl:value-of select="."/>",
</xsl:template>

<xsl:template match="type">
"@<xsl:value-of select="local-name()"/>":"<xsl:value-of select="."/>" <xsl:if test="position() != last()">,</xsl:if>
</xsl:template>

<xsl:template match="dataset">
{
<xsl:apply-templates/>
}<xsl:if test="position() != last()">,</xsl:if>
</xsl:template>

<xsl:template match="contactPoint">
"<xsl:value-of select="local-name()"/>":{
<xsl:apply-templates/>
},
</xsl:template>

<xsl:template match="hasEmail">
"<xsl:value-of select="local-name()"/>":"mailto:<xsl:value-of select="."/>"
</xsl:template>

<xsl:template match="keyword">
"<xsl:value-of select="local-name()"/>":[
<xsl:apply-templates/>
],
</xsl:template>

<xsl:template match="item">
"<xsl:value-of select="normalize-space(.)"/>" <xsl:if test="position() != last()">,</xsl:if>
</xsl:template>

<!-- <xsl:template match="keyword"/>-->

<xsl:template match="publisher">
"<xsl:value-of select="local-name()"/>":{
<xsl:apply-templates select="@* | *"/>
},
</xsl:template>

<xsl:template match="subOrganizationOf">
"<xsl:value-of select="local-name()"/>":{
<xsl:apply-templates select="@* | *"/>
}
</xsl:template>

<xsl:template match="bureauCode | programCode">
"<xsl:value-of select="local-name()"/>":[
"<xsl:value-of select="."/>"
],
</xsl:template>

<xsl:template match="dataQuality">
"<xsl:value-of select="local-name()"/>":<xsl:value-of select="."/>,
</xsl:template>

<xsl:template match="distribution[1]">
"<xsl:value-of select="local-name()"/>":[
{
<xsl:apply-templates select="@* | *"/>
}<xsl:if test="position() != last()">,</xsl:if>
<xsl:apply-templates select="following-sibling::distribution" mode="pull"/>
] <xsl:if test="following-sibling::*">,</xsl:if>
</xsl:template>

<xsl:template match="distribution" mode="pull">
{
<xsl:apply-templates select="@* | *"/>
}<xsl:if test="position() != last()">,</xsl:if>
<xsl:apply-templates select="following-sibling::distribution"/>
</xsl:template>

<xsl:template match="distribution"/>

<xsl:template match="language">
<xsl:if test="item[. != '']"> "<xsl:value-of select="local-name()"/>":[
<xsl:apply-templates/>
]<xsl:if test="following-sibling::*">,</xsl:if></xsl:if>
</xsl:template>

<xsl:template match="references">
"<xsl:value-of select="local-name()"/>":[
<xsl:apply-templates/>
]<xsl:if test="following-sibling::*">,</xsl:if>
</xsl:template>

<xsl:template match="url">
"<xsl:value-of select="."/>"<xsl:if test="position() != last()">,</xsl:if>
</xsl:template>

<xsl:template match="theme" >
<xsl:if test="item[. != '']">"<xsl:value-of select="local-name()"/>":[
<xsl:apply-templates/>
]<xsl:if test="following-sibling::*">,</xsl:if></xsl:if>
</xsl:template>

<xsl:template match="@*">
"@<xsl:value-of select="local-name()"/>":"<xsl:value-of select="."/>",<xsl:text>&#x000a;</xsl:text>
</xsl:template>

<xsl:template match="*">
<xsl:if test=". != ''"> "<xsl:value-of select="local-name()"/>":"<xsl:value-of select="normalize-space(.)"/>"<xsl:if test="following-sibling::*[. != '']">,</xsl:if>
<xsl:apply-templates select="*"/></xsl:if>
</xsl:template>

</xsl:stylesheet>
47 changes: 47 additions & 0 deletions Metadata_XSD/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Notes:

The following files can be found in this folder:
1. POD_v1_1.xsd
* This is an xml representation of the (federal) Project Open Data v1.1 json schema

2. dataGovSample.xml
* This is the content from the sample file (for the 'extended' POD fields)
https://project-open-data.cio.gov/v1.1/examples/catalog-sample-extended.json
expressed in xml valid to POD_v1_1.xsd

3. POD_v1_1.xsl
* This is an xsl stylesheet that converts xml valid to POD_v1_1.xsd to json.
* This stylesheet was developed using xml that reproduced the information found in
the file https://project-open-data.cio.gov/v1.1/examples/catalog-sample-extended.json.
* It is possible that there are xml files that could be valid to the POD_v1_1.xsd for
which this stylesheet makes an incomplete or incorrect conversion.

4. dataGovSample.json
* This is the json file created from dataGovSample.xml using POD_v1_1.xsl.

5. nistSample.xml
* This is a file containing two records that are present in NIST's data.gov json

6. nistSample.json
* This is the json file created from nistSample.xml using POD_v1_1.xsl.



As of 26 June 2015:

1. The files dataGovSample.xml and nistSample.xml are valid to POD_v1_1.xsd.

2. The files dataGovSample.json and nistSample.json were created from their
similarly named xml files using POD_v1_1.xsl.

3. The files dataGovSample.json and nistSample.json were validated against the
Federal v1.1 schema using the Project Open Data Dashboard.

Note about testing the xml to json conversion:
* The xsl stysheet is declared as version="2.0" and has been mostly run
using Saxon 9x in the Oxygen environment.
* The stylesheet has been successfully tested (although not extensively) using
a declaration of version="1.0" and run under Saxon 6.5.5 in Oxygen. No testing
has been done with other parsers and/or transformation engines.


47 changes: 47 additions & 0 deletions Metadata_XSD/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Notes:

The following files can be found in this folder:
1. POD_v1_1.xsd
* This is an xml representation of the Federal v1.1 json schema

2. dataGovSample.xml
* This is the content from the sample file (for the 'extended' POD fields)
https://project-open-data.cio.gov/v1.1/examples/catalog-sample-extended.json
expressed in xml valid to POD_v1_1.xsd

3. POD_v1_1.xsl
* This is an xsl stylesheet that converts xml valid to POD_v1_1.xsd to json.
* This stylesheet was developed using xml that reproduced the information found in
the file https://project-open-data.cio.gov/v1.1/examples/catalog-sample-extended.json.
* It is possible that there are xml files that could be valid to the POD_v1_1.xsd for
which this stylesheet makes an incomplete or incorrect conversion.

4. dataGovSample.json
* This is the json file created from dataGovSample.xml using POD_v1_1.xsl.

5. nistSample.xml
* This is a file containing two records that are present in NIST's data.gov json

6. nistSample.json
* This is the json file created from nistSample.xml using POD_v1_1.xsl.



As of 26 June 2015:

1. The files dataGovSample.xml and nistSample.xml are valid to POD_v1_1.xsd.

2. The files dataGovSample.json and nistSample.json were created from their
similarly named xml files using POD_v1_1.xsl.

3. The files dataGovSample.json and nistSample.json were validated against the
Federal v1.1 schema using the Project Open Data Dashboard.

Note about testing the xml to json conversion:
* The xsl stysheet is declared as version="2.0" and has been mostly run
using Saxon 9x in the Oxygen environment.
* The stylesheet has been successfully tested (although not extensively) using
a declaration of version="1.0" and run under Saxon 6.5.5 in Oxygen. No testing
has been done with other parsers and/or transformation engines.


97 changes: 97 additions & 0 deletions Metadata_XSD/dataGovSample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"@type": "dcat:Catalog",
"@context": "https://project-open-data.cio.gov/v1.1/schema/catalog.jsonld",
"@id": "http://www.agency.gov/data.json",
"conformsTo": "https://project-open-data.cio.gov/v1.1/schema",
"describedBy": "https://project-open-data.cio.gov/v1.1/schema/catalog.json",
"dataset": [{
"title": "U.S. Widget Manufacturing Statistics",
"description": "This dataset provides national statistics on the production of widgets",
"contactPoint": {
"@type": "vcard:Contact",
"fn": "Jane Doe",
"hasEmail": "mailto:[email protected]"
},
"keyword": [
"widget",
"manufacturing",
"factory"
],
"modified": "2011-11-19",
"publisher": {
"@type": "org:Organization",
"name": "Widget Services",
"subOrganizationOf": {
"@type": "org:Organization",
"name": "Office of Citizen Services and Innovative Technologies",
"subOrganizationOf": {
"@type": "org:Organization",
"name": "General Services Administration",
"subOrganizationOf": {
"@type": "org:Organization",
"name": "U.S. Government"
}
}
}
},
"accessLevel": "public",
"identifier": "http://dx.doi.org/10.7927/H4PZ56R2",
"bureauCode": ["018:10"],
"programCode": ["018:001"],
"accrualPeriodicty": "R/P1Y",
"conformsTo": "https://project-open-data.cio.gov/v1.1/schema",
"describedBy": "https://project-open-data.cio.gov/v1.1/schema/catalog.json",
"dataQuality": true,
"distribution": [
{
"description": "Widgets data as a CSV file",
"downloadURL": "https://data.agency.gov/datasets/widgets-statistics/widgets.csv",
"format": "CSV",
"mediaType": "text/csv",
"title": "widgets.csv",
"@type": "dcat:Distribution"
},
{
"description": "Widgets data as a zipped CSV file with attached data dictionary",
"downloadURL": "https://data.agency.gov/datasets/widgets-statistics/widgets-all.zip",
"format": "Zipped CSV",
"mediaType": "application/zip",
"title": "widgets-all.zip",
"@type": "dcat:Distribution"
},
{
"conformsTo": "http://www.agency.gov/widget-data-standard/",
"describedBy": "http://www.agency.gov/widgets/schema.json",
"describedByType": "application/schema+json",
"description": "Widget data as a JSON feed",
"downloadURL": "http://www.agency.gov/feeds/widgets-all.json",
"format": "JSON",
"mediaType": "application/json",
"title": "widgets-all.json",
"@type": "dcat:Distribution"
},
{
"accessURL": "https://data.agency.gov/api/widgets-statistics/",
"description": "A fully queryable REST API with JSON and XML output",
"format": "API",
"title": "Widgets REST API",
"@type": "dcat:Distribution"
}
],
"issued": "2011-11-22",
"landingPage": "http://agency.gov/widgets/data",
"language": ["en-US"],
"license": "http://creativecommons.org/publicdomain/zero/1.0/",
"primaryITInvestmentUII": "021-006227212",
"references": [
"http://agency.gov/docs/widgets-1.html",
"http://agency.gov/docs/widgets-2.html"
],
"rights": "This dataset has been given an international public domain dedication for worldwide reuse",
"spatial": "United States",
"systemOfRecords": "http://www.agency.gov/widgets/sorn/",
"temporal": "2009-09-01T12:00:00Z/2010-05-31T12:00:00Z",
"theme": ["manufacturing"],
"@type": "dcat:Dataset"
}]
}
Loading