Project

General

Profile

« Previous | Next » 

Revision 41872

have a nice holiday

View differences:

webapps/dnet-efg-container/trunk/pom.xml
36 36

  
37 37
		<dependency>
38 38
			<groupId>eu.dnetlib</groupId>
39
			<artifactId>dnet-efg</artifactId>
40
			<version>1.0.0-SNAPSHOT</version>
41
		</dependency>
42

  
43
		<dependency>
44
			<groupId>eu.dnetlib</groupId>
39 45
			<artifactId>dnet-modular-uis</artifactId>
40 46
			<version>1.0.0-SNAPSHOT</version>
41 47
		</dependency>
modules/dnet-core-components/trunk/src/main/java/eu/dnetlib/clients/index/utils/MetadataReference.java
1
package eu.dnetlib.clients.index.utils;
2

  
3
import com.google.common.collect.ComparisonChain;
4

  
5
/**
6
 * Container class for metadata format, layout and interpretation.
7
 *
8
 * @author claudio
9
 */
10
public class MetadataReference {
11

  
12
	/**
13
	 * Metadata format.
14
	 */
15
	private String format;
16

  
17
	/**
18
	 * Metadata layout.
19
	 */
20
	private String layout;
21

  
22
	/**
23
	 * Metadata interpretation.
24
	 */
25
	private String interpretation;
26

  
27
	/**
28
	 * Constructor for MetadataReference.
29
	 *
30
	 * @param format         Metadata format
31
	 * @param layout         Metadata layout
32
	 * @param interpretation Metadata interpretation
33
	 */
34
	public MetadataReference(final String format, final String layout, final String interpretation) {
35
		this.format = format;
36
		this.layout = layout;
37
		this.interpretation = interpretation;
38
	}
39

  
40
	public String getFormat() {
41
		return format;
42
	}
43

  
44
	public String getLayout() {
45
		return layout;
46
	}
47

  
48
	public String getInterpretation() {
49
		return interpretation;
50
	}
51

  
52
	@Override
53
	public boolean equals(final Object that) {
54

  
55
		if (!(that instanceof MetadataReference))
56
			return false;
57

  
58
		final MetadataReference mdRef = (MetadataReference) that;
59

  
60
		return ComparisonChain.start()
61
				.compare(this.format, mdRef.getFormat())
62
				.compare(this.layout, mdRef.getLayout())
63
				.compare(this.interpretation, mdRef.getInterpretation())
64
				.result() == 0;
65
	}
66

  
67
	@Override
68
	public int hashCode() {
69
		return getFormat().hashCode() + getLayout().hashCode() + getInterpretation().hashCode();
70
	}
71

  
72
	@Override
73
	public String toString() {
74
		return getFormat() + "-" + getLayout() + "-" + getInterpretation();
75
	}
76

  
77
}
modules/dnet-core-components/trunk/src/test/java/eu/dnetlib/index/utils/applicationContext-utils.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
       xmlns:http="http://cxf.apache.org/transports/http/configuration"
4
       xmlns="http://www.springframework.org/schema/beans"
5
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
6

  
7

  
8
						http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd">
9

  
10

  
11
	<bean id="serviceTools" class="eu.dnetlib.clients.index.utils.ServiceTools"
12
	      depends-on="uniqueServiceLocator"/>
13

  
14
	<bean id="mdFactory"
15
	      class="eu.dnetlib.clients.index.utils.MetadataReferenceFactory" depends-on="uniqueServiceLocator"/>
16
</beans>	
modules/dnet-core-components/trunk/src/test/java/eu/dnetlib/index/query/applicationContext-index-query.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
       xmlns:p="http://www.springframework.org/schema/p"
4
       xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns="http://www.springframework.org/schema/beans"
5
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
6

  
7

  
8
						http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd">
9

  
10

  
11
	<bean id="browseAliases" class="eu.dnetlib.clients.index.query.BrowseAliases"
12
	      p:serviceTools-ref="serviceTools"/>
13

  
14

  
15
	<bean id="weights" class="eu.dnetlib.clients.index.query.Weights"/>
16

  
17
	<bean id="mdFormatReader" class="eu.dnetlib.clients.index.utils.MDFormatReader"/>
18

  
19
	<bean id="metadataReferenceFactory" class="eu.dnetlib.clients.index.utils.MetadataReferenceFactory"/>
20

  
21

  
22
</beans>	
modules/dnet-core-components/trunk/src/main/java/eu/dnetlib/clients/index/utils/ServiceTools.java
1
package eu.dnetlib.clients.index.utils;
2

  
3
import java.util.HashMap;
4
import java.util.List;
5
import java.util.Map;
6
import javax.annotation.Resource;
7

  
8
import com.google.common.collect.Iterables;
9
import com.google.common.collect.Lists;
10
import eu.dnetlib.clients.index.client.IndexClientException;
11
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
12
import eu.dnetlib.rmi.enabling.*;
13
import eu.dnetlib.rmi.provision.IndexServiceException;
14
import org.apache.commons.lang3.StringUtils;
15
import org.apache.commons.logging.Log;
16
import org.apache.commons.logging.LogFactory;
17

  
18
public class ServiceTools {
19

  
20
	private static final Log log = LogFactory.getLog(ServiceTools.class);
21

  
22
	@Resource
23
	private UniqueServiceLocator serviceLocator;
24

  
25
	@Resource
26
	private MetadataReferenceFactory mdFactory;
27

  
28
	public List<MetadataReference> listMDRefs() throws IndexClientException {
29
		return Lists.newArrayList(Iterables.transform(listMDRefsAsString(), s -> mdFactory.decodeMetadata(s)));
30
	}
31

  
32
	private List<String> quickSearchProfile(final String xquery) throws IndexClientException {
33
		try {
34
			return serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery);
35
		} catch (ISLookUpException e) {
36
			throw new IndexClientException(e);
37
		}
38
	}
39

  
40
	public MetadataReference getMetadataRef(final String dsId) throws IndexServiceException {
41

  
42
		final String xquery = "for $x in //RESOURCE_PROFILE[.//RESOURCE_IDENTIFIER/@value='" + dsId + "']//CONFIGURATION " + "return concat("
43
				+ "$x/METADATA_FORMAT/text(),'-'," + "$x/METADATA_FORMAT_LAYOUT/text(),'-'," + "$x/METADATA_FORMAT_INTERPRETATION/text())";
44
		return mdFactory.decodeMetadata(getResourceProfileByQuery(xquery));
45
	}
46

  
47
	private String getResourceProfileByQuery(final String xquery) throws IndexServiceException {
48
		try {
49
			return serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(xquery);
50
		} catch (ISLookUpDocumentNotFoundException e) {
51
			throw new IndexServiceException(e);
52
		} catch (ISLookUpException e) {
53
			throw new IndexServiceException(e);
54
		}
55
	}
56

  
57
	public String getIndexFields(final String dsId) throws IndexServiceException {
58

  
59
		return getIndexFields(getMetadataRef(dsId));
60
	}
61

  
62
	public String getIndexFields(final MetadataReference mdRef) {
63

  
64
		final String xquery = "for $x in collection('')/RESOURCE_PROFILE/BODY[CONFIGURATION/NAME='" + mdRef.getFormat()
65
				+ "'] return $x/STATUS/LAYOUTS/LAYOUT[@name='" + mdRef.getLayout() + "']/FIELDS";
66
		try {
67
			return getResourceProfileByQuery(xquery);
68
		} catch (IndexServiceException e) {
69
			log.warn("couldn't find Metadata format profile matching specs: " + mdRef.toString());
70
			return "";
71
		}
72
	}
73

  
74
	public List<String> listDsIds() throws IndexClientException {
75
		final String xquery = "//RESOURCE_PROFILE[.//RESOURCE_TYPE/@value='IndexDSResourceType']//RESOURCE_IDENTIFIER/@value/string()";
76
		return quickSearchProfile(xquery);
77
	}
78

  
79
	private List<String> listMDRefsAsString() throws IndexClientException {
80
		final String xquery = "for $x in //RESOURCE_PROFILE[.//RESOURCE_TYPE/@value='MDFormatDSResourceType'] "
81
				+ "let $format:= $x//CONFIGURATION/NAME/string() " + "for $y in $x//LAYOUTS/LAYOUT " + "let $layout:= $y//LAYOUT/@name/string() "
82
				+ "let $interpretation:= $x//CONFIGURATION/INTERPRETATION/text() " + "return concat($format,'-',$layout,'-',$interpretation) ";
83
		return quickSearchProfile(xquery);
84
	}
85

  
86
	public Map<String, String> getIndexProperties(final String backendId) throws IndexClientException {
87

  
88
		String query = "for $x in /RESOURCE_PROFILE[.//RESOURCE_TYPE/@value=\"IndexServiceResourceType\"]//SERVICE_PROPERTIES/PROPERTY"
89
				+ " return concat($x/@key/string(),\":::\", $x/@value/string())";
90
		Map<String, String> indexProperties = new HashMap<String, String>();
91
		try {
92
			List<String> results = serviceLocator.getService(ISLookUpService.class).quickSearchProfile(query);
93
			if (results != null) {
94
				for (String s : results) {
95
					String[] values = s.split(":::");
96
					if (values != null && values.length == 2) {
97
						String key = values[0];
98
						String value = values[1];
99
						if (StringUtils.startsWith(key, backendId)) {
100
							indexProperties.put(StringUtils.substringAfter(key, backendId + ":"), value);
101
						}
102
					}
103
				}
104
			}
105
			return indexProperties;
106
		} catch (ISLookUpException e) {
107
			throw new IndexClientException();
108
		}
109
	}
110

  
111
	public String registerProfile(final String resourceProfile) throws IndexServiceException {
112
		try {
113
			return serviceLocator.getService(ISRegistryService.class).registerProfile(resourceProfile);
114
		} catch (ISRegistryException e) {
115
			throw new IndexServiceException(e);
116
		}
117
	}
118

  
119
	public boolean incrementHandledDataStructures(final String backendId) throws IndexServiceException {
120
		final String xquery = "let $x := //RESOURCE_PROFILE[HEADER/PROTOCOLS/PROTOCOL/@name='" + backendId + "'],"
121
				+ "$tot := $x//STATUS/HANDLED_DATASTRUCTURE/number() + 1 " + "return update replace $x//STATUS/HANDLED_DATASTRUCTURE with "
122
				+ "<HANDLED_DATASTRUCTURE>{$tot}</HANDLED_DATASTRUCTURE>";
123

  
124
		log.info("performing increment of HANDLED_DATASTRUCTURE");
125
		return executeXUpdate(xquery);
126
	}
127

  
128
	private boolean executeXUpdate(final String xquery) throws IndexServiceException {
129
		try {
130
			return serviceLocator.getService(ISRegistryService.class).executeXUpdate(xquery);
131
		} catch (ISRegistryException e) {
132
			throw new IndexServiceException(e);
133
		}
134
	}
135

  
136
	public String getServiceAddress(final String backendId) {
137
		final String xquery = "let $x := //RESOURCE_PROFILE[HEADER/PROTOCOLS/PROTOCOL/@name='" + backendId + "']"
138
				+ "return $x//PROTOCOL[./@name='SOAP']/@address/string()";
139
		try {
140
			return getResourceProfileByQuery(xquery);
141
		} catch (IndexServiceException e) {
142
			log.warn("couldn't find service Address for index Service with protocol: " + backendId);
143
			return "";
144
		}
145
	}
146

  
147
	public boolean deleteIndexDS(final String dsId) throws IndexServiceException {
148
		try {
149
			return serviceLocator.getService(ISRegistryService.class).deleteProfile(dsId);
150
		} catch (ISRegistryDocumentNotFoundException e) {
151
			throw new IndexServiceException(e);
152
		} catch (ISRegistryException e) {
153
			throw new IndexServiceException(e);
154
		}
155
	}
156

  
157
	public List<String> getBackendIds(final MetadataReference mdRef) throws IndexServiceException {
158
		String query =
159
				"distinct-values(//RESOURCE_PROFILE[.//METADATA_FORMAT='%s' and .//METADATA_FORMAT_LAYOUT='%s' and .//METADATA_FORMAT_INTERPRETATION='%s']//BACKEND/@ID/string())";
160
		try {
161
			String instanceQuery = String.format(query, mdRef.getFormat(), mdRef.getLayout(), mdRef.getInterpretation());
162
			log.debug("Executing query to IS: " + instanceQuery);
163
			return serviceLocator.getService(ISLookUpService.class).quickSearchProfile(instanceQuery);
164
		} catch (ISLookUpException e) {
165
			throw new IndexServiceException(e);
166
		}
167
	}
168
}
modules/dnet-core-components/trunk/src/test/java/eu/dnetlib/index/client/applicationContext-indexClient.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
       xmlns:http="http://cxf.apache.org/transports/http/configuration"
4
       xmlns="http://www.springframework.org/schema/beans"
5
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
6
                                    http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd">
7
	<!-- beans -->
8

  
9
	<bean id="resolvingIndexClientFactory" class="eu.dnetlib.clients.index.client.ResolvingIndexClientFactory"></bean>
10

  
11
</beans>
modules/dnet-core-components/trunk/src/main/java/eu/dnetlib/clients/index/utils/MDFormatReader.java
1
package eu.dnetlib.clients.index.utils;
2

  
3
import java.io.StringReader;
4
import java.util.List;
5
import java.util.Map;
6

  
7
import com.google.common.collect.HashBasedTable;
8
import com.google.common.collect.Table;
9
import com.mycila.xmltool.CallBack;
10
import com.mycila.xmltool.XMLDoc;
11
import com.mycila.xmltool.XMLTag;
12
import eu.dnetlib.clients.index.client.IndexClientException;
13
import org.dom4j.Document;
14
import org.dom4j.DocumentException;
15
import org.dom4j.io.SAXReader;
16
import org.springframework.beans.factory.annotation.Autowired;
17
import org.xml.sax.InputSource;
18

  
19
;
20

  
21
public class MDFormatReader {
22

  
23
	@Autowired
24
	private ServiceTools serviceTools;
25
	@Autowired
26
	private MetadataReferenceFactory mdFactory;
27

  
28
	public List<MetadataReference> listMDRefs() throws IndexClientException {
29
		return serviceTools.listMDRefs();
30
	}
31

  
32
	public Document getFields(final MetadataReference mdRef) {
33
		String fields = serviceTools.getIndexFields(mdRef);
34
		return (fields != null) && !fields.isEmpty() ? XmlUtils.parse(fields) : null;
35
	}
36

  
37
	public Map<String, String> getAttributeMap(final MetadataReference mdRef, final String attribute) throws IndexClientException {
38
		return getAttributeTable(mdRef, attribute).column(attribute);
39
	}
40

  
41
	public Table<String, String, String> getAttributeTable(final MetadataReference mdRef, final String... attributeList) throws IndexClientException {
42

  
43
		final String fields = serviceTools.getIndexFields(mdRef);
44
		if (fields.isEmpty()) throw new IndexClientException("No result getting index layout informations");
45
		final Table<String, String, String> t = HashBasedTable.create();
46
		XMLDoc.from(serviceTools.getIndexFields(mdRef), false).forEach("//FIELD", new CallBack() {
47

  
48
			@Override
49
			public void execute(final XMLTag field) {
50

  
51
				for (String attribute : attributeList) {
52
					String value = null;
53

  
54
					if ("xpath".equals(attribute)) {
55
						if (!(field.hasAttribute("xpath") || field.hasAttribute("value"))) return;
56

  
57
						value = field.hasAttribute("xpath") ? field.getAttribute("xpath") : field.getAttribute("value");
58
					}
59

  
60
					if ("weight".equals(attribute)) {
61
						if (!(field.hasAttribute(attribute))) return;
62

  
63
						value = field.hasAttribute(attribute) ? field.getAttribute(attribute) : "";
64
					}
65

  
66
					if (value == null) {
67
						value = field.getAttribute(attribute);
68
					}
69

  
70
					t.put(field.getAttribute("name").toLowerCase(), attribute, value);
71
				}
72
			}
73
		});
74
		return t;
75
	}
76

  
77
	static class XmlUtils {
78

  
79
		/**
80
		 * helper method, parses a list of fields.
81
		 * <p>
82
		 * <p>
83
		 * the given fields
84
		 *
85
		 * @return the parsed fields
86
		 * if cannot parse the fields
87
		 */
88
		public static Document parse(final String xml) {
89
			try {
90
				return new SAXReader().read(new StringReader(xml));
91
			} catch (DocumentException e) {
92
				throw new IllegalArgumentException("cannot parse: " + xml);
93
			}
94
		}
95

  
96
		public static InputSource asInputSource(final String input) throws DocumentException {
97
			return new InputSource(new StringReader(parse(input).asXML()));
98
		}
99
	}
100

  
101
}
modules/dnet-core-components/trunk/src/main/java/eu/dnetlib/clients/index/model/AnySeq.java
1
package eu.dnetlib.clients.index.model;
2

  
3
import java.util.Date;
4
import java.util.List;
5

  
6
/**
7
 * Interface for a sequence of Any objects.
8
 * <p>
9
 * <p>
10
 * AnySeq does <b>not</b> allow <code>null</code> values!
11
 * </p>
12
 */
13
public interface AnySeq extends List<Any>, Any {
14

  
15
	/**
16
	 * @param element The string object to add
17
	 * @return true if successfully added, false else
18
	 */
19
	boolean add(String element);
20

  
21
	/**
22
	 * Long, Integer, Short and Byte values will be converted to Value object of type LONG, all others to Value object
23
	 * of type DOUBLE.
24
	 *
25
	 * @param number The number object to add
26
	 * @return true if successfully added, false else
27
	 */
28
	boolean add(Number number);
29

  
30
	/**
31
	 * @param index   The index where to add the any object
32
	 * @param element The any object to add
33
	 */
34
	@Override
35
	void add(int index, Any element);
36

  
37
	/**
38
	 * @param index The index of the object to return
39
	 * @return The AnyMap matching to the index, an InvalidValueTypeException is thrown if the value is not of type
40
	 * AnyMap
41
	 */
42
	AnyMap getMap(int index);
43

  
44
	/**
45
	 * @param index The index of the object to return
46
	 * @return The AnySeq matching to this index, an InvalidValueTypeException is thrown if the value is not of type
47
	 */
48
	AnySeq getSeq(int index);
49

  
50
	/**
51
	 * @param index The index of the object to return
52
	 * @return The value matching to this index, an InvalidValueTypeException is thrown if the value is no value type.
53
	 */
54
	Value getValue(int index);
55

  
56
	/**
57
	 * @param index The index of the object to return
58
	 * @return The string value matching to this index, an InvalidValueTypeException is thrown if the value is not of
59
	 * type string
60
	 */
61
	String getStringValue(int index);
62

  
63
	/**
64
	 * @param index The index of the object to return
65
	 * @return The double value matching to this index, an InvalidValueTypeException is thrown if the value is not of
66
	 * type double
67
	 */
68
	Double getDoubleValue(int index);
69

  
70
	/**
71
	 * @param index The index of the object to return
72
	 * @return The long value matching to this index, an InvalidValueTypeException is thrown if the value is not of type
73
	 * long
74
	 */
75
	Long getLongValue(int index);
76

  
77
	/**
78
	 * @param index The index of the object to return
79
	 * @return The boolean value matching to this index, an InvalidValueTypeException is thrown if the value is not of
80
	 * type boolean
81
	 */
82
	Boolean getBooleanValue(int index);
83

  
84
	/**
85
	 * @param index The index of the object to return
86
	 * @return The date value matching to this index, an InvalidValueTypeException is thrown if the value is not of type
87
	 * date
88
	 */
89
	Date getDateValue(int index);
90

  
91
	/**
92
	 * @param index The index of the object to return
93
	 * @return The date time value matching to this index, an InvalidValueTypeException is thrown if the value is not of
94
	 * type date time
95
	 */
96
	Date getDateTimeValue(int index);
97

  
98
	/**
99
	 * returns all values as a List of Strings.
100
	 *
101
	 * @throws InvalidValueTypeException if not all contained values are strings.
102
	 */
103
	List<String> asStrings();
104

  
105
	/**
106
	 * returns all values as a List of Long.
107
	 *
108
	 * @throws InvalidValueTypeException if not all contained values are Longs.
109
	 */
110
	List<Long> asLongs();
111

  
112
}
0 113

  
modules/dnet-core-components/trunk/src/main/java/eu/dnetlib/clients/index/query/BrowseAliases.java
1
package eu.dnetlib.clients.index.query;
2

  
3
import java.util.List;
4
import java.util.Map;
5

  
6
import com.google.common.collect.BiMap;
7
import com.google.common.collect.HashBiMap;
8
import com.google.common.collect.Maps;
9
import eu.dnetlib.clients.index.client.IndexClientException;
10
import eu.dnetlib.clients.index.utils.IndexFieldUtility;
11
import eu.dnetlib.clients.index.utils.MDFormatReader;
12
import eu.dnetlib.clients.index.utils.MetadataReference;
13
import eu.dnetlib.clients.index.utils.ServiceTools;
14
import org.apache.commons.logging.Log;
15
import org.apache.commons.logging.LogFactory;
16
import org.dom4j.Document;
17
import org.dom4j.Element;
18
import org.springframework.beans.factory.annotation.Autowired;
19
import org.springframework.beans.factory.annotation.Required;
20

  
21
/**
22
 * The Class BrowseAliases.
23
 */
24
public class BrowseAliases {
25

  
26
	/**
27
	 * logger.
28
	 */
29
	private static final Log log = LogFactory.getLog(BrowseAliases.class); // NOPMD
30

  
31
	/**
32
	 * The aliases.
33
	 */
34
	private Map<MetadataReference, BiMap<String, String>> aliases = Maps.newConcurrentMap();
35

  
36
	private ServiceTools serviceTools;
37

  
38
	@Autowired
39
	private MDFormatReader mdFormatReader;
40

  
41
	/**
42
	 * Initialize.
43
	 * <p>
44
	 * the index service exception
45
	 */
46
	public void initialize() throws IndexClientException {
47
		log.info("initializing browse aliases");
48
		for (MetadataReference mdRef : getServiceTools().listMDRefs()) {
49
			log.debug("inside foreach");
50
			put(mdRef);
51
		}
52
		log.info("browse aliases initialization completed");
53
	}
54

  
55
	/**
56
	 * Put.
57
	 *
58
	 * @param mdRef the metadata refeference
59
	 */
60
	public void put(final MetadataReference mdRef) {
61
		final Document fields = mdFormatReader.getFields(mdRef);
62
		if (fields != null) {
63
			aliases.put(mdRef, extractBrowsingAliases(fields));
64
		} else {
65
			// log.info("couldn't find any");
66
			BiMap<String, String> m = HashBiMap.create();
67
			aliases.put(mdRef, m);
68
		}
69
	}
70

  
71
	/**
72
	 * Gets the.
73
	 *
74
	 * @param mdRef the md ref
75
	 * @return browsing aliases for given mdRef.
76
	 * @throws IndexClientException
77
	 */
78
	public BiMap<String, String> get(final MetadataReference mdRef) throws IndexClientException {
79
		if ((aliases == null) || (aliases.size() == 0)) {
80
			initialize();
81
		}
82
		return aliases.get(mdRef);
83
	}
84

  
85
	/**
86
	 * Method extract aliases field names from the given fields.
87
	 *
88
	 * @param fields the fields
89
	 * @return aliases map. Keys are "normal" field names, values are names of the non-tokenized version of the field
90
	 */
91
	protected BiMap<String, String> extractBrowsingAliases(final Document fields) {
92
		// default tokenizer splits field names, this would cause to
93
		// have too many browsing results, so we use an untokenized
94
		// alias in place of it.
95

  
96
		final BiMap<String, String> aliases = HashBiMap.create();
97

  
98
		@SuppressWarnings("unchecked")
99
		final List<Element> fieldList = fields.getRootElement().selectNodes(IndexFieldUtility.XPATH_BROWSING_ALIAS_FOR);
100
		for (final Element e : fieldList) {
101
			final String name = e.attribute(IndexFieldUtility.FIELD_BROWSING_ALIAS_FOR).getValue().toLowerCase();
102
			final String alias = e.attribute(IndexFieldUtility.FIELD_NAME).getValue().toLowerCase();
103
			aliases.put(name, alias);
104
		}
105

  
106
		if (aliases.isEmpty()) {
107
			log.warn("couldn'f find alias fields for browsing");
108
		}
109
		return aliases;
110
	}
111

  
112
	/**
113
	 * @return the serviceTools
114
	 */
115
	public ServiceTools getServiceTools() {
116
		return serviceTools;
117
	}
118

  
119
	/**
120
	 * @param serviceTools the serviceTools to set
121
	 */
122
	@Required
123
	public void setServiceTools(final ServiceTools serviceTools) {
124
		this.serviceTools = serviceTools;
125
	}
126

  
127
}
modules/dnet-msro-service/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/repo_hi_simple.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE>
3
	<HEADER>
4
		<RESOURCE_IDENTIFIER value="86251144-0938-4b8d-b0f9-eb4f0021912b_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl"/>
5
		<RESOURCE_TYPE value="WorkflowDSResourceType"/>
6
		<RESOURCE_KIND value="WorkflowDSResources"/>
7
		<RESOURCE_URI value=""/>
8
		<DATE_OF_CREATION value="2015-12-15T15:43:51.0Z"/>
9
	</HEADER>
10
	<BODY>
11
		<WORKFLOW_NAME>Aggregate and Validate Metadata (publications) from PubsRepository [Ingestion]</WORKFLOW_NAME>
12
		<WORKFLOW_DESCRIPTION>Aggregate and Validate Metadata (publications) from PubsRepository [Ingestion]</WORKFLOW_DESCRIPTION>
13
		<WORKFLOW_INFO>
14
			<FIELD name="Action">Aggregate Metadata</FIELD>
15
			<FIELD name="Consequence IS">Ingestion</FIELD>
16
			<FIELD name="Datasource class">PubsRepository</FIELD>
17
			<FIELD name="Content">publications</FIELD>
18
		</WORKFLOW_INFO>
19
		<WORKFLOW_FAMILY>REPO_HI</WORKFLOW_FAMILY>
20
		<WORKFLOW_PRIORITY>20</WORKFLOW_PRIORITY>
21
		<ADMIN_EMAIL/>
22

  
23
		<CONFIGURATION status="EXECUTABLE" start="MANUAL">
24
			<PARAMETERS/>
25
			<WORKFLOW>
26
				<NODE name="VerifyDatasource" type="VerifyDatasource" isStart="true">
27
					<DESCRIPTION>Verify if DS is pending</DESCRIPTION>
28
					<PARAMETERS>
29
						<PARAM name="expectedInterfaceTypologyPrefixes" value="pubsrepository"/>
30
						<PARAM name="expectedCompliancePrefixes" value=""/>
31
					</PARAMETERS>
32
					<ARCS>
33
						<ARC to="registerWf"/>
34
						<ARC to="validateDs" name="validateDs"/>
35
					</ARCS>
36
				</NODE>
37

  
38
				<NODE name="validateDs" type="ValidateDatasource">
39
					<DESCRIPTION>Validate DS</DESCRIPTION>
40
					<PARAMETERS/>
41
					<ARCS>
42
						<ARC to="registerWf"/>
43
					</ARCS>
44
				</NODE>
45

  
46
				<NODE name="registerWf" type="RegisterWorkflowFromTemplate">
47
					<DESCRIPTION>Create Workflow</DESCRIPTION>
48
					<PARAMETERS>
49
						<PARAM name="wfName" value="Aggregate and Validate Metadata"/>
50
						<PARAM name="wfTemplate" value="/eu/dnetlib/msro/workflows/repo-hi/pubsrepository_aggregation_wf.xml.st"/>
51
						<PARAM name="description" value="Aggregate and Validate Metadata (publications) from PubsRepository [Ingestion]"/>
52
					</PARAMETERS>
53
					<ARCS>
54
						<ARC to="createDc"/>
55
						<ARC to="createOaf"/>
56
					</ARCS>
57
				</NODE>
58

  
59
				<NODE name="createDc" type="CreateMDStore">
60
					<DESCRIPTION>Create oai_dc store</DESCRIPTION>
61
					<PARAMETERS>
62
						<PARAM name="format" value="oai_dc"/>
63
						<PARAM name="interpretation" value="native"/>
64
						<PARAM name="layout" value="store"/>
65
						<PARAM name="outputPrefix" value="harv_"/>
66
					</PARAMETERS>
67
					<ARCS>
68
						<ARC to="updateParameters"/>
69
					</ARCS>
70
				</NODE>
71
				<NODE name="createOaf" type="CreateMDStore">
72
					<DESCRIPTION>Create OAF store</DESCRIPTION>
73
					<PARAMETERS>
74
						<PARAM name="format" value="OAF"/>
75
						<PARAM name="interpretation" value="cleaned"/>
76
						<PARAM name="layout" value="store"/>
77
						<PARAM name="outputPrefix" value="tran_"/>
78
					</PARAMETERS>
79
					<ARCS>
80
						<ARC to="updateParameters"/>
81
					</ARCS>
82
				</NODE>
83

  
84
				<NODE name="updateParameters" type="UpdateWfParameters" isJoin="true">
85
					<DESCRIPTION>Update Workflow Parameters</DESCRIPTION>
86
					<PARAMETERS>
87
						<PARAM name="envParams">
88
							<MAP>
89
								<ENTRY key="collMdstoreId" value="harv_id"/>
90
								<ENTRY key="collMdstoreFormat" value="harv_format"/>
91
								<ENTRY key="tranMdstoreId" value="tran_id"/>
92
								<ENTRY key="tranMdstoreFormat" value="tran_format"/>
93
							</MAP>
94
						</PARAM>
95
					</PARAMETERS>
96
					<ARCS>
97
						<ARC to="success"/>
98
					</ARCS>
99
				</NODE>
100

  
101
			</WORKFLOW>
102
		</CONFIGURATION>
103
		<SCHEDULING enabled="false">
104
			<CRON>9 9 9 ? * *</CRON>
105
			<MININTERVAL>10080</MININTERVAL>
106
		</SCHEDULING>
107
		<STATUS/>
108
	</BODY>
109
</RESOURCE_PROFILE>
modules/dnet-msro-service/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/anf.xml
1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="anf_UmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZXMvUmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="RepositoryServiceResourceType"/>
5
		<RESOURCE_KIND value="RepositoryServiceResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2016-03-24T12:40:17+01:00"/>
8
		<PROTOCOL/>
9
	</HEADER>
10
	<BODY>
11
		<CONFIGURATION>
12
			<DATASOURCE_TYPE>efg:contentprovider</DATASOURCE_TYPE>
13
			<DATASOURCE_ORIGINAL_ID provenance="EFG">ANF</DATASOURCE_ORIGINAL_ID>
14
			<DATASOURCE_AGGREGATED>false</DATASOURCE_AGGREGATED>
15
			<ENVIRONMENTS>
16
				<ENVIRONMENT>EFG</ENVIRONMENT>
17
			</ENVIRONMENTS>
18
			<TYPOLOGY/>
19
			<MAX_SIZE_OF_DATASTRUCTURE>0</MAX_SIZE_OF_DATASTRUCTURE>
20
			<AVAILABLE_DISKSPACE>0</AVAILABLE_DISKSPACE>
21
			<MAX_NUMBER_OF_DATASTRUCTURE>0</MAX_NUMBER_OF_DATASTRUCTURE>
22
			<OFFICIAL_NAME>ANF - Arhiva Naţională de Filme</OFFICIAL_NAME>
23
			<ENGLISH_NAME>ANF - Arhiva Naţională de Filme</ENGLISH_NAME>
24
			<ICON_URI>http://www.anf-cinemateca.ro/sites/default/files/danland_logo.png</ICON_URI>
25
			<COUNTRY/>
26
			<LOCATION>
27
				<LONGITUDE>2.35</LONGITUDE>
28
				<LATITUDE>48.85</LATITUDE>
29
				<TIMEZONE>1.0</TIMEZONE>
30
			</LOCATION>
31
			<REPOSITORY_WEBPAGE>http://www.anf-cinemateca.ro/</REPOSITORY_WEBPAGE>
32
			<REPOSITORY_INSTITUTION/>
33
			<ADMIN_INFO>sandro.labruzzo@isti.cnr.it</ADMIN_INFO>
34
			<INTERFACES>
35
				<INTERFACE active="true" compliance="efg" contentDescription="metadata" id="api_________::anf::0" label="content provider" removable="false" typology="pubsrepository::unknown">
36
					<ACCESS_PROTOCOL extensions="efg">filesystem</ACCESS_PROTOCOL>
37
					<BASE_URL>file:///Users/sandro/anf</BASE_URL>
38
					<INTERFACE_EXTRA_FIELD name="overriding_compliance">openaire3.0</INTERFACE_EXTRA_FIELD>
39
					<INTERFACE_EXTRA_FIELD name="metadata_identifier_path">//*[local-name()='header']/*[local-name()='identifier']</INTERFACE_EXTRA_FIELD>
40
				</INTERFACE>
41
			</INTERFACES>
42
			<EXTRA_FIELDS>
43
				<FIELD>
44
					<key>DataSourceId</key>
45
					<value>anf</value>
46
				</FIELD>
47
				<FIELD>
48
					<key>NamespacePrefix</key>
49
					<value>anf</value>
50
				</FIELD>
51
				<FIELD>
52
					<key>VERIFIED</key>
53
					<value>NO</value>
54
				</FIELD>
55
			</EXTRA_FIELDS>
56
			<REGISTERED_BY>sandro.labruzzo@isti.cnr.it</REGISTERED_BY>
57
		</CONFIGURATION>
58
		<STATUS>
59
			<NUMBER_OF_OBJECTS>0</NUMBER_OF_OBJECTS>
60
		</STATUS>
61
		<QOS>
62
			<AVAILABILITY>0</AVAILABILITY>
63
			<CAPACITY/>
64
			<THROUGHPUT>0.0</THROUGHPUT>
65
		</QOS>
66
		<SECURITY_PARAMETERS/>
67
		<BLACKBOARD/>
68
	</BODY>
69
</RESOURCE_PROFILE>
modules/dnet-msro-service/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/puma.xml
1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="10d18b66-1d2a-4579-9adc-aa57b0821c7f_UmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZXMvUmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="RepositoryServiceResourceType"/>
5
        <RESOURCE_KIND value="RepositoryServiceResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2016-01-13T23:30:33+00:00"/>
8
        <PROTOCOL/>
9
    </HEADER>
10
    <BODY>
11
        <CONFIGURATION>
12
            <DATASOURCE_TYPE>pubsrepository::unknown</DATASOURCE_TYPE>
13
            <DATASOURCE_ORIGINAL_ID provenance="OPENAIRE">opendoar____::2367</DATASOURCE_ORIGINAL_ID>
14
            <DATASOURCE_AGGREGATED>false</DATASOURCE_AGGREGATED>
15
            <ENVIRONMENTS>
16
                <ENVIRONMENT>OPENAIRE</ENVIRONMENT>
17
            </ENVIRONMENTS>
18
            <TYPOLOGY>OCTOPUS</TYPOLOGY>
19
            <MAX_SIZE_OF_DATASTRUCTURE>0</MAX_SIZE_OF_DATASTRUCTURE>
20
            <AVAILABLE_DISKSPACE>0</AVAILABLE_DISKSPACE>
21
            <MAX_NUMBER_OF_DATASTRUCTURE>0</MAX_NUMBER_OF_DATASTRUCTURE>
22
            <OFFICIAL_NAME>PUblication MAnagement</OFFICIAL_NAME>
23
            <ENGLISH_NAME>PUMAlab</ENGLISH_NAME>
24
            <ICON_URI/>
25
            <COUNTRY>IT</COUNTRY>
26
            <LOCATION>
27
                <LONGITUDE>10.42</LONGITUDE>
28
                <LATITUDE>43.71</LATITUDE>
29
                <TIMEZONE>0.0</TIMEZONE>
30
            </LOCATION>
31
            <REPOSITORY_WEBPAGE>http://pumalab.isti.cnr.it/index.php/it</REPOSITORY_WEBPAGE>
32
            <REPOSITORY_INSTITUTION>Institute of Information Science and Technology "A. Faedo"</REPOSITORY_INSTITUTION>
33
            <ADMIN_INFO>stefania.biagioni@isti.cnr.it</ADMIN_INFO>
34
            <INTERFACES>
35
                <INTERFACE active="false" compliance="openaire3.0" contentDescription="metadata" id="api_________::opendoar____::2367::0"
36
                           label="pubsrepository::unknown (openaire3.0)" removable="false" typology="pubsrepository::unknown">
37
                    <ACCESS_PROTOCOL format="oai_dc" set="openaire">oai</ACCESS_PROTOCOL>
38
                    <BASE_URL>http://pumaoai.isti.cnr.it/openoai2.php</BASE_URL>
39
                    <INTERFACE_EXTRA_FIELD name="metadata_identifier_path">//*[local-name()='header']/*[local-name()='identifier']</INTERFACE_EXTRA_FIELD>
40
                </INTERFACE>
41

  
42

  
43
            </INTERFACES>
44
            <EXTRA_FIELDS>
45
                <FIELD>
46
                    <key>OpenAireDataSourceId</key>
47
                    <value>opendoar____::2367</value>
48
                </FIELD>
49
                <FIELD>
50
                    <key>NamespacePrefix</key>
51
                    <value>od______2367</value>
52
                </FIELD>
53
                <FIELD>
54
                    <key>VERIFIED</key>
55
                    <value>NO</value>
56
                </FIELD>
57
                <FIELD>
58
                    <key>aggregatorName</key>
59
                    <value>OPENAIRE</value>
60
                </FIELD>
61
                <FIELD>
62
                    <key>dateOfValidation</key>
63
                    <value/>
64
                </FIELD>
65
                <FIELD>
66
                    <key>dateOfCollection</key>
67
                    <value>2013-05-07</value>
68
                </FIELD>
69
                <FIELD>
70
                    <key>mergeHomonyms</key>
71
                    <value>true</value>
72
                </FIELD>
73
            </EXTRA_FIELDS>
74
            <REGISTERED_BY/>
75
        </CONFIGURATION>
76
        <STATUS>
77
            <NUMBER_OF_OBJECTS>44225</NUMBER_OF_OBJECTS>
78
            <LAST_UPDATE value="2016-01-13T22:05:57Z"/>
79
        </STATUS>
80
        <QOS>
81
            <AVAILABILITY>0</AVAILABILITY>
82
            <CAPACITY/>
83
            <THROUGHPUT>0.0</THROUGHPUT>
84
        </QOS>
85
        <SECURITY_PARAMETERS/>
86
        <BLACKBOARD/>
87
    </BODY>
88
</RESOURCE_PROFILE>
89

  
modules/dnet-msro-service/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/simple_transform_template.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE>
3
	<HEADER>
4
		<RESOURCE_IDENTIFIER value="0614918a-39c2-4ff2-8876-a1facc54ff9b_V29ya2Zsb3dUZW1wbGF0ZURTUmVzb3VyY2VzL1dvcmtmbG93VGVtcGxhdGVEU1Jlc291cmNlVHlwZQ==" />
5
		<RESOURCE_TYPE value="WorkflowTemplateDSResourceType" />
6
		<RESOURCE_KIND value="WorkflowTemplateDSResources" />
7
		<RESOURCE_URI value="" />
8
		<DATE_OF_CREATION value="2001-12-31T12:00:00" />
9
	</HEADER>
10
	<BODY>
11
		<CONFIGURATION>
12
			<PARAMETERS>
13
				<PARAM name="dsId" description="Datasource Id" required="true" type="string" />
14
				<PARAM name="interface" description="Datasource Interface" required="true" type="string" />
15
				<PARAM name="collMdstoreId" description="Store for collected records" required="true" type="string" />
16
				<PARAM name="tranMdstoreId" description="Store for transformed records" required="true" type="string" />
17
				<PARAM name="ruleId" description="Transformation Rule Id" required="true" type="string" />
18
			</PARAMETERS>
19
			<WORKFLOW>
20
				<NODE name="fetchOriginals" type="FetchMDStoreRecords" isStart="true">
21
					<DESCRIPTION>Fetch records from MDStore</DESCRIPTION>
22
					<PARAMETERS>
23
						<PARAM name="mdId" ref="collMdstoreId" />
24
						<PARAM name="mdFormat" value="oai_dc" />
25
						<PARAM name="eprParam" value="orig_epr" />
26
					</PARAMETERS>
27
					<ARCS>
28
						<ARC to="transform" />
29
					</ARCS>
30
				</NODE>
31
				<NODE name="transform" type="Transform">
32
					<DESCRIPTION>Transform original records</DESCRIPTION>
33
					<PARAMETERS>
34
						<PARAM name="ruleId" ref="ruleId" />
35
						<PARAM name="inputEprParam" value="orig_epr"/>
36
						<PARAM name="outputEprParam" value="dmf_epr" />
37
					</PARAMETERS>
38
					<ARCS>
39
						<ARC to="storeRecords" />
40
					</ARCS>
41
				</NODE>
42
				<NODE name="storeRecords" type="StoreMDStoreRecords">
43
					<DESCRIPTION>Store mdtore records</DESCRIPTION>
44
					<PARAMETERS>
45
						<PARAM name="mdId" ref="tranMdstoreId" />
46
						<PARAM name="storingType" value="REFRESH" />
47
						<PARAM name="eprParam" value="dmf_epr" />
48
					</PARAMETERS>
49
					<ARCS>
50
						<ARC to="UPDATE_INFO" />
51
					</ARCS>
52
				</NODE>
53
				<NODE name="UPDATE_INFO" type="MDStoreToApiExtraField">
54
					<DESCRIPTION>Update datasouce API extra fields</DESCRIPTION>
55
					<PARAMETERS>
56
						<PARAM name="mdId" ref="tranMdstoreId" />
57
						<PARAM name="datasourceId" ref="dsId" />
58
						<PARAM name="datasourceInterface" ref="interface" />
59
						<PARAM name="extraFieldForTotal" value="last_aggregation_total" />
60
						<PARAM name="extraFieldForDate" value="last_aggregation_date"/>
61
						<PARAM name="extraFieldForMdId" value="last_aggregation_mdId"/>
62
					</PARAMETERS>
63
					<ARCS>
64
						<ARC to="success" />
65
					</ARCS>
66
				</NODE>
67
			</WORKFLOW>
68
		</CONFIGURATION>
69
	</BODY>
70
</RESOURCE_PROFILE>
modules/dnet-msro-service/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/puma_transformation_rule.xml
1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="3fe5fd31-1b14-427d-934b-5d5dba6cf5cc_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2015-10-18T12:17:31+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>dc_cleaning_OPENAIREplus_puma</TITLE>
14
                <CODE>declare_script "dc_cleaning_OpenAIREplus_compliant_puma";
15
declare_ns oaf = "http://namespace.openaire.eu/oaf";
16
declare_ns dri = "http://www.driver-repository.eu/namespace/dri";
17
declare_ns dr = "http://www.driver-repository.eu/namespace/dr";
18
declare_ns dc = "http://purl.org/dc/elements/1.1/";
19
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance";
20
$var0 = "''";
21
$varFP7 = "'corda_______::'";
22
$varH2020 = "'corda__h2020::'";
23
$varFCT="'fct_________::'";
24
$varCorda = "'corda_______::'";
25
$varDummy = "''";
26
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
27
static $varRepoid = xpath:"//dri:repositoryId";
28
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//OFFICIAL_NAME"]);
29
dri:objIdentifier = xpath:"//dri:objIdentifier";
30
dri:repositoryId = $varRepoid;
31
dri:recordIdentifier = xpath:"//dri:recordIdentifier";
32
apply xpath:"//dc:creator" if xpath:"string-length(.) &gt; 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''";
33
if xpath:"//dc:title[string-length(.)&gt; 0]" $varDummy = "''"; else dc:coverage = skipRecord();
34
dc:title = xpath:"//dc:title[string-length(.) &gt; 0]/normalize-space(.)";
35
apply xpath:"//dc:subject" if xpath:"string-length(.) &gt; 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
36
apply xpath:"//dc:publisher" if xpath:"string-length(.) &gt; 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
37
apply xpath:"//dc:source" if xpath:"string-length(.) &gt; 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
38
dc:contributor = xpath:"//dc:contributor";
39
dc:description = xpath:"//dc:description";
40
dc:format = xpath:"//dc:format";
41
$varHttpTest = "''";
42
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord();
43
//apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
44
//
45
if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']/preceding::dc:identifier[starts-with(., 'http')][ends-with(., '.pdf')]" dc:identifier = xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']/preceding::dc:identifier[starts-with(., 'http')][ends-with(., '.pdf')]"; else dc:identifier = xpath:"//dc:identifier[starts-with(., 'http')]";
46
//
47
dr:dateOfCollection = xpath:"//dri:dateOfCollection";
48
dc:type = xpath:"//dc:type";
49
dc:language = Convert(xpath:"//dc:language", Languages);
50
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord();
51
dc:date = xpath:"//dc:date";
52
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()");
53
apply xpath:"//dc:date" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/date')" oaf:embargoenddate = RegExpr(xpath:"normalize-space(.)", $var0, "s/^(.*info:eu-repo\/date\/embargoEnd\/)//gmi"); else $var0 = "''";
54
// FP7
55
oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')]/concat($varFP7, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))";
56
// H2020
57
oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')]/concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))";
58
// FCT
59
oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/fct)/(.+)/(\d+)(.*)', 'i')]/concat($varFCT, replace(normalize-space(.), '(info:eu-repo/grantagreement/fct)/(.+)/(\d+)(.*)', '$3', 'i'))";
60
dc:relation = xpath:"//dc:relation";
61
//comment-js-09-10-2012 apply xpath:"//dc:rights" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/semantics')" dc:rights = empty; else dc:rights = xpath:"normalize-space(.)";
62
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
63
//
64
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]);
65
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
66
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
67
//
68
dr:CobjCategory = Convert(xpath:"//dc:type", TextTypologies);
69
dc:rights = xpath:"//dc:rights";
70
if xpath:"not(//dc:rights[text()='info:eu-repo/semantics/openAccess'])" oaf:accessrights = Convert(xpath:"//dc:rights", AccessRights); else oaf:accessrights = "OPEN";
71
// apply xpath:"//dc:rights" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/semantics')" oaf:accessrights = Convert(xpath:"normalize-space(.)", AccessRights); else dc:rights = xpath:".";
72
// if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN";
73
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''";
74
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights);
75
//
76
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
77
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
78
//
79
// $varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/&amp;lt;&amp;gt;]*/[^\s"&amp;lt;&amp;gt;]+)');
80
$varId = identifierExtract('["//dc:relation[starts-with(normalize-space(.), \"info:eu-repo/semantics/altIdentifier/doi/\")]"]' , xpath:"./*[local-name()='record']" , '(?!info:eu-repo/semantics/altIdentifier/doi/)(10.*)');
81
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
82
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
83
end</CODE>
84
            </SCRIPT>
