Commit 5180ccb9 authored by Kristoffer Moe's avatar Kristoffer Moe
Browse files

Merge branch 'release/0.4.0'

parents aedc0922 08cb62c9
......@@ -14,6 +14,7 @@ The resulting compose file can then be used with `docker-compose up -d` to provi
# Releases
## 0.3.0 (2016-11-09)
GITREF: 5eb52acd085ec5e88c19020a9c49ad44250bda68
KOHA: 90437fe3ee4e3d5af59182d7f3be477940b484f4
- patron-client:
......
......@@ -96,6 +96,11 @@ module.exports = (app) => {
{
rdfProperty: 'specification',
type: 'input-string-large'
},
{
label: 'Alternativt navn',
rdfProperty: 'alternativeName',
type: 'input-string'
}
]
},
......@@ -115,6 +120,11 @@ module.exports = (app) => {
{
rdfProperty: 'specification',
type: 'input-string-large'
},
{
label: 'Alternativt navn',
rdfProperty: 'alternativeName',
type: 'input-string'
}
]
},
......@@ -146,6 +156,11 @@ module.exports = (app) => {
label: 'Forklarende tilføyelse',
rdfProperty: 'specification',
type: 'input-string'
},
{
label: 'Alternativt navn',
rdfProperty: 'alternativeName',
type: 'input-string'
}
]
},
......@@ -236,6 +251,11 @@ module.exports = (app) => {
rdfProperty: 'specification',
type: 'input-string'
// input type must be defined explicitly, otherwise it will inherit from the search field above
},
{
label: 'Alternativt navn',
rdfProperty: 'alternativeName',
type: 'input-string'
}
]
},
......@@ -272,6 +292,11 @@ module.exports = (app) => {
label: 'Forklarende tilføyelse',
rdfProperty: 'specification',
type: 'input-string'
},
{
label: 'Alternativt navn',
rdfProperty: 'alternativeName',
type: 'input-string'
}
]
},
......@@ -317,6 +342,11 @@ module.exports = (app) => {
label: 'Forklarende tilføyelse',
rdfProperty: 'specification',
type: 'input-string'
},
{
label: 'Alternativt navn',
rdfProperty: 'alternativeName',
type: 'input-string'
}
]
},
......@@ -335,6 +365,11 @@ module.exports = (app) => {
label: 'Forklarende tilføyelse',
rdfProperty: 'specification',
type: 'input-string'
},
{
label: 'Alternativt navn',
rdfProperty: 'alternativeName',
type: 'input-string'
}
]
}
......
......@@ -79,7 +79,7 @@ class SearchHeader extends React.Component {
registrationLink () {
if (!this.props.isLoggedIn) {
return (
<li>
<li data-automation-id="registration_element">
<a onClick={this.handleRegistrationClick}
title="register"><FormattedMessage {...messages.register} /><span>&raquo;</span></a>
</li>
......
......@@ -8,6 +8,9 @@
},
"specification": {
"type": "String"
},
"alternativeName": {
"type": "string"
}
}
}
\ No newline at end of file
......@@ -10,6 +10,9 @@
"type": "string",
"index": "analyzed",
"analyzer": "name_analyzer"
},
"alternativeName": {
"type": "string"
}
}
}
\ No newline at end of file
......@@ -14,6 +14,9 @@
},
"date": {
"type": "String"
},
"alternativeName": {
"type": "string"
}
}
}
\ No newline at end of file
......@@ -7,6 +7,9 @@
},
"specification": {
"type": "String"
},
"alternativeName": {
"type": "string"
}
}
}
\ No newline at end of file
......@@ -8,6 +8,9 @@
},
"specification": {
"type": "String"
},
"alternativeName": {
"type": "string"
}
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@
"@context": {
"specification": "deichman:specification",
"prefLabel": "deichman:prefLabel",
"alternativeName": "deichman:alternativeName",
"CompositionType": "deichman:CompositionType",
"deichman": "__ONTOLOGY__",
"type": "@type",
......
......@@ -3,7 +3,8 @@ PREFIX : <__ONTOLOGY__>
CONSTRUCT {
?compositionTypeUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :CompositionType ;
:prefLabel ?label ;
:specification ?specification .
:specification ?specification ;
:alternativeName ?alternativeName .
}
WHERE {
......@@ -11,4 +12,5 @@ WHERE {
?compositionTypeUri a :CompositionType .
OPTIONAL { ?compositionTypeUri :prefLabel ?label }
OPTIONAL { ?compositionTypeUri :specification ?specification }
OPTIONAL { ?compositionTypeUri :alternativeName ?alternativeName }
}
......@@ -3,6 +3,7 @@
"@context": {
"deichman": "__ONTOLOGY__",
"name": "deichman:name",
"alternativeName": "deichman:alternativeName",
"subdivision": "deichman:subdivision",
"specification": "deichman:specification",
"Corporation": "deichman:Corporation",
......
PREFIX : <__ONTOLOGY__>
CONSTRUCT
{ ?corporationUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :Corporation .
?corporationUri :name ?name .
?corporationUri :subdivision ?subdivision .
?corporationUri :specification ?specification .
{ ?corporationUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :Corporation ;
:name ?name ;
:subdivision ?subdivision ;
:specification ?specification ;
:alternativeName ?alternativeName .
}
WHERE
{ SELECT DISTINCT ?corporationUri ?name ?subdivision ?specification
{ SELECT DISTINCT ?corporationUri ?name ?subdivision ?specification ?alternativeName
WHERE
{ BIND(uri("__CORPORATIONURI__") AS ?corporationUri)
?corporationUri a :Corporation ;
......@@ -21,5 +22,8 @@ WHERE
OPTIONAL
{ ?corporationUri :specification ?specification
}
OPTIONAL
{ ?corporationUri :alternativeName ?alternativeName
}
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@
"@context": {
"specification": "deichman:specification",
"prefLabel": "deichman:prefLabel",
"alternativeName": "deichman:alternativeName",
"ordinal": "deichman:ordinal",
"date": "deichman:date",
"Event": "deichman:Event",
......
......@@ -5,13 +5,15 @@ CONSTRUCT {
:prefLabel ?label ;
:specification ?specification ;
:ordinal ?ordinal ;
:date ?date .
:date ?date ;
:alternativeName ?alternativeName .
}
WHERE {
BIND(uri("__EVENTURI__") AS ?eventUri)
?eventUri a :Event .
OPTIONAL { ?eventUri :prefLabel ?label }
OPTIONAL { ?eventUri :alternativeName ?alternativeName }
OPTIONAL { ?eventUri :specification ?specification }
OPTIONAL { ?eventUri :ordinal ?ordinal }
OPTIONAL { ?eventUri :date ?date }
......
......@@ -3,6 +3,7 @@
"@context": {
"deichman": "__ONTOLOGY__",
"prefLabel": "deichman:prefLabel",
"alternativeName": "deichman:alternativeName",
"specification": "deichman:specification",
"Genre": "deichman:Genre",
"type": "@type",
......
PREFIX : <__ONTOLOGY__>
CONSTRUCT
{ ?genreUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :Genre .
?genreUri :prefLabel ?prefLabel .
?genreUri :specification ?specification .
{ ?genreUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :Genre ;
:prefLabel ?prefLabel ;
:specification ?specification ;
:alternativeName ?alternativeName .
}
WHERE
{ SELECT DISTINCT ?genreUri ?prefLabel ?specification
{ SELECT DISTINCT ?genreUri ?prefLabel ?specification ?alternativeName
WHERE
{ BIND(uri("__GENREURI__") AS ?genreUri)
?genreUri a :Genre ;
......@@ -17,5 +18,8 @@ WHERE
OPTIONAL
{ ?genreUri :specification ?specification
}
OPTIONAL
{ ?genreUri :alternativeName ?alternativeName .
}
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@
"@context": {
"specification": "deichman:specification",
"prefLabel": "deichman:prefLabel",
"alternativeName": "deichman:alternativeName",
"Instrument": "deichman:Instrument",
"deichman": "__ONTOLOGY__",
"type": "@type",
......
......@@ -3,7 +3,8 @@ PREFIX : <__ONTOLOGY__>
CONSTRUCT {
?instrumentUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :Instrument ;
:prefLabel ?label ;
:specification ?specification .
:specification ?specification ;
:alternativeName ?alternativeName .
}
WHERE {
......@@ -11,4 +12,5 @@ WHERE {
?instrumentUri a :Instrument .
OPTIONAL { ?instrumentUri :prefLabel ?label }
OPTIONAL { ?instrumentUri :specification ?specification }
OPTIONAL { ?instrumentUri :alternativeName ?alternativeName }
}
......@@ -3,6 +3,7 @@
"@context": {
"specification": "deichman:specification",
"prefLabel": "deichman:prefLabel",
"alternativeName": "deichman:alternativeName",
"Place": "deichman:Place",
"deichman": "__ONTOLOGY__",
"type": "@type",
......
......@@ -3,7 +3,8 @@ PREFIX : <__ONTOLOGY__>
CONSTRUCT {
?placeUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :Place ;
:prefLabel ?label ;
:specification ?specification .
:specification ?specification ;
:alternativeName ?alternativeName .
}
WHERE {
......@@ -11,4 +12,5 @@ WHERE {
?placeUri a :Place .
OPTIONAL { ?placeUri :prefLabel ?label }
OPTIONAL { ?placeUri :specification ?specification }
OPTIONAL { ?placeUri :alternativeName ?alternativeName . }
}
......@@ -4,6 +4,7 @@
"deichman": "__ONTOLOGY__",
"specification": "deichman:specification",
"prefLabel": "deichman:prefLabel",
"alternativeName": "deichman:alternativeName",
"Subject": "deichman:Subject",
"type": "@type",
"uri": "@id",
......
PREFIX : <__ONTOLOGY__>
CONSTRUCT
{ ?subjectUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :Subject .
?subjectUri :prefLabel ?prefLabel .
?subjectUri :specification ?specification .
{ ?subjectUri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :Subject ;
:prefLabel ?prefLabel ;
:specification ?specification ;
:alternativeName ?alternativeName .
}
WHERE
{ SELECT DISTINCT ?subjectUri ?prefLabel ?specification
{ SELECT DISTINCT ?subjectUri ?prefLabel ?specification ?alternativeName
WHERE
{ BIND(uri("__SUBJECTURI__") AS ?subjectUri)
?subjectUri a :Subject ;
OPTIONAL { ?subjectUri :prefLabel ?prefLabel }
OPTIONAL { ?subjectUri :specification ?specification }
OPTIONAL { ?subjectUri :alternativeName ?alternativeName }
}
}
\ No newline at end of file
......@@ -231,7 +231,7 @@ duo:Biography a rdfs:Class ;
:alternativeName a rdfs:Property ;
rdfs:label "Alternative name"@en ;
rdfs:label "Alternativt navn"@no ;
rdfs:domain :Person ;
rdfs:domain :Person, :Corporation, :Subject, :Genre, :Place, :Event, :CompositionType, :Instrument ;
rdfs:range xsd:string .
:ordinal a rdfs:Property ;
......
......@@ -8,6 +8,9 @@
},
"specification": {
"type": "String"
},
"alternativeName": {
"type": "string"
}
}
}
\ No newline at end of file
......@@ -8,6 +8,9 @@
},
"specification": {
"type": "String"
},
"alternativeName": {
"type": "string"
}
}
}
\ No newline at end of file
package no.deichman.services.search;
import no.deichman.services.entity.EntityType;
import no.deichman.services.uridefaults.BaseURI;
import no.deichman.services.uridefaults.XURI;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.vocabulary.RDF;
import org.junit.Assert;
import org.junit.Test;
import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs;
/**
* Responsibility: unit test PlaceModelToIndexMapper.
*/
public class CompositionTypeModelToIndexMapperTest {
@Test
public void testModelToIndexDocument() throws Exception {
XURI placeXuri1 = new XURI(BaseURI.root(), EntityType.MUSICAL_COMPOSITION_TYPE.getPath(), "e000000001");
Model model = ModelFactory.createDefaultModel();
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(placeXuri1.getUri()),
RDF.type,
ResourceFactory.createResource(BaseURI.ontology("CompositionType"))));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(placeXuri1.getUri()),
ResourceFactory.createProperty(BaseURI.ontology("specification")),
ResourceFactory.createPlainLiteral("Not over before the fat lady sings")));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(placeXuri1.getUri()),
ResourceFactory.createProperty(BaseURI.ontology("prefLabel")),
ResourceFactory.createPlainLiteral("Opera")));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(placeXuri1.getUri()),
ResourceFactory.createProperty(BaseURI.ontology("alternativeName")),
ResourceFactory.createPlainLiteral("alternativeName_value")));
String jsonDocument = new ModelToIndexMapper("compositionType").createIndexDocument(model, placeXuri1);
Assert.assertThat(jsonDocument, sameJSONAs(""
+ "{"
+ " \"uri\": \"" + placeXuri1.getUri() + "\","
+ " \"prefLabel\": \"Opera\","
+ " \"alternativeName\": \"alternativeName_value\","
+ " \"specification\": \"Not over before the fat lady sings\","
+ "}").allowingAnyArrayOrdering());
}
}
......@@ -35,6 +35,11 @@ public class CorporationModelToIndexMapperTest {
ResourceFactory.createProperty(BaseURI.ontology("name")),
ResourceFactory.createPlainLiteral("publisherName_value")));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(xuri.getUri()),
ResourceFactory.createProperty(BaseURI.ontology("alternativeName")),
ResourceFactory.createPlainLiteral("alternativeName_value")));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(xuri.getUri()),
ResourceFactory.createProperty(BaseURI.ontology("subdivision")),
......@@ -51,6 +56,7 @@ public class CorporationModelToIndexMapperTest {
+ "{"
+ " \"uri\": \"" + xuri.getUri() + "\","
+ " \"name\": \"publisherName_value\","
+ " \"alternativeName\": \"alternativeName_value\","
+ " \"subdivision\": \"subdivision_value\","
+ " \"specification\": \"specification_value\""
+ "}").allowingAnyArrayOrdering());
......
package no.deichman.services.search;
import no.deichman.services.entity.EntityType;
import no.deichman.services.uridefaults.BaseURI;
import no.deichman.services.uridefaults.XURI;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.vocabulary.RDF;
import org.junit.Assert;
import org.junit.Test;
import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs;
/**
* Responsibility: unit test PlaceModelToIndexMapper.
*/
public class EventModelToIndexMapperTest {
@Test
public void testModelToIndexDocument() throws Exception {
XURI placeXuri1 = new XURI(BaseURI.root(), EntityType.EVENT.getPath(), "e000000001");
Model model = ModelFactory.createDefaultModel();
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(placeXuri1.getUri()),
RDF.type,
ResourceFactory.createResource(BaseURI.ontology("Event"))));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(placeXuri1.getUri()),
ResourceFactory.createProperty(BaseURI.ontology("specification")),
ResourceFactory.createPlainLiteral("Jesus (pron. Hey-soos) returns to earth")));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(placeXuri1.getUri()),
ResourceFactory.createProperty(BaseURI.ontology("prefLabel")),
ResourceFactory.createPlainLiteral("Jesus returns")));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(placeXuri1.getUri()),
ResourceFactory.createProperty(BaseURI.ontology("alternativeName")),
ResourceFactory.createPlainLiteral("alternativeName_value")));
String jsonDocument = new ModelToIndexMapper("event").createIndexDocument(model, placeXuri1);
Assert.assertThat(jsonDocument, sameJSONAs(""
+ "{"
+ " \"uri\": \"" + placeXuri1.getUri() + "\","
+ " \"prefLabel\": \"Jesus returns\","
+ " \"alternativeName\": \"alternativeName_value\","
+ " \"specification\": \"Jesus (pron. Hey-soos) returns to earth\","
+ "}").allowingAnyArrayOrdering());
}
}
package no.deichman.services.search;
import no.deichman.services.entity.EntityType;
import no.deichman.services.uridefaults.BaseURI;
import no.deichman.services.uridefaults.XURI;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.vocabulary.RDF;
import org.junit.Assert;
import org.junit.Test;
import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs;
/**
* Responsibility: unit test PlaceModelToIndexMapper.
*/
public class GenreModelToIndexMapperTest {
@Test
public void testModelToIndexDocument() throws Exception {
XURI subjetXuri1 = new XURI(BaseURI.root(), EntityType.GENRE.getPath(), "g000000001");
Model model = ModelFactory.createDefaultModel();
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(subjetXuri1.getUri()),
RDF.type,
ResourceFactory.createResource(BaseURI.ontology("Genre"))));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(subjetXuri1.getUri()),
ResourceFactory.createProperty(BaseURI.ontology() + "specification"),
ResourceFactory.createPlainLiteral("Drap og mord")));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(subjetXuri1.getUri()),
ResourceFactory.createProperty(BaseURI.ontology("prefLabel")),
ResourceFactory.createPlainLiteral("Krim")));
model.add(ResourceFactory.createStatement(
ResourceFactory.createResource(subjetXuri1.getUri()),
ResourceFactory.createProperty(BaseURI.ontology("alternativeName")),
ResourceFactory.createPlainLiteral("alternativeName_value")));
String jsonDocument = new ModelToIndexMapper("genre").createIndexDocument(model, subjetXuri1);
Assert.assertThat(jsonDocument, sameJSONAs(""
+ "{"
+ " \"uri\": \"" + subjetXuri1.getUri() + "\","
+ " \"prefLabel\": \"Krim\","
+ " \"alternativeName\": \"alternativeName_value\","
+ " \"specification\": \"Drap og mord\","
+