New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow IRI export, ref 517, 2188 #2207

Merged
merged 1 commit into from Jan 22, 2017

Conversation

Projects
None yet
2 participants
@mwjames
Contributor

mwjames commented Jan 22, 2017

This PR is made in reference to: #517, #2188

This PR addresses or contains:

  • Adds smwgExportResourcesAsIri as experimental setting (disabled by default) to allow exporting of IRIs as outlined in [0]

This PR includes:

  • Tests (unit/integration)
  • CI build passed

[0] https://www.w3.org/TR/rdf11-concepts/#section-IRIs

@mwjames mwjames added the enhancement label Jan 22, 2017

@mwjames mwjames added this to the SMW 2.5.0 milestone Jan 22, 2017

@mwjames

This comment has been minimized.

Contributor

mwjames commented Jan 22, 2017

I tried to be careful and added extra tests so that the possibility of an export regression is/was minimized.

As for the PR, based on the the reported #2188 issue the output with $wgLanguageCode = "ru"; and $GLOBALS['smwgExportResourcesAsIri'] = false; will now export something similar to what can be seen below. It further means that even if you don't switch the setting, the export failure as it occurred in #2188 should no longer appear.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF[
	<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
	<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
	<!ENTITY owl 'http://www.w3.org/2002/07/owl#'>
	<!ENTITY swivt 'http://semantic-mediawiki.org/swivt/1.0#'>
	<!ENTITY wiki 'http://example.org/id/'>
	<!ENTITY category 'http://example.org/id/Category-3A'>
	<!ENTITY property 'http://example.org/id/Property-3A'>
	<!ENTITY wikiurl 'http://127.0.0.1:8080/wiki/index.php/'>
]>

<rdf:RDF
	xmlns:rdf="&rdf;"
	xmlns:rdfs="&rdfs;"
	xmlns:owl ="&owl;"
	xmlns:swivt="&swivt;"
	xmlns:wiki="&wiki;"
	xmlns:category="&category;"
	xmlns:property="&property;">

	<owl:Ontology rdf:about="http://127.0.0.1:8080/wiki/index.php/Special:ExportRDF/-D0-9A-D0-9B-D0-AE-D0-A7-D0-95-D0-92-D0-AB-D0-95_-D0-A1-D0-9F-D0-98-D0-A1-D0-9A-D0-98">
		<swivt:creationDate rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2017-01-22T11:22:24+01:00</swivt:creationDate>
		<owl:imports rdf:resource="http://semantic-mediawiki.org/swivt/1.0"/>
	</owl:Ontology>
	<swivt:Subject rdf:about="http://example.org/id/-D0-9A-D0-9B-D0-AE-D0-A7-D0-95-D0-92-D0-AB-D0-95_-D0-A1-D0-9F-D0-98-D0-A1-D0-9A-D0-98">
		<rdfs:label>КЛЮЧЕВЫЕ СПИСКИ</rdfs:label>
		<rdfs:isDefinedBy rdf:resource="http://127.0.0.1:8080/wiki/index.php/Special:ExportRDF/-D0-9A-D0-9B-D0-AE-D0-A7-D0-95-D0-92-D0-AB-D0-95_-D0-A1-D0-9F-D0-98-D0-A1-D0-9A-D0-98"/>
		<swivt:page rdf:resource="http://127.0.0.1:8080/wiki/index.php/-D0-9A-D0-9B-D0-AE-D0-A7-D0-95-D0-92-D0-AB-D0-95_-D0-A1-D0-9F-D0-98-D0-A1-D0-9A-D0-98"/>
		<swivt:wikiNamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</swivt:wikiNamespace>
		<swivt:wikiPageContentLanguage rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ru</swivt:wikiPageContentLanguage>
		<property:AID rdf:resource="http://anthecology.org/index.php?title=КЛЮЧЕВЫЕ_СПИСКИ"/>
		<property:Has_query rdf:resource="&wiki;-D0-9A-D0-9B-D0-AE-D0-A7-D0-95-D0-92-D0-AB-D0-95_-D0-A1-D0-9F-D0-98-D0-A1-D0-9A-D0-98-23_QUERY7dd0144e967b67650d47b48e360850ac"/>
		<swivt:wikiPageModificationDate rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2017-01-18T17:23:43Z</swivt:wikiPageModificationDate>
		<property:Modification_date-23aux rdf:datatype="http://www.w3.org/2001/XMLSchema#double">2457772.2248032</property:Modification_date-23aux>
		<swivt:wikiPageSortKey rdf:datatype="http://www.w3.org/2001/XMLSchema#string">КЛЮЧЕВЫЕ СПИСКИ</swivt:wikiPageSortKey>
		<property:Page_creator rdf:resource="&wiki;-D0-A3-D1-87-D0-B0-D1-81-D1-82-D0-BD-D0-B8-D0-BA-3A127.0.0.1"/>
		<property:Number_of_revisions rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1</property:Number_of_revisions>
		<property:Page_ID rdf:datatype="http://www.w3.org/2001/XMLSchema#double">948</property:Page_ID>
		<property:Revision_ID rdf:datatype="http://www.w3.org/2001/XMLSchema#double">4584</property:Revision_ID>
		<property:DOI rdf:datatype="http://www.w3.org/2001/XMLSchema#string">10.1657/1523-0430-41.1.103</property:DOI>
		<wiki:Property-3A-D0-90-D0-B2-D1-82-D0-BE-D1-80 rdf:resource="&wiki;Garcia-2Dcamacho-2Dr"/>
		<wiki:Property-3A-D0-90-D0-B2-D1-82-D0-BE-D1-80 rdf:resource="&wiki;Totland-2Do"/>
		<wiki:Property-3A-D0-93-D0-BE-D0-B4 rdf:resource="&wiki;2009"/>
		<wiki:Property-3A-D0-96-D1-83-D1-80-D0-BD-D0-B0-D0-BB rdf:resource="&wiki;Arctic-2Dantarctic-2Dand-2Dalpine-2Dresearch"/>
		<wiki:Property-3A-D0-97-D0-B0-D0-B3-D0-BE-D0-BB-D0-BE-D0-B2-D0-BE-D0-BA rdf:resource="&wiki;Pollen_Limitation_in_the_Alpine-3A_a_Meta-2DAnalysis"/>
		<wiki:Property-3A-D0-A2-D0-B8-D0-BF_-D0-BF-D1-83-D0-B1-D0-BB-D0-B8-D0-BA-D0-B0-D1-86-D0-B8-D0-B8 rdf:resource="&wiki;-D0-A1-D1-82-D0-B0-D1-82-D1-8C-D1-8F"/>
		<wiki:Property-3A-D0-A7-D0-B8-D1-81-D0-BB-D0-BE_-D1-81-D1-82-D1-80-D0-B0-D0-BD-D0-B8-D1-86 rdf:resource="&wiki;1"/>
	</swivt:Subject>
	<swivt:Subject rdf:about="http://example.org/id/-D0-9A-D0-9B-D0-AE-D0-A7-D0-95-D0-92-D0-AB-D0-95_-D0-A1-D0-9F-D0-98-D0-A1-D0-9A-D0-98-23_QUERY7dd0144e967b67650d47b48e360850ac">
		<swivt:masterPage rdf:resource="&wiki;-D0-9A-D0-9B-D0-AE-D0-A7-D0-95-D0-92-D0-AB-D0-95_-D0-A1-D0-9F-D0-98-D0-A1-D0-9A-D0-98"/>
		<swivt:wikiNamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</swivt:wikiNamespace>
		<property:Query_depth rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1</property:Query_depth>
		<property:Query_format rdf:datatype="http://www.w3.org/2001/XMLSchema#string">list</property:Query_format>
		<property:Query_size rdf:datatype="http://www.w3.org/2001/XMLSchema#double">3</property:Query_size>
		<property:Query_string rdf:datatype="http://www.w3.org/2001/XMLSchema#string">[[:Категория:Публикации]] [[Исходящая ссылка::КЛЮЧЕВЫЕ СПИСКИ]]</property:Query_string>
		<swivt:wikiPageSortKey rdf:datatype="http://www.w3.org/2001/XMLSchema#string">КЛЮЧЕВЫЕ СПИСКИ</swivt:wikiPageSortKey>
	</swivt:Subject>
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#creationDate" />
	<owl:ObjectProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#page" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiNamespace" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiPageContentLanguage" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3AAID" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3AHas_query" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiPageModificationDate" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3AModification_date-23aux" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiPageSortKey" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3APage_creator" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3ANumber_of_revisions" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3APage_ID" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3ARevision_ID" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3ADOI" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3A-D0-90-D0-B2-D1-82-D0-BE-D1-80" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3A-D0-93-D0-BE-D0-B4" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3A-D0-96-D1-83-D1-80-D0-BD-D0-B0-D0-BB" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3A-D0-97-D0-B0-D0-B3-D0-BE-D0-BB-D0-BE-D0-B2-D0-BE-D0-BA" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3A-D0-A2-D0-B8-D0-BF_-D0-BF-D1-83-D0-B1-D0-BB-D0-B8-D0-BA-D0-B0-D1-86-D0-B8-D0-B8" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3A-D0-A7-D0-B8-D1-81-D0-BB-D0-BE_-D1-81-D1-82-D1-80-D0-B0-D0-BD-D0-B8-D1-86" />
	<owl:ObjectProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#masterPage" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3AQuery_depth" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3AQuery_format" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3AQuery_size" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3AQuery_string" />
	<!-- Created by Semantic MediaWiki, https://www.semantic-mediawiki.org/ -->
</rdf:RDF>

The output with $wgLanguageCode = "ru"; and $GLOBALS['smwgExportResourcesAsIri'] = true; is to produce:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF[
	<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
	<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
	<!ENTITY owl 'http://www.w3.org/2002/07/owl#'>
	<!ENTITY swivt 'http://semantic-mediawiki.org/swivt/1.0#'>
	<!ENTITY wiki 'http://example.org/id/'>
	<!ENTITY category 'http://example.org/id/Category-3A'>
	<!ENTITY property 'http://example.org/id/Property-3A'>
	<!ENTITY wikiurl 'http://127.0.0.1:8080/wiki/index.php/'>
]>

<rdf:RDF
	xmlns:rdf="&rdf;"
	xmlns:rdfs="&rdfs;"
	xmlns:owl ="&owl;"
	xmlns:swivt="&swivt;"
	xmlns:wiki="&wiki;"
	xmlns:category="&category;"
	xmlns:property="&property;">

	<owl:Ontology rdf:about="http://127.0.0.1:8080/wiki/index.php/Special:ExportRDF/КЛЮЧЕВЫЕ_СПИСКИ">
		<swivt:creationDate rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2017-01-22T11:24:00+01:00</swivt:creationDate>
		<owl:imports rdf:resource="http://semantic-mediawiki.org/swivt/1.0"/>
	</owl:Ontology>
	<swivt:Subject rdf:about="http://example.org/id/КЛЮЧЕВЫЕ_СПИСКИ">
		<rdfs:label>КЛЮЧЕВЫЕ СПИСКИ</rdfs:label>
		<rdfs:isDefinedBy rdf:resource="http://127.0.0.1:8080/wiki/index.php/Special:ExportRDF/КЛЮЧЕВЫЕ_СПИСКИ"/>
		<swivt:page rdf:resource="http://127.0.0.1:8080/wiki/index.php/КЛЮЧЕВЫЕ_СПИСКИ"/>
		<swivt:wikiNamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</swivt:wikiNamespace>
		<swivt:wikiPageContentLanguage rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ru</swivt:wikiPageContentLanguage>
		<property:AID rdf:resource="http://anthecology.org/index.php?title=КЛЮЧЕВЫЕ_СПИСКИ"/>
		<property:Has_query rdf:resource="&wiki;КЛЮЧЕВЫЕ_СПИСКИ-23_QUERY7dd0144e967b67650d47b48e360850ac"/>
		<swivt:wikiPageModificationDate rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2017-01-18T17:23:43Z</swivt:wikiPageModificationDate>
		<property:Modification_date-23aux rdf:datatype="http://www.w3.org/2001/XMLSchema#double">2457772.2248032</property:Modification_date-23aux>
		<swivt:wikiPageSortKey rdf:datatype="http://www.w3.org/2001/XMLSchema#string">КЛЮЧЕВЫЕ СПИСКИ</swivt:wikiPageSortKey>
		<property:Page_creator rdf:resource="&wiki;Участник-3A127.0.0.1"/>
		<property:Number_of_revisions rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1</property:Number_of_revisions>
		<property:Page_ID rdf:datatype="http://www.w3.org/2001/XMLSchema#double">948</property:Page_ID>
		<property:Revision_ID rdf:datatype="http://www.w3.org/2001/XMLSchema#double">4584</property:Revision_ID>
		<property:DOI rdf:datatype="http://www.w3.org/2001/XMLSchema#string">10.1657/1523-0430-41.1.103</property:DOI>
		<property:Автор rdf:resource="&wiki;Garcia-2Dcamacho-2Dr"/>
		<property:Автор rdf:resource="&wiki;Totland-2Do"/>
		<property:Год rdf:resource="&wiki;2009"/>
		<property:Журнал rdf:resource="&wiki;Arctic-2Dantarctic-2Dand-2Dalpine-2Dresearch"/>
		<property:Заголовок rdf:resource="&wiki;Pollen_Limitation_in_the_Alpine-3A_a_Meta-2DAnalysis"/>
		<property:Тип_публикации rdf:resource="&wiki;Статья"/>
		<property:Число_страниц rdf:resource="&wiki;1"/>
	</swivt:Subject>
	<swivt:Subject rdf:about="http://example.org/id/КЛЮЧЕВЫЕ_СПИСКИ-23_QUERY7dd0144e967b67650d47b48e360850ac">
		<swivt:masterPage rdf:resource="&wiki;КЛЮЧЕВЫЕ_СПИСКИ"/>
		<swivt:wikiNamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</swivt:wikiNamespace>
		<property:Query_depth rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1</property:Query_depth>
		<property:Query_format rdf:datatype="http://www.w3.org/2001/XMLSchema#string">list</property:Query_format>
		<property:Query_size rdf:datatype="http://www.w3.org/2001/XMLSchema#double">3</property:Query_size>
		<property:Query_string rdf:datatype="http://www.w3.org/2001/XMLSchema#string">[[:Категория:Публикации]] [[Исходящая ссылка::КЛЮЧЕВЫЕ СПИСКИ]]</property:Query_string>
		<swivt:wikiPageSortKey rdf:datatype="http://www.w3.org/2001/XMLSchema#string">КЛЮЧЕВЫЕ СПИСКИ</swivt:wikiPageSortKey>
	</swivt:Subject>
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#creationDate" />
	<owl:ObjectProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#page" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiNamespace" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiPageContentLanguage" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3AAID" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3AHas_query" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiPageModificationDate" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3AModification_date-23aux" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiPageSortKey" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3APage_creator" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3ANumber_of_revisions" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3APage_ID" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3ARevision_ID" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3ADOI" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3AАвтор" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3AГод" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3AЖурнал" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3AЗаголовок" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3AТип_публикации" />
	<owl:ObjectProperty rdf:about="http://example.org/id/Property-3AЧисло_страниц" />
	<owl:ObjectProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#masterPage" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3AQuery_depth" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3AQuery_format" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3AQuery_size" />
	<owl:DatatypeProperty rdf:about="http://example.org/id/Property-3AQuery_string" />
	<!-- Created by Semantic MediaWiki, https://www.semantic-mediawiki.org/ -->
</rdf:RDF>

@mwjames mwjames merged commit 50d10bc into master Jan 22, 2017

3 checks passed

Scrutinizer 17 new issues, 4 updated code elements
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@mwjames mwjames deleted the export-iri branch Jan 22, 2017

@kghbln

This comment has been minimized.

Member

kghbln commented Oct 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment