Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/NatLibFi/Skosmos into v1.…
Browse files Browse the repository at this point in the history
…7-maintenance
  • Loading branch information
henriyli committed Aug 26, 2016
2 parents 1deb33e + 1acccb0 commit b671a56
Show file tree
Hide file tree
Showing 29 changed files with 160 additions and 201 deletions.
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ See the documentation of each library for details.

The MIT License (MIT)

Copyright (c) 2012-2014 Aalto University and University of Helsinki
Copyright (c) 2012-2013 Aalto University and University of Helsinki
Copyright (c) 2013-2016 University of Helsinki, National library of Finland

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"twitter/bootstrap": "3.2.*",
"twitter/typeahead.js": "v0.10.5",
"willdurand/negotiation": "1.3.*",
"vakata/jstree": "3.2.*",
"vakata/jstree": "3.3.*",
"punic/punic": "1.4.0",
"ml/json-ld": "1.*",
"medialize/uri.js": "1.15.1",
Expand Down
5 changes: 0 additions & 5 deletions controller/Controller.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Handles all the requests from the user and changes the view accordingly.
Expand Down
5 changes: 0 additions & 5 deletions controller/EntityController.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2016 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* EntityController is responsible for redirecting requests to the /entity address.
Expand Down
5 changes: 0 additions & 5 deletions controller/RestController.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* RestController is responsible for handling all the requests directed to the /rest address.
Expand Down
5 changes: 0 additions & 5 deletions controller/WebController.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Importing the dependencies.
Expand Down
5 changes: 0 additions & 5 deletions entity.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2016 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Includes the side wide settings.
Expand Down
5 changes: 0 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Use Composer autoloader to automatically load library classes.
Expand Down
5 changes: 0 additions & 5 deletions model/Breadcrumb.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* A class for breadcrumb concept hierarchy paths
Expand Down
11 changes: 3 additions & 8 deletions model/Concept.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Dataobject for a single concept.
Expand Down Expand Up @@ -108,7 +103,7 @@ public function getDeprecated()
}

/**
* Returns a label for the concept in the ui language or if not possible in any language.
* Returns a label for the concept in the content language or if not possible in any language.
* @return string
*/
public function getLabel()
Expand All @@ -127,8 +122,8 @@ public function getLabel()
// 3. label in any language
$label = $this->resource->label();
// if the label lang code is a subset of the ui lang eg. en-GB
if ($label !== null && strpos($label->getLang(), $this->getEnvLang() . '-') === 0) {
return $label->getValue();
if ($label !== null && strpos($label->getLang(), $lang . '-') === 0) {
return EasyRdf_Literal::create($label, $lang);
}

if ($label !== null) {
Expand Down
5 changes: 0 additions & 5 deletions model/DataObject.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Dataobject wraps EasyRdf resources and provides access to the data.
Expand Down
5 changes: 0 additions & 5 deletions model/Model.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Setting some often needed namespace prefixes
Expand Down
5 changes: 0 additions & 5 deletions model/NamespaceExposingTurtleParser.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2016 University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

class NamespaceExposingTurtleParser extends EasyRdf_Parser_Turtle
{
Expand Down
5 changes: 0 additions & 5 deletions model/Request.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Provides access to the http request information
Expand Down
5 changes: 0 additions & 5 deletions model/Vocabulary.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Vocabulary dataobjects provide access to the vocabularies on the SPARQL endpoint.
Expand Down
5 changes: 0 additions & 5 deletions model/VocabularyCategory.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Groups vocabularies of a specific category into a DataObject.
Expand Down
5 changes: 0 additions & 5 deletions model/VocabularyDataObject.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Wraps a vocabulary object in the DataObject class.
Expand Down
20 changes: 10 additions & 10 deletions model/sparql/GenericSparql.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/**
* Generates SPARQL queries and provides access to the SPARQL endpoint.
Expand Down Expand Up @@ -842,10 +837,10 @@ protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $p
* the structure is unpacked to get back the original string. Phew!
*/
$hitvar = $unique ? '(MIN(?matchstr) AS ?hit)' : '(?matchstr AS ?hit)';
$hitgroup = $unique ? 'GROUP BY ?s ?label' : '';
$hitgroup = $unique ? 'GROUP BY ?s ?label ?notation' : '';

$query = <<<EOQ
SELECT DISTINCT ?s ?label $hitvar
SELECT DISTINCT ?s ?label ?notation $hitvar
WHERE {
$graphClause {
$valuesProp
Expand All @@ -860,6 +855,7 @@ protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $p
} $labelcondFallback
BIND(IF(langMatches(LANG(?match),'$lang'), ?pri, ?pri+1) AS ?npri)
BIND(CONCAT(STR(?npri), LANG(?match), '@', STR(?match)) AS ?matchstr)
OPTIONAL { ?s skos:notation ?notation }
}
$filterGraph
}
Expand Down Expand Up @@ -915,7 +911,7 @@ protected function generateConceptSearchQuery($fields, $unique, $params) {
$innerquery = $this->generateConceptSearchQueryInner($params->getSearchTerm(), $params->getLang(), $params->getSearchLang(), $props, $unique, $filterGraph);

$query = <<<EOQ
SELECT DISTINCT ?s ?label ?plabel ?alabel ?hlabel ?graph (GROUP_CONCAT(DISTINCT ?type) as ?types)
SELECT DISTINCT ?s ?label ?plabel ?alabel ?hlabel ?graph ?notation (GROUP_CONCAT(DISTINCT ?type) as ?types)
$extravars
WHERE {
$gcl {
Expand All @@ -937,7 +933,7 @@ protected function generateConceptSearchQuery($fields, $unique, $params) {
}
$filterGraph
}
GROUP BY ?s ?match ?label ?plabel ?alabel ?hlabel ?graph
GROUP BY ?s ?match ?label ?plabel ?alabel ?hlabel ?notation ?graph
ORDER BY LCASE(STR(?match)) LANG(?match) $orderextra
EOQ;
return $query;
Expand Down Expand Up @@ -1009,6 +1005,10 @@ private function transformConceptSearchResult($row, $vocabs, $fields)
$hit['lang'] = $row->label->getLang();
}

if (isset($row->notation)) {
$hit['notation'] = $row->notation->getValue();
}

if (isset($row->plabel)) {
$hit['matchedPrefLabel'] = $row->plabel->getValue();
$hit['lang'] = $row->plabel->getLang();
Expand Down Expand Up @@ -1736,7 +1736,7 @@ private function transformParentListResults($result, $lang)
}
if (isset($row->label)) {
$preflabel = $row->label->getValue();
if ($row->label->getLang() !== $lang) {
if ($row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang) !== 0) {
$preflabel .= ' (' . $row->label->getLang() . ')';
}

Expand Down
5 changes: 0 additions & 5 deletions model/sparql/JenaTextSparql.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php
/**
* Copyright (c) 2012-2013 Aalto University and University of Helsinki
* MIT License
* see LICENSE.txt for more information
*/

/* Register text: namespace needed for jena-text queries */
EasyRdf_Namespace::set('text', 'http://jena.apache.org/text#'); // @codeCoverageIgnore
Expand Down
Loading

0 comments on commit b671a56

Please sign in to comment.