Project

General

Profile

« Previous | Next » 

Revision 51709

handling groups with datasourcename

View differences:

modules/dnet-parthenos-publisher/trunk/src/main/java/eu/dnetlib/parthenos/jrr/JRRPublisher.java
57 57

  
58 58
	public void register(final String record) throws ParthenosPublisherException, IOException, ResourceRegistryException, URISyntaxException {
59 59
		String id = recordParserHelper.getObjIdentifier(record);
60
		String datasourceName = recordParserHelper.getDatasourceName(record);
60 61
		//objIdentifier contains the subject URI used to get the RDF: that is the only resource we have to register when processing this rdf file!
61 62
		log.debug("REGISTERING ON JRR: "+id);
62 63
		String rdfRecord = recordParserHelper.getRDF(record);
63 64
		InfModel model = loadBaseModel();
64 65
		model.read(IOUtils.toInputStream(rdfRecord), CRMpe.NS, "RDF/XML");
65
		register(model, id);
66
		register(model, id, datasourceName);
66 67
	}
67 68

  
68 69

  
69
	protected void register(final Model model, final String resourceURI) throws ParthenosPublisherException, IOException, URISyntaxException {
70
	protected void register(final Model model, final String resourceURI, final String datasourceName) throws ParthenosPublisherException, IOException, URISyntaxException {
70 71
		Resource rdfResource = model.getResource(resourceURI);
71 72
		if(rdfResource == null){
72 73
			log.error("UNEXPECTED NULL rdfResource with resourceURI "+resourceURI+". I am skipping it, but you should check!");
......
74 75
		else {
75 76
			//call the correct register method based on the resource type
76 77
			//we skip everything that is not Software, Actor, Service, Dataset, Curation Plan and Project: other entities are in fact source of metadata for them
77
			if (rdfResource.hasProperty(RDF.type, CRM.E39_Actor)) registerRDFResource(rdfResource, CRM.E39_Actor);
78
			if (rdfResource.hasProperty(RDF.type, CRM.E39_Actor)) registerRDFResource(rdfResource, CRM.E39_Actor, datasourceName);
78 79
			else {
79 80
				if (rdfResource.hasProperty(RDF.type, CRMdig.D14_Software) || rdfResource.hasProperty(RDF.type, CRMpe.PE18_Dataset))
80
					registerRDFResource(rdfResource, CRM.E70_Thing);
81
					registerRDFResource(rdfResource, CRM.E70_Thing, datasourceName);
81 82
				else {
82 83
					if (rdfResource.hasProperty(RDF.type, CRMpe.PE1_Service) || rdfResource.hasProperty(RDF.type, CRMpe.PE35_Project))
83
						registerRDFResource(rdfResource, CRM.E7_Activity);
84
						registerRDFResource(rdfResource, CRM.E7_Activity, datasourceName);
84 85
					else {
85
						if (rdfResource.hasProperty(RDF.type, CRMpe.PE28_Curation_Plan)) registerRDFResource(rdfResource, CRM.E29_Design_or_Procedure);
86
						if (rdfResource.hasProperty(RDF.type, CRMpe.PE28_Curation_Plan)) registerRDFResource(rdfResource, CRM.E29_Design_or_Procedure, datasourceName);
86 87
						else log.debug("Skipping " + resourceURI + " because of its type");
87 88
					}
88 89
				}
......
91 92
	}
92 93

  
93 94

  
94
	protected boolean registerRDFResource(final Resource rdfResource, final Resource type)
95
	protected boolean registerRDFResource(final Resource rdfResource, final Resource type, final String catalogueGroup)
95 96
			throws ParthenosPublisherException, IOException, URISyntaxException {
96 97
		String resURI = rdfResource.getURI();
97 98
		if (!resURI.startsWith("http")) {
......
100 101
			return false;
101 102
		}
102 103
		else {
103
				String uuid = registerOnCatalogue(rdfResource, type);
104
				String uuid = registerOnCatalogue(rdfResource, type, catalogueGroup);
104 105
				if(StringUtils.isNotBlank(uuid)){
105 106
					//TODO: let's skip the registration on the registry for now.
106 107
					//registerOnRegistry(rdfResource, uuid, type);
......
120 121
	 * @return the catalogue uuid
121 122
	 * @throws IOException
122 123
	 */
123
	protected String registerOnCatalogue(final Resource rdfResource, final Resource type) throws ParthenosPublisherException, IOException, URISyntaxException {
124
		return catalogueRegistrator.register(rdfResource, type);
124
	protected String registerOnCatalogue(final Resource rdfResource, final Resource type, final String catalogueGroup) throws ParthenosPublisherException, IOException, URISyntaxException {
125
		return catalogueRegistrator.register(rdfResource, type, catalogueGroup);
125 126
	}
126 127

  
127 128
	protected void registerOnRegistry(final Resource rdfResource, final String uuid, final Resource type)

Also available in: Unified diff