85
        </CONFIGURATION>
86
        <STATUS/>
87
        <SECURITY_PARAMETERS/>
88
    </BODY>
89
</RESOURCE_PROFILE>
modules/dnet-msro-service/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/simple_collection_template.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE>
3
	<HEADER>
4
		<RESOURCE_IDENTIFIER value="51043d43-8546-4e2d-a20b-9f45829c0c5c_V29ya2Zsb3dUZW1wbGF0ZURTUmVzb3VyY2VzL1dvcmtmbG93VGVtcGxhdGVEU1Jlc291cmNlVHlwZQ==" />
5
		<RESOURCE_TYPE value="WorkflowTemplateDSResourceType" />
6
		<RESOURCE_KIND value="WorkflowTemplateDSResources" />
7
		<RESOURCE_URI value="" />
8
		<DATE_OF_CREATION value="2001-12-31T12:00:00" />
9
	</HEADER>
10
	<BODY>
11
		<CONFIGURATION>
12
			<PARAMETERS>
13
				<PARAM name="dsId" description="Datasource Id" required="true" type="string" />
14
				<PARAM name="interface" description="Datasource Interface" required="true" type="string" />
15
				<PARAM name="collMdstoreId" description="Store for collected records" required="true" type="string" />
16
				<PARAM name="selectMode" description="Selection Mode" required="true" type="string" default="REFRESH" />
17
			</PARAMETERS>
18
			<WORKFLOW>
19
				<NODE name="SELECT_MODE" type="Selection"  isStart="true">
20
					<DESCRIPTION>Set information about current provider</DESCRIPTION>
21
					<PARAMETERS>
22
						<PARAM name="selection" ref="selectMode" />
23
					</PARAMETERS>
24
					<ARCS>
25
						<ARC name="REFRESH" to="COLLECT_REFRESH" />
26
						<ARC name="INCREMENTAL" to="PREPARE_INCREMENTAL" />
27
					</ARCS>
28
				</NODE>
29
				<NODE name="COLLECT_REFRESH" type="CollectRecords">
30
					<DESCRIPTION>Start Harvesting</DESCRIPTION>
31
					<PARAMETERS>
32
						<PARAM name="datasourceId" ref="dsId" />
33
						<PARAM name="datasourceInterface" ref="interface" />
34
						<PARAM name="eprParam" value="collected_epr" />
35
					</PARAMETERS>
36
					<ARCS>
37
						<ARC to="MD_BUILDER_REFRESH" />
38
					</ARCS>
39
				</NODE>
40
				<NODE name="MD_BUILDER_REFRESH" type="MdBuilder">
41
					<DESCRIPTION>Prepare mdstore records</DESCRIPTION>
42
					<PARAMETERS>
43
						<PARAM name="inputEprParam" value="collected_epr" />
44
						<PARAM name="outputEprParam" value="store_epr" />
45
						<PARAM name="datasourceId" ref="dsId" />
46
						<PARAM name="datasourceInterface" ref="interface" />
47
					</PARAMETERS>
48
					<ARCS>
49
						<ARC to="STORE_REFRESH" />
50
					</ARCS>
51
				</NODE>
52
				<NODE name="STORE_REFRESH" type="StoreMDStoreRecords">
53
					<DESCRIPTION>Store mdstore records</DESCRIPTION>
54
					<PARAMETERS>
55
						<PARAM name="mdId" ref="collMdstoreId" />
56
						<PARAM name="storingType" value="REFRESH" />
57
						<PARAM name="eprParam" value="store_epr" />
58
					</PARAMETERS>
59
					<ARCS>
60
						<ARC to="UPDATE_INFO" />
61
					</ARCS>
62
				</NODE>
63
				<NODE name="PREPARE_INCREMENTAL" type="FindDateRangeForIncrementalHarvesting">
64
					<DESCRIPTION>Find Date Range For Incremental Harvesting</DESCRIPTION>
65
					<PARAMETERS>
66
						<PARAM name="fromDateParam" value="FROM_DATE" />
67
						<PARAM name="untilDateParam" value="UNTIL_DATE" />
68
					</PARAMETERS>
69
					<ARCS>
70
						<ARC to="COLLECT_INCREMENTAL" />
71
					</ARCS>
72
				</NODE>
73
				<NODE name="COLLECT_INCREMENTAL" type="DateRangeCollectRecords">
74
					<DESCRIPTION>Start incremental harvesting</DESCRIPTION>
75
					<PARAMETERS>
76
						<PARAM name="datasourceId" ref="dsId" />
77
						<PARAM name="datasourceInterface" ref="interface" />
78
						<PARAM name="eprParam" value="collected_epr" />
79
						<PARAM name="fromDateParam" value="FROM_DATE" />
80
						<PARAM name="untilDateParam" value="UNTIL_DATE" />
81
					</PARAMETERS>
82
					<ARCS>
83
						<ARC to="MD_BUILDER_INCREMENTAL" />
84
					</ARCS>
85
				</NODE>
86
				<NODE name="MD_BUILDER_INCREMENTAL" type="MdBuilder">
87
					<DESCRIPTION>Prepare mdstore records</DESCRIPTION>
88
					<PARAMETERS>
89
						<PARAM name="inputEprParam" value="collected_epr" />
90
						<PARAM name="outputEprParam" value="store_epr" />
91
						<PARAM name="datasourceId" ref="dsId" />
92
						<PARAM name="datasourceInterface" ref="interface" />
93
					</PARAMETERS>
94
					<ARCS>
95
						<ARC to="STORE_INCREMENTAL" />
96
					</ARCS>
97
				</NODE>
98
				<NODE name="STORE_INCREMENTAL" type="StoreMDStoreRecords">
99
					<DESCRIPTION>Store mdstore records incrementally</DESCRIPTION>
100
					<PARAMETERS>
101
						<PARAM name="mdId" ref="collMdstoreId" />
102
						<PARAM name="storingType" value="INCREMENTAL" />
103
						<PARAM name="eprParam" value="store_epr" />
104
					</PARAMETERS>
105
					<ARCS>
106
						<ARC to="UPDATE_INFO" />
107
					</ARCS>
108
				</NODE>
109
				<NODE name="UPDATE_INFO" type="MDStoreToApiExtraField">
110
					<DESCRIPTION>Update datasouce API extra fields</DESCRIPTION>
111
					<PARAMETERS>
112
						<PARAM name="mdId" ref="collMdstoreId" />
113
						<PARAM name="datasourceId" ref="dsId" />
114
						<PARAM name="datasourceInterface" ref="interface" />
115
						<PARAM name="extraFieldForTotal" value="last_collection_total" />
116
						<PARAM name="extraFieldForDate" value="last_collection_date" />
117
						<PARAM name="extraFieldForMdId" value="last_collection_mdId" />
118
					</PARAMETERS>
119
					<ARCS>
120
						<ARC to="success" />
121
					</ARCS>
122
				</NODE>
123

  
124
			</WORKFLOW>
125
		</CONFIGURATION>
126
	</BODY>
127
</RESOURCE_PROFILE>
modules/dnet-msro-service/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/voc_compliance.xml
1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="42b3f336-66ac-40d4-9702-b155f2801e77_Vm9jYWJ1bGFyeURTUmVzb3VyY2VzL1ZvY2FidWxhcnlEU1Jlc291cmNlVHlwZQ=="/>
4
        <RESOURCE_TYPE value="VocabularyDSResourceType"/>
5
        <RESOURCE_KIND value="VocabularyDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2014-12-01T11:12:40+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <VOCABULARY_NAME code="dnet:compatibilityLevel">dnet:compatibilityLevel</VOCABULARY_NAME>
12
            <VOCABULARY_DESCRIPTION>dnet:compatibilityLevel</VOCABULARY_DESCRIPTION>
13
            <TERMS>
14
                <TERM native_name="OpenAIRE 2.0 (EC funding)" code="openaire2.0" english_name="OpenAIRE 2.0 (EC funding)" encoding="OPENAIRE">
15
                    <SYNONYMS/>
16
                    <RELATIONS/>
17
                </TERM>
18
                <TERM native_name="OpenAIRE 3.0 (OA, funding)" code="openaire3.0" english_name="OpenAIRE 3.0 (OA, funding)" encoding="OPENAIRE">
19
                    <SYNONYMS/>
20
                    <RELATIONS/>
21
                </TERM>
22
                <TERM native_name="OpenAIRE basic (DRIVER OA)" code="driver" english_name="OpenAIRE Basic (DRIVER OA)" encoding="OPENAIRE">
23
                    <SYNONYMS/>
24
                    <RELATIONS/>
25
                </TERM>
26
                <TERM native_name="files" code="files" english_name="files" encoding="OPENAIRE">
27
                    <SYNONYMS/>
28
                    <RELATIONS/>
29
                </TERM>
30
                <TERM native_name="native" code="native" english_name="native" encoding="OPENAIRE">
31
                    <SYNONYMS/>
32
                    <RELATIONS/>
33
                </TERM>
34
                <TERM native_name="not available" code="UNKNOWN" english_name="not available" encoding="OPENAIRE">
35
                    <SYNONYMS/>
36
                    <RELATIONS/>
37
                </TERM>
38
                <TERM native_name="published in" code="hostedBy" english_name="published in" encoding="OPENAIRE">
39
                    <SYNONYMS/>
40
                    <RELATIONS/>
41
                </TERM>
42
                <TERM native_name="under validation" code="notCompatible" english_name="under validation" encoding="OPENAIRE">
43
                    <SYNONYMS/>
44
                    <RELATIONS/>
45
                </TERM>
46
            </TERMS>
47
        </CONFIGURATION>
48
        <STATUS>
49
            <LAST_UPDATE value="2013-11-18T10:46:36Z"/>
50
        </STATUS>
51
        <SECURITY_PARAMETERS>String</SECURITY_PARAMETERS>
52
    </BODY>
53
</RESOURCE_PROFILE>
modules/dnet-core-components/trunk/src/main/java/eu/dnetlib/clients/index/model/impl/AnySeqImpl.java
1
package eu.dnetlib.clients.index.model.impl;
2

  
3
import java.util.*;
4
import java.util.stream.Collectors;
5

  
6
import eu.dnetlib.clients.index.model.*;
7

  
8
/**
9
 * Sequence of Any objects.
10
 */
11
public final class AnySeqImpl extends AbstractAny implements AnySeq {
12

  
13
	/**
14
	 * version.
15
	 */
16
	private static final long serialVersionUID = 1L;
17

  
18
	/**
19
	 * holds the Any objects of this AnySeq.
20
	 */
21
	private final List<Any> _anyList;
22

  
23
	/**
24
	 * constructs a new instance of AnySeqImpl.
25
	 */
26
	AnySeqImpl() {
27
		super(ValueType.SEQ);
28
		_anyList = new ArrayList<Any>();
29
	}
30

  
31
	/**
32
	 * {@inheritDoc}
33
	 */
34
	@Override
35
	public boolean add(final Any value) {
36
		if (value == null) {
37
			throw new IllegalArgumentException("The value of any Any must not be null.");
38
		}
39
		return _anyList.add(value);
40
	}
41

  
42
	/**
43
	 * {@inheritDoc}
44
	 */
45
	@Override
46
	public boolean add(final String e) {
47
		return add(new ValueImpl(ValueType.STRING, e));
48
	}
49

  
50
	/**
51
	 * {@inheritDoc}
52
	 */
53
	@Override
54
	public boolean add(final Number n) {
55
		if (n instanceof Double) {
56
			return add(new ValueImpl(ValueType.DOUBLE, n));
57
		} else if (n instanceof Long) {
58
			return add(new ValueImpl(ValueType.LONG, n));
59
		} else if (n instanceof Integer || n instanceof Short || n instanceof Byte) {
60
			return add(new ValueImpl(ValueType.LONG, Long.valueOf(n.longValue())));
61
		} else { // default: DOUBLE
62
			return add(new ValueImpl(ValueType.DOUBLE, Double.valueOf(n.doubleValue())));
63
		}
64
	}
65

  
66
	/**
67
	 * {@inheritDoc}
68
	 */
69
	@Override
70
	public void add(final int index, final Any element) {
71
		if (element == null) {
72
			throw new IllegalArgumentException("The value of any Any must not be null.");
73
		}
74
		_anyList.add(index, element);
75
	}
76

  
77
	/**
78
	 * {@inheritDoc}
79
	 */
80
	@Override
81
	public boolean addAll(final Collection<? extends Any> c) {
82
		return _anyList.addAll(c);
83
	}
84

  
85
	/**
86
	 * {@inheritDoc}
87
	 */
88
	@Override
89
	public boolean addAll(final int index, final Collection<? extends Any> c) {
90
		return _anyList.addAll(index, c);
91
	}
92

  
93
	/**
94
	 * {@inheritDoc}
95
	 */
96
	@Override
97
	public void clear() {
98
		_anyList.clear();
99
	}
100

  
101
	/**
102
	 * {@inheritDoc}
103
	 */
104
	@Override
105
	public boolean contains(final Object o) {
106
		return _anyList.contains(o);
107
	}
108

  
109
	/**
110
	 * {@inheritDoc}
111
	 */
112
	@Override
113
	public boolean containsAll(final Collection<?> c) {
114
		return _anyList.containsAll(c);
115
	}
116

  
117
	/**
118
	 * {@inheritDoc}
119
	 */
120
	@Override
121
	public Any get(final int index) {
122
		return _anyList.get(index);
123
	}
124

  
125
	/**
126
	 * {@inheritDoc}
127
	 */
128
	@Override
129
	public Any set(final int index, final Any element) {
130
		if (element == null) {
131
			throw new IllegalArgumentException("The value of any Any must not be null.");
132
		}
133
		return _anyList.set(index, element);
134
	}
135

  
136
	/**
137
	 * {@inheritDoc}
138
	 */
139
	@Override
140
	public int indexOf(final Object o) {
141
		return _anyList.indexOf(o);
142
	}
143

  
144
	/**
145
	 * {@inheritDoc}
146
	 */
147
	@Override
148
	public boolean isEmpty() {
149
		return _anyList.isEmpty();
150
	}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff