Revision 52285
Added by Jochen Schirrwagen almost 6 years ago
modules/unibi-data-collective-transformation-common/trunk/src/test/java/eu/dnetlib/data/collective/transformation/engine/SimpleTransformationEngineTest.java | ||
---|---|---|
450 | 450 |
scriptBuilder.append("oaf:hostedBy = set(\"''\", @name = \"hostedName\"; , @id = \"hostedId\";);\r\n"); |
451 | 451 |
scriptBuilder.append("$varId = identifierExtract('[\"//dc:identifier\"]' , xpath:\"./record\" , '(10[.][0-9]{4,}[^\\s\"/<>]*/[^\\s\"<>]+)');\r\n"); |
452 | 452 |
scriptBuilder.append("oaf:identifier = set(xpath:\"$varId//value\", @identifierType = \"doi\";);\r\n"); |
453 |
|
|
454 |
System.err.println("???????????????????????????"); |
|
455 | 453 |
scriptBuilder.append("dr:CobjCategory = Convert(xpath:\"//dc:type\",TypesVocab);\r\n"); |
456 | 454 |
|
457 | 455 |
scriptBuilder.append("end\r\n"); |
... | ... | |
479 | 477 |
scriptBuilder.append("static $varDsType = getValue(PROFILEFIELD, [xpath:\"concat('collection()', '')\", xpath:\"//EXTRA_FIELDS/FIELD[key='DataSourceType']/value\"]);\r\n"); |
480 | 478 |
scriptBuilder.append("if xpath:\"$varDsType='Aggregator'\" oaf:hostingDatasourceid = xpath:\"//prov:baseURL\"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:\"concat('collection()', '')\", xpath:\"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value\"]);\r\n"); |
481 | 479 |
scriptBuilder.append("oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:\"concat('collection()', '')\", xpath:\"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value\"]);\r\n"); |
480 |
scriptBuilder.append("oaf:concept = \"'CONCEPT'\";\r\n"); |
|
482 | 481 |
scriptBuilder.append("dr:CobjMDFormats = xpath:\"//dc:title\";\r\n"); |
483 | 482 |
scriptBuilder.append("dc:language = Convert(xpath:\"//dc:language\", LangVocab);\r\n"); |
484 | 483 |
scriptBuilder.append("%myTemplate = split(xpath:\"//dc:creator/text()\", \"dc:creator\", \";\");\r\n"); |
modules/unibi-data-collective-transformation-common/trunk/src/main/java/prototype/utils/Capitalize.java | ||
---|---|---|
1 | 1 |
package prototype.utils; |
2 | 2 |
|
3 |
import org.apache.commons.lang.WordUtils;
|
|
3 |
import org.apache.commons.text.WordUtils;
|
|
4 | 4 |
|
5 | 5 |
import com.google.common.base.Function; |
6 | 6 |
|
modules/unibi-data-collective-transformation-common/trunk/src/main/java/eu/dnetlib/data/collective/transformation/utils/TransformationRulesImportTool.java | ||
---|---|---|
3 | 3 |
import java.io.StringReader; |
4 | 4 |
import java.util.List; |
5 | 5 |
|
6 |
import org.apache.commons.lang.StringEscapeUtils;
|
|
6 |
import org.apache.commons.text.StringEscapeUtils;
|
|
7 | 7 |
|
8 | 8 |
import eu.dnetlib.common.profile.ProfileNotFoundException; |
9 | 9 |
import eu.dnetlib.data.collective.transformation.rulelanguage.RuleLanguageParser; |
modules/unibi-data-collective-transformation-common/trunk/src/main/java/eu/dnetlib/data/collective/transformation/engine/functions/RetrieveValue.java | ||
---|---|---|
15 | 15 |
import javax.xml.xpath.XPathExpressionException; |
16 | 16 |
import javax.xml.xpath.XPathFactory; |
17 | 17 |
|
18 |
import org.apache.commons.lang.StringEscapeUtils;
|
|
18 |
import org.apache.commons.text.StringEscapeUtils;
|
|
19 | 19 |
import org.apache.commons.logging.Log; |
20 | 20 |
import org.apache.commons.logging.LogFactory; |
21 | 21 |
import org.xml.sax.InputSource; |
modules/unibi-data-collective-transformation-common/trunk/src/main/java/eu/dnetlib/data/collective/transformation/core/schema/visitor/Visitor.java | ||
---|---|---|
4 | 4 |
import java.util.LinkedList; |
5 | 5 |
import java.util.List; |
6 | 6 |
|
7 |
import org.apache.commons.lang.NotImplementedException; |
|
7 |
import org.apache.commons.lang3.NotImplementedException;
|
|
8 | 8 |
//import org.apache.commons.logging.Log; |
9 | 9 |
//import org.apache.commons.logging.LogFactory; |
10 | 10 |
|
... | ... | |
44 | 44 |
|
45 | 45 |
@Override |
46 | 46 |
public void annotation(XSAnnotation arg0) { |
47 |
throw new NotImplementedException(); |
|
47 |
throw new NotImplementedException("TODO: annotation");
|
|
48 | 48 |
} |
49 | 49 |
|
50 | 50 |
@Override |
51 | 51 |
public void attGroupDecl(XSAttGroupDecl arg0) { |
52 |
throw new NotImplementedException(); |
|
52 |
throw new NotImplementedException("TODO attGroupDecl");
|
|
53 | 53 |
} |
54 | 54 |
|
55 | 55 |
@Override |
... | ... | |
57 | 57 |
currentAttribute.setName(aAttributeDecl.getName()); |
58 | 58 |
//log.debug("visit attribute name: " + aAttributeDecl.getName()); |
59 | 59 |
//log.debug("visit attribute type: " + aAttributeDecl.getType()); |
60 |
throw new NotImplementedException(); |
|
60 |
throw new NotImplementedException("TODO attributeDecl");
|
|
61 | 61 |
} |
62 | 62 |
|
63 | 63 |
@Override |
64 | 64 |
public void attributeUse(XSAttributeUse aAttributeUse) { |
65 |
throw new NotImplementedException(); |
|
65 |
throw new NotImplementedException("TODO attributeUse");
|
|
66 | 66 |
} |
67 | 67 |
|
68 | 68 |
@Override |
... | ... | |
79 | 79 |
|
80 | 80 |
@Override |
81 | 81 |
public void facet(XSFacet arg0) { |
82 |
throw new NotImplementedException(); |
|
82 |
throw new NotImplementedException("TODO facet");
|
|
83 | 83 |
} |
84 | 84 |
|
85 | 85 |
@Override |
86 | 86 |
public void identityConstraint(XSIdentityConstraint arg0) { |
87 |
throw new NotImplementedException(); |
|
87 |
throw new NotImplementedException("TODO identityConstraint");
|
|
88 | 88 |
} |
89 | 89 |
|
90 | 90 |
@Override |
91 | 91 |
public void notation(XSNotation arg0) { |
92 |
throw new NotImplementedException(); |
|
92 |
throw new NotImplementedException("TODO notation");
|
|
93 | 93 |
} |
94 | 94 |
|
95 | 95 |
@Override |
96 | 96 |
public void schema(XSSchema arg0) { |
97 |
throw new NotImplementedException(); |
|
97 |
throw new NotImplementedException("TODO schema");
|
|
98 | 98 |
} |
99 | 99 |
|
100 | 100 |
@Override |
101 | 101 |
public void xpath(XSXPath arg0) { |
102 |
throw new NotImplementedException(); |
|
102 |
throw new NotImplementedException("TODO xpath");
|
|
103 | 103 |
} |
104 | 104 |
|
105 | 105 |
@Override |
... | ... | |
124 | 124 |
|
125 | 125 |
@Override |
126 | 126 |
public void modelGroupDecl(XSModelGroupDecl arg0) { |
127 |
throw new NotImplementedException(); |
|
127 |
throw new NotImplementedException("TODO modelGroupDecl");
|
|
128 | 128 |
} |
129 | 129 |
|
130 | 130 |
@Override |
131 | 131 |
public void wildcard(XSWildcard arg0) { |
132 |
throw new NotImplementedException(); |
|
132 |
throw new NotImplementedException("TODO wildcard");
|
|
133 | 133 |
} |
134 | 134 |
|
135 | 135 |
@Override |
136 | 136 |
public void empty(XSContentType arg0) { |
137 |
throw new NotImplementedException(); |
|
137 |
throw new NotImplementedException("TODO empty");
|
|
138 | 138 |
} |
139 | 139 |
|
140 | 140 |
@Override |
... | ... | |
154 | 154 |
|
155 | 155 |
@Override |
156 | 156 |
public void simpleType(XSSimpleType arg0) { |
157 |
throw new NotImplementedException(); |
|
157 |
throw new NotImplementedException("TODO simpleType");
|
|
158 | 158 |
} |
159 | 159 |
|
160 | 160 |
public List<SchemaElement> getElements(){ |
modules/unibi-data-collective-transformation-common/trunk/src/main/java/eu/dnetlib/data/collective/transformation/core/schema/visitor/XSTermVisitorImpl.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.collective.transformation.core.schema.visitor; |
2 | 2 |
|
3 |
import org.apache.commons.lang.NotImplementedException; |
|
3 |
import org.apache.commons.lang3.NotImplementedException;
|
|
4 | 4 |
|
5 | 5 |
import com.sun.xml.xsom.XSElementDecl; |
6 | 6 |
import com.sun.xml.xsom.XSModelGroup; |
... | ... | |
37 | 37 |
|
38 | 38 |
@Override |
39 | 39 |
public void modelGroupDecl(XSModelGroupDecl arg0) { |
40 |
throw new NotImplementedException(); |
|
40 |
throw new NotImplementedException("TODO modelGroupDecl");
|
|
41 | 41 |
} |
42 | 42 |
|
43 | 43 |
@Override |
44 | 44 |
public void wildcard(XSWildcard arg0) { |
45 |
throw new NotImplementedException(); |
|
45 |
throw new NotImplementedException("TODO wildcard");
|
|
46 | 46 |
} |
47 | 47 |
|
48 | 48 |
public void setVisitor(Visitor visitor) { |
modules/unibi-data-collective-transformation-common/trunk/src/main/java/eu/dnetlib/data/collective/transformation/core/schema/visitor/XSContentTypeVisitorImpl.java | ||
---|---|---|
3 | 3 |
import java.util.Collection; |
4 | 4 |
import java.util.Iterator; |
5 | 5 |
|
6 |
import org.apache.commons.lang.NotImplementedException; |
|
6 |
import org.apache.commons.lang3.NotImplementedException;
|
|
7 | 7 |
|
8 | 8 |
import com.sun.xml.xsom.XSAttributeUse; |
9 | 9 |
import com.sun.xml.xsom.XSContentType; |
... | ... | |
26 | 26 |
|
27 | 27 |
@Override |
28 | 28 |
public void empty(XSContentType arg0) { |
29 |
throw new NotImplementedException(); |
|
29 |
throw new NotImplementedException("TODO empty");
|
|
30 | 30 |
} |
31 | 31 |
|
32 | 32 |
@Override |
... | ... | |
68 | 68 |
|
69 | 69 |
@Override |
70 | 70 |
public void simpleType(XSSimpleType arg0) { |
71 |
throw new NotImplementedException(); |
|
71 |
throw new NotImplementedException("TODO simpleType");
|
|
72 | 72 |
} |
73 | 73 |
|
74 | 74 |
public void setVisitor(Visitor visitor) { |
modules/unibi-data-collective-transformation-common/trunk/src/main/java/eu/dnetlib/data/collective/transformation/core/xsl/ext/TransformationFunctionProxy.java | ||
---|---|---|
21 | 21 |
import javax.xml.xpath.XPath; |
22 | 22 |
import javax.xml.xpath.XPathFactory; |
23 | 23 |
|
24 |
import org.apache.commons.lang.StringEscapeUtils;
|
|
24 |
import org.apache.commons.text.StringEscapeUtils;
|
|
25 | 25 |
import org.apache.commons.logging.Log; |
26 | 26 |
import org.apache.commons.logging.LogFactory; |
27 | 27 |
import org.svenson.JSONParser; |
modules/unibi-data-collective-transformation-common/trunk/src/main/java/eu/dnetlib/data/collective/transformation/rulelanguage/util/FunctionCall.java | ||
---|---|---|
5 | 5 |
import java.util.Map; |
6 | 6 |
import java.util.UUID; |
7 | 7 |
|
8 |
import org.apache.commons.lang.StringEscapeUtils;
|
|
8 |
import org.apache.commons.text.StringEscapeUtils;
|
|
9 | 9 |
|
10 | 10 |
import eu.dnetlib.data.collective.transformation.core.xsl.XsltConstants; |
11 | 11 |
import eu.dnetlib.data.collective.transformation.engine.functions.Convert; |
... | ... | |
70 | 70 |
}else if (externalFunctionName.equals("lookup")){ |
71 | 71 |
return XsltConstants.extFuncNS + ":" + externalFunctionName + "(" + "$tf" + ", " + this.paramMap.get(Lookup.paramExprIdentifier) + ", '" + this.paramMap.get(Lookup.paramExprProperty) + "')"; |
72 | 72 |
}else if (externalFunctionName.equals("identifierExtract")){ |
73 |
return XsltConstants.extFuncNS + ":" + externalFunctionName + "(" + "$tf" + ", '" + StringEscapeUtils.escapeXml(this.paramMap.get(IdentifierExtract.paramXpathExprJson)) + "', " + this.paramMap.get(IdentifierExtract.paramXpathExprInSource) + ", '" + StringEscapeUtils.escapeXml(this.paramMap.get(IdentifierExtract.paramRegExpr)) + "')";
|
|
73 |
return XsltConstants.extFuncNS + ":" + externalFunctionName + "(" + "$tf" + ", '" + StringEscapeUtils.escapeXml10(this.paramMap.get(IdentifierExtract.paramXpathExprJson)) + "', " + this.paramMap.get(IdentifierExtract.paramXpathExprInSource) + ", '" + StringEscapeUtils.escapeXml10(this.paramMap.get(IdentifierExtract.paramRegExpr)) + "')";
|
|
74 | 74 |
}else{ |
75 | 75 |
throw new IllegalStateException("unsupported function call: " + externalFunctionName); |
76 | 76 |
} |
modules/unibi-data-collective-transformation-common/trunk/src/main/resources/eu/dnetlib/data/collective/transformation/schema/OPENAIRE_OAF.xsd | ||
---|---|---|
74 | 74 |
</xs:simpleContent> |
75 | 75 |
</xs:complexType> |
76 | 76 |
</xs:element> |
77 |
<xs:element name="concept"> |
|
78 |
<xs:complexType> |
|
79 |
<xs:simpleContent> |
|
80 |
<xs:extension base="xs:string" > |
|
81 |
<xs:attribute name="id" type="xs:string"/> |
|
82 |
</xs:extension> |
|
83 |
</xs:simpleContent> |
|
84 |
</xs:complexType> |
|
85 |
</xs:element> |
|
77 | 86 |
<xs:element name="hostedBy"> |
78 | 87 |
<xs:complexType> |
79 | 88 |
<xs:attribute name="name" type="xs:string"/> |
modules/unibi-data-collective-transformation-common/trunk/src/main/resources/eu/dnetlib/data/collective/transformation/schema/OAFSchema_vTransformator.xsd | ||
---|---|---|
66 | 66 |
<xs:element ref="oaf:invalid" minOccurs="0" maxOccurs="1"/> |
67 | 67 |
<xs:element ref="oaf:hostedBy" minOccurs="0" maxOccurs="1"/> |
68 | 68 |
<xs:element ref="oaf:collectedFrom" minOccurs="0" maxOccurs="1"/> |
69 |
<xs:element ref="oaf:concept" minOccurs="0" maxOccurs="unbounded"></xs:element> |
|
69 | 70 |
<xs:element ref="oaf:identifier" minOccurs="0" maxOccurs="unbounded"/> |
70 | 71 |
<xs:element ref="oaf:reference" minOccurs="0" maxOccurs="unbounded"/> |
71 | 72 |
<xs:element ref="oaf:fulltext" minOccurs="0" maxOccurs="unbounded"/> |
modules/unibi-data-collective-transformation-common/trunk/src/main/resources/eu/dnetlib/data/collective/transformation/applicationContext-transformation.properties | ||
---|---|---|
5 | 5 |
services.transformation.blacklist_api = http://localhost:8080/validator-service/worfklows?request=GetBlacklistedRecords&datasourceId= |
6 | 6 |
# expected json format: {"map":{"name_of_the_vocabulary_as_used_in_the_transformationRuleScript":{"name":"name of the vocabulary as used in the vocabulary profile", "caseSensitive":"true or false", "delimiter":"optional parameter"}}} |
7 | 7 |
# services.transformation.vocabularyproperties.json = {"map":{"Languages":{"name":"Names of Languages", "caseSensitive":"false", "delimiter":"/"}, "TextTypologies":{"name":"Names of Text Object Typologies", "caseSensitive":"false"}}} |
8 |
services.transformation.vocabularyproperties.json = {"map":{"AccessRights":{"name":"dnet:access_modes", "caseSensitive":"false"}, "Languages":{"name":"dnet:languages", "caseSensitive":"false", "delimiter":"/"}, "TextTypologies":{"name":"dnet:publication_resource", "caseSensitive":"false"}}} |
|
8 |
services.transformation.vocabularyproperties.json = {"map":{"AccessRights":{"name":"dnet:access_modes", "caseSensitive":"false"}, "Languages":{"name":"dnet:languages", "caseSensitive":"false", "delimiter":"/"}, "TextTypologies":{"name":"dnet:publication_resource", "caseSensitive":"false"}, "SuperTypes":{"name":"dnet:result_typologies", "caseSensitive":"false"}}} |
modules/unibi-data-collective-transformation-common/trunk/pom.xml | ||
---|---|---|
20 | 20 |
<version>1.8.3</version> |
21 | 21 |
</dependency> |
22 | 22 |
<dependency> |
23 |
<groupId>org.apache.commons</groupId> |
|
24 |
<artifactId>commons-text</artifactId> |
|
25 |
<version>1.3</version> |
|
26 |
</dependency> |
|
27 |
<dependency> |
|
23 | 28 |
<groupId>junit</groupId> |
24 | 29 |
<artifactId>junit</artifactId> |
25 | 30 |
<version>${junit.version}</version> |
Also available in: Unified diff
added dnet:resource_type vocabulary; extended OAF schema for oaf:concept; updated commons-lang3 or replaced by commons-text