Você está na página 1de 11

Criao de Schema Plugin

GeoNetwork derivado do ISO19139 (profile)

Repositrio de schemas

Repositrio de schema plugins do projeto GeoNetwork

Contm schemas plugins j consolidados para o GeoNetwork

https://github.com/geonetwork/schema-plugins/

til para usar como exemplo de customizaes de perfis

Criao de Schema Plugin GeoNetwork derivado do ISO19139 (profile)

Slide 2 de 11

Passo a passo
1. Copiar o diretrio do schema iso19139.xyz
(https://github.com/geonetwork/schema-plugins/tree/master/iso19139.xyz)

trata-se de
um schema mnimo para estender um profile do schema ISO19139
2. Renomear o diretrio para o nome do novo profile substituir o xyz
pelo nome do profile desejado. Exemplo:
iso19139.xyz

iso19139.mgbcompleto

3. Escolher um namespace e um url para o profile. A url no precisa existir


necessariamente. Funcionar com um ID do namespace entre os XML.
Exemplo:
namespace: mgb
url:

http://www.ibge.gov.br/2014/mgb

Criao de Schema Plugin GeoNetwork derivado do ISO19139 (profile)

Slide 3 de 11

Passo a passo
4. O namespace deve ser substitudo ou adicionado em todos os arquivos
schemas que tiverem o namespace do xyz. Geralmente, a substituio deve
ocorrer nos ns raiz dos XMLs. Exemplo:
ANTIGO: xmlns:xyz="http://my/schema/target/namespace"
NOVO: xmlns:mgb="http://www.ibge.gov.br/2014/mgb"

5. Alterar o arquivo schema-ident.xml indicando o nome do novo schema, bem


como, o local do schema. Exemplo no prximo slide.

Criao de Schema Plugin GeoNetwork derivado do ISO19139 (profile)

Slide 4 de 11

Passo a passo
schema-ident.xml
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://geonetwork-opensource.org/schemas/schema-ident http://geonetworkopensource.org/schemas/schema-ident/schema-ident.xsd"
xmlns="http://geonetwork-opensource.org/schemas/schema-ident">
<name>iso19139.mgbcompleto</name>
<id>0c134cf0-a848-11e3-a5e2-0800200c9a66</id>
<version>1.0</version>
<depends>iso19139</depends>
<!-- Profile XSD location -->
<schemaLocation>http://www.isotc211.org/2005/gmd http://www.isotc211.org/2005/gmd/gmd.xsd
http://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd</schemaLocation>
<autodetect xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:mgb="http://www.ibge.gov.br/2014/mgb">
<namespaces

xmlns:mgb="http://www.ibge.gov.br/2014/mgb"/>

</autodetect>
<readwriteUuid>false</readwriteUuid>
</schema>

Criao de Schema Plugin GeoNetwork derivado do ISO19139 (profile)

Slide 5 de 11

Passo a passo
6. Copiar o diretrio schema/ do schema iso19139 para o diretrio do novo
schema e adicionar uma nova pasta que conter os XSDs de customizao.
Exemplo da rvore de diretrios:

Diretrio de customizao/extenso

Criao de Schema Plugin GeoNetwork derivado do ISO19139 (profile)

Slide 6 de 11

Passo a passo
7. Modificar o arquivo schema.xml para apontar os arquivos de customizao.
Exemplo:
schema.xml (iso19139.xyz)

schema.xml (iso19139.mgbcompleto)

<?xml version="1.0" encoding="UTF-8"?>

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema targetNamespace="http://my/schema/target/namespace"
elementFormDefault="qualified"

<xs:schema targetNamespace="http://www.ibge.gov.br/2014/mgb"
elementFormDefault="qualified"

xmlns:xyz="http://my/schema/target/namespace"
xmlns:xs="http://www.w3.org/2001/XMLSchema"

xmlns:mgb="http://www.ibge.gov.br/2014/mgb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"

xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gmx="http://www.isotc211.org/2005/gmx"

xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gmx="http://www.isotc211.org/2005/gmx"

xmlns:srv="http://www.isotc211.org/2005/srv">

xmlns:srv="http://www.isotc211.org/2005/srv">

<xs:include schemaLocation="schema/xyz.xsd"/>

<xs:include schemaLocation="schema/mgb/mgb.xsd"/>

<xs:import namespace="http://www.isotc211.org/2005/srv"
schemaLocation="schema/srv/srv.xsd"/>

<xs:import namespace="http://www.ibge.gov.br/2014/mgb"
schemaLocation="schema/mgb/mgb.xsd"/>

</xs:schema>

<xs:import namespace="http://www.isotc211.org/2005/srv"
schemaLocation="schema/srv/srv.xsd"/>
</xs:schema>

Criao de Schema Plugin GeoNetwork derivado do ISO19139 (profile)

Slide 7 de 11

Passo a passo
8. Criar os arquivos de customizao/extenso. Deve-se definir o que ser
modificado ou extendido do schema original (ISO19139). No exemplo, iremos
modificar o schema gmd.xsd. Por isso o arquivo principal de customizao
deve incluir o gmd.xsd e posteriormente, o(s) arquivo(s) que ir(o) fazer a(s)
customizao(es) (mgbCitation.xsd) efetivamente.
mgb.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://www.ibge.gov.br/2014/mgb"
xmlns:gmd="http://www.isotc211.org/2005/gmd" elementFormDefault="qualified" version="0.1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:mgb="http://www.ibge.gov.br/2014/mgb">
<xs:annotation>
<xs:documentation>This file consists in the ISO19139 XML schema profile of the NAP-Metadata
profile of ISO19115:2003 == 04-03-2009 ====== </xs:documentation>
</xs:annotation>
<xs:import namespace="http://www.isotc211.org/2005/gmd" schemaLocation="../gmd/gmd.xsd"/>
<xs:include schemaLocation="../mgb/mgbCitation.xsd"/>
</xs:schema>

Criao de Schema Plugin GeoNetwork derivado do ISO19139 (profile)

Slide 8 de 11

Passo a passo
9. Uma das abordagens a ser utilizada na extenso a substituio. No exemplo
a seguir, iremos substituir um elemento para alterar algumas restries do
campo CI_ResponsibleParty do template de metadado.
schemas/gmd/citation.xsd (arquivo original do ISO19139)
(...)
<xs:complexType name="CI_ResponsibleParty_Type">
<xs:annotation>
<xs:documentation>Identification of, and means of communication with, person(s) and organisations associated
with the dataset</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="gco:AbstractObject_Type">
<xs:sequence>
<xs:element name="individualName" type="gco:CharacterString_PropertyType" minOccurs="0"/>
<xs:element name="organisationName" type="gco:CharacterString_PropertyType" minOccurs="0"/>
<xs:element name="positionName" type="gco:CharacterString_PropertyType" minOccurs="0"/>
<xs:element name="contactInfo" type="gmd:CI_Contact_PropertyType" minOccurs="0"/>
<xs:element name="role" type="gmd:CI_RoleCode_PropertyType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- ........................................................................ -->
<xs:element name="CI_ResponsibleParty" type="gmd:CI_ResponsibleParty_Type"/>
<!-- ........................................................................ -->
<xs:complexType name="CI_ResponsibleParty_PropertyType">
<xs:sequence minOccurs="0">
<xs:element ref="gmd:CI_ResponsibleParty"/>
</xs:sequence>
<xs:attributeGroup ref="gco:ObjectReference"/>
<xs:attribute ref="gco:nilReason"/>
</xs:complexType>
(...)

Criao de Schema Plugin GeoNetwork derivado do ISO19139 (profile)

Slide 9 de 11

Passo a passo
schemas/mgb/mgbCitation.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://www.ibge.gov.br/2014/mgb" elementFormDefault="qualified" version="0.1"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:mgb="http://www.ibge.gov.br/2014/mgb">

(...)

(...)

Ref. ao novo elemento


Criao de Schema Plugin GeoNetwork derivado do ISO19139 (profile)

Slide 10 de 11

Tipo modificado

<xs:complexType name="CI_ResponsibleParty_Type" >


<xs:annotation>
<xs:documentation>Identification of, and means of communication with, person(s) and organisations associated
with the dataset</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="gco:AbstractObject_Type">
<xs:sequence>
<xs:element name="individualName" type="gco:CharacterString_PropertyType" />
<xs:element name="organisationName" type="gco:CharacterString_PropertyType" />
<xs:element name="positionName" type="gco:CharacterString_PropertyType" />
<xs:element name="contactInfo" type="gmd:CI_Contact_PropertyType" />
<xs:element name="role" type="gmd:CI_RoleCode_PropertyType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- ........................................................................ -->
<xs:element name="CI_ResponsibleParty" substitutionGroup="gmd:CI_ResponsibleParty" type="mgb:CI_ResponsibleParty_Type"/>
<!-- ........................................................................ -->
<xs:complexType name="CI_ResponsibleParty_PropertyType">
<xs:sequence >
<xs:element ref="mgb:CI_ResponsibleParty"/>
</xs:sequence>
<xs:attributeGroup ref="gco:ObjectReference"/>
<xs:attribute ref="gco:nilReason"/>
Ref. ao tipo modificado
</xs:complexType>
Ref. ao elemento que ser substitudo

Links e referncias

https://www.seegrid.csiro.au/wiki/AppSchemas/MetadataProfiles - artigo sobre


metadata profiles
https://github.com/geonetwork/schema-plugins/ - repositrio de schema plugins
http://osgeo-org.1560.x6.nabble.com/Schema-plugin-and-profile-tt5137125.html Tpico sobre criao de schemas profile em um frum

Criao de Schema Plugin GeoNetwork derivado do ISO19139 (profile)

Slide 11 de 11