[MediaWiki-commits] [Gerrit] changed namespaces a bit, added license - change (mediawiki...Wikibase)

2013-05-22 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: changed namespaces a bit, added license
..


changed namespaces a bit, added license

namespace for data and entity come now directly from
the settings. also a cc-license is added. the license
is not changeable in the settings for now.

Change-Id: Iea1d34372ba30466d8b76a3650c95cfabadc21dd
---
M repo/includes/WikibaseRepo.php
M repo/includes/rdf/RdfBuilder.php
M repo/includes/rdf/RdfSerializer.php
M repo/includes/specials/SpecialEntityData.php
M repo/tests/phpunit/includes/WikibaseRepoTest.php
M repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
M repo/tests/phpunit/includes/rdf/RdfSerializerTest.php
7 files changed, 51 insertions(+), 32 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php
index d63ec1b..e2735dd 100644
--- a/repo/includes/WikibaseRepo.php
+++ b/repo/includes/WikibaseRepo.php
@@ -114,6 +114,7 @@
 
$uri = $wgServer;
$uri = preg_replace( '!^//!', 'http://', $uri );
+   $uri = $uri . '/entity/';
return $uri;
}
 
diff --git a/repo/includes/rdf/RdfBuilder.php b/repo/includes/rdf/RdfBuilder.php
index 2267357..38fb7e7 100755
--- a/repo/includes/rdf/RdfBuilder.php
+++ b/repo/includes/rdf/RdfBuilder.php
@@ -49,16 +49,17 @@
const NS_ONTOLOGY =  'wikibase'; // wikibase ontology (shared)
const NS_ENTITY ='entity';   // concept uris
const NS_DATA =  'data'; // document uris
-   const NS_PROPERTY =  'p'; // entity - value
const NS_VALUE = 'v'; // statement - value
const NS_QUALIFIER = 'q'; // statement - qualifier
const NS_STATEMENT = 's'; // entity - statement
 
const NS_SKOS = 'skos'; // SKOS vocabulary
const NS_SCHEMA_ORG = 'schema'; // schema.org vocabulary
+   const NS_CC = 'cc';
 
const SKOS_URI = 'http://www.w3.org/2004/02/skos/core#';
const SCHEMA_ORG_URI = 'http://schema.org/';
+   const CC_URI = 'http://creativecommons.org/ns#';
 
const WIKIBASE_STATEMENT_QNAME = 'wikibase:Statement';
 
@@ -86,6 +87,7 @@
 */
public function __construct(
$baseUri,
+   $dataUri,
EntityIdFormatter $idFormatter,
EasyRdf_Graph $graph = null
) {
@@ -95,18 +97,19 @@
 
$this-graph = $graph;
$this-baseUri = $baseUri;
+   $this-dataUri = $dataUri;
$this-idFormatter = $idFormatter;
 
$this-namespaces = array(
self::NS_ONTOLOGY = self::ONTOLOGY_BASE_URI,
-   self::NS_DATA = $this-baseUri . '/data/',
-   self::NS_ENTITY = $this-baseUri . '/entity/',
-   self::NS_PROPERTY = $this-baseUri . '/property/',
-   self::NS_VALUE = $this-baseUri . '/value/',
-   self::NS_QUALIFIER = $this-baseUri . '/qualifier/',
-   self::NS_STATEMENT = $this-baseUri . '/statement/',
+   self::NS_DATA = $this-dataUri,
+   self::NS_ENTITY = $this-baseUri,
+   self::NS_VALUE = $this-baseUri . 'value/',
+   self::NS_QUALIFIER = $this-baseUri . 'qualifier/',
+   self::NS_STATEMENT = $this-baseUri . 'statement/',
self::NS_SKOS = self::SKOS_URI,
self::NS_SCHEMA_ORG = self::SCHEMA_ORG_URI,
+   self::NS_CC = self::CC_URI,
);
 
//XXX: Ugh, static. Should go into $this-graph.
@@ -154,7 +157,7 @@
 * @return string
 */
public function getEntityQName( $prefix, EntityId $id ) {
-   return $prefix . ':' . $this-idFormatter-format( $id );
+   return $prefix . ':' . ucfirst( $this-idFormatter-format( $id 
) );
}
 
/**
@@ -205,7 +208,7 @@
 */
public function getDataURL( EntityId $id ) {
$base = $this-namespaces[ self::NS_DATA ];
-   $url = $base . $this-idFormatter-format( $id );
+   $url = $base . ucfirst( $this-idFormatter-format( $id ) );
return $url;
}
 
@@ -253,12 +256,13 @@
public function addEntityMetaData( Entity $entity, Revision $rev = null 
) {
$entityResource = $this-getEntityResource( $entity-getId() );
$entityResource-addResource( 'rdf:type', 
$this-getEntityTypeQName( $entity-getType() ) );
-
-   $dataResource = $this-graph-resource( '#' ); // this 
document
$dataURL = $this-getDataURL( $entity-getId() );
-   $dataResource-addResource( self::NS_SCHEMA_ORG . ':about', 
$entityResource );
-

[MediaWiki-commits] [Gerrit] changed namespaces a bit, added license - change (mediawiki...Wikibase)

2013-05-19 Thread Denny Vrandecic (Code Review)
Denny Vrandecic has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/64538


Change subject: changed namespaces a bit, added license
..

changed namespaces a bit, added license

Change-Id: Iea1d34372ba30466d8b76a3650c95cfabadc21dd
---
M repo/includes/rdf/RdfBuilder.php
1 file changed, 16 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/38/64538/1

diff --git a/repo/includes/rdf/RdfBuilder.php b/repo/includes/rdf/RdfBuilder.php
index 2267357..da8aadd 100755
--- a/repo/includes/rdf/RdfBuilder.php
+++ b/repo/includes/rdf/RdfBuilder.php
@@ -56,9 +56,11 @@
 
const NS_SKOS = 'skos'; // SKOS vocabulary
const NS_SCHEMA_ORG = 'schema'; // schema.org vocabulary
+   const NS_CC = 'cc';
 
const SKOS_URI = 'http://www.w3.org/2004/02/skos/core#';
const SCHEMA_ORG_URI = 'http://schema.org/';
+   const CC_URI = 'http://creativecommons.org/ns#';
 
const WIKIBASE_STATEMENT_QNAME = 'wikibase:Statement';
 
@@ -99,14 +101,15 @@
 
$this-namespaces = array(
self::NS_ONTOLOGY = self::ONTOLOGY_BASE_URI,
-   self::NS_DATA = $this-baseUri . '/data/',
+   self::NS_DATA = $this-baseUri . '/entity/',
self::NS_ENTITY = $this-baseUri . '/entity/',
-   self::NS_PROPERTY = $this-baseUri . '/property/',
-   self::NS_VALUE = $this-baseUri . '/value/',
-   self::NS_QUALIFIER = $this-baseUri . '/qualifier/',
-   self::NS_STATEMENT = $this-baseUri . '/statement/',
+   self::NS_PROPERTY = $this-baseUri . '/entity/',
+   self::NS_VALUE = $this-baseUri . '/entity/value/',
+   self::NS_QUALIFIER = $this-baseUri . 
'/entity/qualifier/',
+   self::NS_STATEMENT = $this-baseUri . 
'/entity/statement/',
self::NS_SKOS = self::SKOS_URI,
self::NS_SCHEMA_ORG = self::SCHEMA_ORG_URI,
+   self::NS_CC = self::CC_URI,
);
 
//XXX: Ugh, static. Should go into $this-graph.
@@ -154,7 +157,7 @@
 * @return string
 */
public function getEntityQName( $prefix, EntityId $id ) {
-   return $prefix . ':' . $this-idFormatter-format( $id );
+   return $prefix . ':' . ucfirst( $this-idFormatter-format( $id 
) );
}
 
/**
@@ -205,7 +208,7 @@
 */
public function getDataURL( EntityId $id ) {
$base = $this-namespaces[ self::NS_DATA ];
-   $url = $base . $this-idFormatter-format( $id );
+   $url = $base . ucfirst( $this-idFormatter-format( $id ) ) . 
'.rdf';
return $url;
}
 
@@ -253,12 +256,12 @@
public function addEntityMetaData( Entity $entity, Revision $rev = null 
) {
$entityResource = $this-getEntityResource( $entity-getId() );
$entityResource-addResource( 'rdf:type', 
$this-getEntityTypeQName( $entity-getType() ) );
-
-   $dataResource = $this-graph-resource( '#' ); // this 
document
$dataURL = $this-getDataURL( $entity-getId() );
-   $dataResource-addResource( self::NS_SCHEMA_ORG . ':about', 
$entityResource );
-   $dataResource-addResource( self::NS_SCHEMA_ORG . ':url', 
$dataURL );
+
+   $dataResource = $this-graph-resource( $dataURL ); // this 
document
$dataResource-addResource( 'rdf:type', self::NS_SCHEMA_ORG . 
:Dataset );
+   $dataResource-addResource( self::NS_SCHEMA_ORG . ':about', 
$entityResource );
+   $dataResource-addResource( self::NS_CC . ':license', 
'http://creativecommons.org/publicdomain/zero/1.0/' );
 
if ( $rev ) {
$dataResource-addLiteral( self::NS_SCHEMA_ORG . 
':version', $rev-getId() );
@@ -346,9 +349,9 @@
$url = wfExpandUrl( $link-getUrl(), PROTO_HTTP );
$pageRecourse = $this-graph-resource( $url );
 
-   $pageRecourse-addResource( self::NS_SCHEMA_ORG . 
':about', $entityResource );
-   $pageRecourse-addResource( self::NS_SCHEMA_ORG . 
':inLanguage', $languageCode );
$pageRecourse-addResource( 'rdf:type', 
self::NS_SCHEMA_ORG . ':Article' );
+   $pageRecourse-addResource( self::NS_SCHEMA_ORG . 
':about', $entityResource );
+   $pageRecourse-addLiteral( self::NS_SCHEMA_ORG . 
':inLanguage', $languageCode );
}
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/64538
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: