diff --git a/dump-schema/src/main/java/eu/dnetlib/dhp/eosc/model/Result.java b/dump-schema/src/main/java/eu/dnetlib/dhp/eosc/model/Result.java index f70f949..61b8584 100644 --- a/dump-schema/src/main/java/eu/dnetlib/dhp/eosc/model/Result.java +++ b/dump-schema/src/main/java/eu/dnetlib/dhp/eosc/model/Result.java @@ -36,7 +36,7 @@ public class Result implements Serializable { description = "Reference to a relevant research infrastructure, initiative or community (RI/RC) among those collaborating with OpenAIRE. Please see https://connect.openaire.eu") private List context; - @JsonSchema(description = "Information about the sources from which the record has been collected") + @JsonSchema(description = "Information about the sources from which the result has been collected") @JsonInclude(JsonInclude.Include.NON_NULL) protected List collectedfrom; @@ -142,6 +142,7 @@ public class Result implements Serializable { @JsonSchema(description = "The set of relations associated to this result") private List relations; + @JsonSchema(description = "The direct link to the full-text as collected from the data source") private List fulltext; public List getFulltext() { diff --git a/dump-schema/src/main/resources/jsonschemas/eosc_result_schema.json b/dump-schema/src/main/resources/jsonschemas/eosc_result_schema.json index 11daa8b..b432cee 100644 --- a/dump-schema/src/main/resources/jsonschemas/eosc_result_schema.json +++ b/dump-schema/src/main/resources/jsonschemas/eosc_result_schema.json @@ -132,6 +132,16 @@ "type": "string", "description": "Only for results with type 'software': the URL to the repository with the source code" }, + "collectedfrom": { + "description": "Information about the sources from which the result has been collected", + "type": "array", + "items": { + "allOf": [ + {"$ref": "#/definitions/CfHbKeyValue"}, + {"description": "Information about the sources from which the result has been collected"} + ] + } + }, "contactgroup": { "description": "Only for results with type 'software': Information on the group responsible for providing further information regarding the resource", "type": "array", @@ -165,9 +175,18 @@ "type": "string", "description": "Journal issue number" }, - "issnLinking": {"type": "string"}, - "issnOnline": {"type": "string"}, - "issnPrinted": {"type": "string"}, + "issnLinking": { + "type": "string", + "description": "The lissn" + }, + "issnOnline": { + "type": "string", + "description": "The eissn" + }, + "issnPrinted": { + "type": "string", + "description": "The issn" + }, "name": { "type": "string", "description": "Name of the journal or conference" @@ -297,6 +316,14 @@ "type": "array", "items": {"type": "string"} }, + "fulltext": { + "description": "The direct link to the full-text as collected from the data source", + "type": "array", + "items": { + "type": "string", + "description": "The direct link to the full-text as collected from the data source" + } + }, "geolocation": { "description": "Geolocation information", "type": "array", @@ -386,6 +413,13 @@ }, "description": "The money spent to make this book or article available in Open Access. Source for this information is the OpenAPC initiative." }, + "collectedfrom": { + "allOf": [ + {"$ref": "#/definitions/CfHbKeyValue"}, + {"description": "Information about the source from which the record has been collected"} + ] + }, + "fulltext": {"type": "string"}, "hostedby": { "allOf": [ {"$ref": "#/definitions/CfHbKeyValue"}, @@ -551,6 +585,38 @@ "type": "string", "description": "The name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource." }, + "relations": { + "description": "The set of relations associated to this result", + "type": "array", + "items": { + "type": "object", + "properties": { + "provenance": { + "allOf": [ + {"$ref": "#/definitions/Provenance"}, + {"description": "The reason why OpenAIRE holds the relation "} + ] + }, + "reltype": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "type": {"type": "string"} + }, + "description": "To represent the semantics of a relation between two entities" + }, + "source": { + "type": "string", + "description": "The node source in the relation" + }, + "target": { + "type": "string", + "description": "The node target in the relation" + } + }, + "description": "The set of relations associated to this result" + } + }, "size": { "type": "string", "description": "Only for results with type 'dataset': the declared size of the dataset" @@ -588,4 +654,4 @@ "description": "Version of the result" } } -} \ No newline at end of file +} diff --git a/dump/src/main/java/eu/dnetlib/dhp/oa/graph/dump/ResultMapper.java b/dump/src/main/java/eu/dnetlib/dhp/oa/graph/dump/ResultMapper.java index db01c86..b844bf0 100644 --- a/dump/src/main/java/eu/dnetlib/dhp/oa/graph/dump/ResultMapper.java +++ b/dump/src/main/java/eu/dnetlib/dhp/oa/graph/dump/ResultMapper.java @@ -60,7 +60,8 @@ public class ResultMapper implements Serializable { mapSubject(out, input); out.setType(input.getResulttype().getClassid()); mapContext(communityMap, out, input); - mapFulltext(out, input); + mapCollectedfrom(out, input); + } catch (ClassCastException cce) { return null; } @@ -70,6 +71,18 @@ public class ResultMapper implements Serializable { } + private static void mapCollectedfrom(Result out, eu.dnetlib.dhp.schema.oaf.Result input) { + + out + .setCollectedfrom( + input + .getCollectedfrom() + .stream() + .map(cf -> CfHbKeyValue.newInstance(cf.getKey(), cf.getValue())) + .collect(Collectors.toList())); + + } + private static void mapFulltext(Result out, eu.dnetlib.dhp.schema.oaf.Result input) { if (Optional.ofNullable(input.getFulltext()).isPresent() && !input.getFulltext().isEmpty()) out.setFulltext(input.getFulltext().stream().map(ft -> ft.getValue()).collect(Collectors.toList())); @@ -251,8 +264,9 @@ public class ResultMapper implements Serializable { input .getInstance() .stream() - .map(i -> getCommunityInstance(i)) + .map(i -> getCommunityInstance(i, input.getResulttype().getClassid())) .collect(Collectors.toList())); + } } @@ -432,6 +446,8 @@ public class ResultMapper implements Serializable { out.setContainer(c); out.setType(ModelConstants.PUBLICATION_DEFAULT_RESULTTYPE.getClassname()); } + if (Optional.ofNullable(((Publication) input).getFulltext()).isPresent()) + mapFulltext(out, input); break; case "dataset": Dataset id = (Dataset) input; @@ -504,7 +520,8 @@ public class ResultMapper implements Serializable { .orElse(null)); out.setType(ModelConstants.ORP_DEFAULT_RESULTTYPE.getClassname()); - + if (Optional.ofNullable(((OtherResearchProduct) input).getFulltext()).isPresent()) + mapFulltext(out, input); break; default: throw new NoAvailableEntityTypeException(); @@ -520,7 +537,8 @@ public class ResultMapper implements Serializable { } - private static eu.dnetlib.dhp.eosc.model.Instance getCommunityInstance(eu.dnetlib.dhp.schema.oaf.Instance i) { + private static eu.dnetlib.dhp.eosc.model.Instance getCommunityInstance(eu.dnetlib.dhp.schema.oaf.Instance i, + String resultType) { eu.dnetlib.dhp.eosc.model.Instance instance = new eu.dnetlib.dhp.eosc.model.Instance(); setCommonValue(i, instance); @@ -529,8 +547,11 @@ public class ResultMapper implements Serializable { .setHostedby( CfHbKeyValue.newInstance(i.getHostedby().getKey(), i.getHostedby().getValue())); - instance.setFulltext(i.getFulltext()); - + if (resultType.equals("publication") || + resultType.equals("other")) { + if (Optional.ofNullable(i.getFulltext()).isPresent()) + instance.setFulltext(i.getFulltext()); + } return instance; }