diff --git a/README.md b/README.md index c1b9d71..268d1ac 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,21 @@ # Catalog Search Service -Search functionalities are provided by this service. It communicates with the ontological data source, which stores products and user services persistently. +The implemented search mechanism focus on an ontological search. Therefore, it takes all information of an entity into account, which includes its location in a taxonomy as well as all entities’ properties. To enable this, a formalization of the catalogues lies is a precondition and is provided by the indexing service by. -The service can use a local ontology (file) or a Marmotta instance (url) as data source. In each of the cases, a different property must be set. +##Approach: +The goal of this search is to define iteratively in a user driven process which properties of a product or service are relevant for the current search request. Only the selected properties are used to show the user concrete products or services (search result). The explorative behaviour of the search is supported by a graph-based navigation, which allows the iterative exploration of the search space. In so doing, the user learns the available information (product structure and specific instances) for a product/service while he is exploring the search space. Intensional queries are intensively used to support this feature. -In the case of Marmotta, you need the Spring property: nimble.shared.property.marmottauri {any URL} -In the case of local file, you need the Spring property: nimble.shared.property.ontologyfile {abolute path to the file} -In the case of SOLR Index: nimble.shared.property.useSOLRIndex {true | false} +You can run this service as a Docker with the following command (just an example): docker run –p 8050:8080 search-service:0.0.1 -In the case of using Marmotta in combinbation with SOLR Index you need the parameters nimble.shared.property.marmottauri and nimble.shared.property.useSOLRIndex - -you can run this service as a Docker with the following command (just an example): docker run –p 8050:8080  -e NIMBLE_SHARED_PROPERTY_MARMOTTAURI:http://134.168.33.237:8080/marmotta search-service:0.0.1 +##Comment: +The search mechanism using ontologies (file based or accessible by a triple store) and corresponding SPARQL queries are not supported any longer. In the case of interest, please contact: fma@biba.uni-bremen.de ------------------------------------------------- 1. Swagger problem -(1) Das Maven-Plugin kann nicht integriert werden, was nicht weiter schlimm ist. Hier einfach den Fehler in eine Warnung umwandeln. -In Eclipse: "Preferences -> Maven -> Error/Warnings" und Fehler in Warnung umwandeln: "Plugin execution not converted by lifecycle configuration” -(2) Um den von Swagger autogenerierten Quellcode zu Eclipse hinzuzufügen bitte - (a) "mvn clean package” in der Konsole ausführen, um den Quellcode zu generieren. Um "mvn package" richtig auszuführen, die pfad zu owl Datei in "MediatorSPARQLDerivationTest" angepasst werden muss. - - (b) Im “Project Explorer” in Eclipse den Ordner “target/generated-sources/swagger/src/gen/java/main” als Source Folder hinzufügen. +(1) The Maven plugin cannot be integrated, which is not a bad thing. Here simply convert the error into a warning. +In Eclipse: "Preferences -> Maven -> Error/Warnings" convert errors in warnings "Plugin execution not converted by lifecycle configuration” +(2) To add the source code generated by Swagger auto to Eclipse please + (a) run "mvn clean package” in a shell to generate sourecode. + (b) Im “Project Explorer” in Eclipse the folder “target/generated-sources/swagger/src/gen/java/main” set the folder as source folder. ------------------------------------------- -2. Debug program -0) update the path within "start.bat" -1) Start "start.bat" -2) You will still need to attach the debugger in Eclipse by making a new Debug Configuration for a "Remote Java Application" on the relevant port. - diff --git a/getDetectMeaningExample.txt b/getDetectMeaningExample.txt deleted file mode 100644 index b712b87..0000000 --- a/getDetectMeaningExample.txt +++ /dev/null @@ -1 +0,0 @@ -http://localhost:8090/detectMeaningLanguageSpecific?inputAsJson={%22keyword%22:%22robot%22,%22language%22:%22en%22} \ No newline at end of file diff --git a/getLogicalView_Test_Example.txt b/getLogicalView_Test_Example.txt deleted file mode 100644 index ce252aa..0000000 --- a/getLogicalView_Test_Example.txt +++ /dev/null @@ -1,66 +0,0 @@ - - - Test Case 1: - Query - Input: search HighChair, steprange 1 - Expected output: HighChair info, Price wihout detail properties - - Input: - - http://localhost:8090/getLogicalView - -Body: -{"concept":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair", -"stepRange":1, -"frozenConcept":"HighChair", -"language":"es", -"distanceToFrozenConcept":0, -"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"], -"currentSelections":[["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"]] -} - - - - Output: -{"viewStructure":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","translatedURL":"Trona","language":"SPANISH","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAverageDeliveryTimeInDays","translatedURL":"tieneTiempoMedioDeEntregaEnDias","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasSeatBelt","translatedURL":"tieneCinturónDeSeguridad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isStackable","translatedURL":"esApilable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasEAN","translatedURL":"tieneCódigoEAN","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#madeInCountry","translatedURL":"fabricadoEn","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeight","translatedURL":"tieneAltura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWeightInKilograms","translatedURL":"hasWeightInKilograms","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfCastors","translatedURL":"tieneNúmeroDeRuedas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaximumRecommendedWeight","translatedURL":"tienePesoMáximoRecomendado","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAdjustableHeight","translatedURL":"tieneAlturaRegulable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPackQuantity","translatedURL":"tieneUnidadesPorPaquete","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfLegs","translatedURL":"tieneNúmeroDePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDepth","translatedURL":"tieneProfundidad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegs","translatedURL":"tienePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isFoldable","translatedURL":"esPlegable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWidth","translatedURL":"tieneAnchura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCastors","translatedURL":"tieneRuedas","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","translatedURL":"MateriaPrima","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style","translatedURL":"Estilo","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","translatedURL":"Fabricante","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":0,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"],"hasHiddenDirectParent":false},"completeStructure":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","translatedURL":"Trona","language":"SPANISH","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAverageDeliveryTimeInDays","translatedURL":"tieneTiempoMedioDeEntregaEnDias","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasSeatBelt","translatedURL":"tieneCinturónDeSeguridad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isStackable","translatedURL":"esApilable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasEAN","translatedURL":"tieneCódigoEAN","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#madeInCountry","translatedURL":"fabricadoEn","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeight","translatedURL":"tieneAltura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWeightInKilograms","translatedURL":"hasWeightInKilograms","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfCastors","translatedURL":"tieneNúmeroDeRuedas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaximumRecommendedWeight","translatedURL":"tienePesoMáximoRecomendado","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAdjustableHeight","translatedURL":"tieneAlturaRegulable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPackQuantity","translatedURL":"tieneUnidadesPorPaquete","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfLegs","translatedURL":"tieneNúmeroDePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDepth","translatedURL":"tieneProfundidad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegs","translatedURL":"tienePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isFoldable","translatedURL":"esPlegable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWidth","translatedURL":"tieneAnchura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCastors","translatedURL":"tieneRuedas","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","translatedURL":"MateriaPrima","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style","translatedURL":"Estilo","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","translatedURL":"Fabricante","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":0,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"],"hasHiddenDirectParent":false},"currentSelections":[["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"]]} - - -// Test case 2: HighChair-->isManfuacturedBy (objProp)--->Manufactuer---> compliesWithLegislation (objProp) ---> Legislation ---> hasLegislationName (dataProp) --->String -// Query 1: - input: HighChair with stepRange 2 - expected: show concept Legislation, but no details for the concept Legislation - -// Query 2: - input: Legislation with stepRange 1 and output from query 1 as old json - expected: 1) show details for Legislation 2) all other properties of Manufactuer is marked as hidden - - //todo: check result - - Query 1: - input: - - http://localhost:8090/getLogicalView - - Body: - -{"concept":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair", "stepRange":2,"frozenConcept":"HighChair","language":"es", "distanceToFrozenConcept":0, "conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"],"currentSelections":[["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"]]} - - - output: - {"viewStructure":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","translatedURL":"Trona","language":"SPANISH","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAverageDeliveryTimeInDays","translatedURL":"tieneTiempoMedioDeEntregaEnDias","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasSeatBelt","translatedURL":"tieneCinturónDeSeguridad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isStackable","translatedURL":"esApilable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasEAN","translatedURL":"tieneCódigoEAN","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#madeInCountry","translatedURL":"fabricadoEn","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeight","translatedURL":"tieneAltura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWeightInKilograms","translatedURL":"hasWeightInKilograms","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfCastors","translatedURL":"tieneNúmeroDeRuedas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaximumRecommendedWeight","translatedURL":"tienePesoMáximoRecomendado","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAdjustableHeight","translatedURL":"tieneAlturaRegulable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPackQuantity","translatedURL":"tieneUnidadesPorPaquete","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfLegs","translatedURL":"tieneNúmeroDePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDepth","translatedURL":"tieneProfundidad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegs","translatedURL":"tienePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isFoldable","translatedURL":"esPlegable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWidth","translatedURL":"tieneAnchura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCastors","translatedURL":"tieneRuedas","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","translatedURL":"MateriaPrima","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaterialComposition","translatedURL":"tieneComposiciónDeMaterial","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasFreeSampleDelivery","translatedURL":"seEntregaMuestraGratuita","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasRegulationName","translatedURL":"tieneNombreRegulación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPriceValue","translatedURL":"tieneValorDePrecio","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCurrency","translatedURL":"tieneMoneda","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPriceGranularity","translatedURL":"tieneGranularidadPrecio","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style","translatedURL":"Estilo","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","translatedURL":"Fabricante","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCompanyName","translatedURL":"tieneNombreDeEmpresa","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasTelephone","translatedURL":"tieneTeléfono","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasElectronicMail","translatedURL":"tieneCorreoElectrónico","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasTelefax","translatedURL":"tieneTelefax","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasVATNumber","translatedURL":"tieneNúmeroCIF","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAwards","translatedURL":"tienePremios","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasVatID","translatedURL":"tieneVAT","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAddress","translatedURL":"tieneDirección","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeadquartersInCountries","translatedURL":"tieneSedeEnPaíses","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWebPage","translatedURL":"tienePáginaWeb","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue","translatedURL":"Catálogo","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"41eca155:15df5580a28:-7fbf":{"concept":{"url":"41eca155:15df5580a28:-7fbf","translatedURL":"41eca155:15df5580a28:-7fbf","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","41eca155:15df5580a28:-7fbf"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson","translatedURL":"PersonaDeContacto","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasGuaranteePeriodInMonths","translatedURL":"tienePeríodoDeGarantíaEnMeses","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasGuaranteeConditions","translatedURL":"tieneCondicionesDeGarantía","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegislationName","translatedURL":"tieneNombreLegislación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":0,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"],"hasHiddenDirectParent":false},"completeStructure":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","translatedURL":"Trona","language":"SPANISH","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAverageDeliveryTimeInDays","translatedURL":"tieneTiempoMedioDeEntregaEnDias","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasSeatBelt","translatedURL":"tieneCinturónDeSeguridad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isStackable","translatedURL":"esApilable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasEAN","translatedURL":"tieneCódigoEAN","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#madeInCountry","translatedURL":"fabricadoEn","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeight","translatedURL":"tieneAltura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWeightInKilograms","translatedURL":"hasWeightInKilograms","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfCastors","translatedURL":"tieneNúmeroDeRuedas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaximumRecommendedWeight","translatedURL":"tienePesoMáximoRecomendado","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAdjustableHeight","translatedURL":"tieneAlturaRegulable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPackQuantity","translatedURL":"tieneUnidadesPorPaquete","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfLegs","translatedURL":"tieneNúmeroDePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDepth","translatedURL":"tieneProfundidad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegs","translatedURL":"tienePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isFoldable","translatedURL":"esPlegable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWidth","translatedURL":"tieneAnchura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCastors","translatedURL":"tieneRuedas","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","translatedURL":"MateriaPrima","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaterialComposition","translatedURL":"tieneComposiciónDeMaterial","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasFreeSampleDelivery","translatedURL":"seEntregaMuestraGratuita","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasRegulationName","translatedURL":"tieneNombreRegulación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPriceValue","translatedURL":"tieneValorDePrecio","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCurrency","translatedURL":"tieneMoneda","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPriceGranularity","translatedURL":"tieneGranularidadPrecio","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style","translatedURL":"Estilo","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","translatedURL":"Fabricante","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCompanyName","translatedURL":"tieneNombreDeEmpresa","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasTelephone","translatedURL":"tieneTeléfono","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasElectronicMail","translatedURL":"tieneCorreoElectrónico","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasTelefax","translatedURL":"tieneTelefax","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasVATNumber","translatedURL":"tieneNúmeroCIF","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAwards","translatedURL":"tienePremios","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasVatID","translatedURL":"tieneVAT","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAddress","translatedURL":"tieneDirección","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeadquartersInCountries","translatedURL":"tieneSedeEnPaíses","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWebPage","translatedURL":"tienePáginaWeb","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue","translatedURL":"Catálogo","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"41eca155:15df5580a28:-7fbf":{"concept":{"url":"41eca155:15df5580a28:-7fbf","translatedURL":"41eca155:15df5580a28:-7fbf","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","41eca155:15df5580a28:-7fbf"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson","translatedURL":"PersonaDeContacto","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasGuaranteePeriodInMonths","translatedURL":"tienePeríodoDeGarantíaEnMeses","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasGuaranteeConditions","translatedURL":"tieneCondicionesDeGarantía","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegislationName","translatedURL":"tieneNombreLegislación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":0,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"],"hasHiddenDirectParent":false},"currentSelections":[["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"]]} - -Query 2: -Input: - -http://localhost:8090/getLogicalView - -Body: - -{"concept":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation", "stepRange":1,"frozenConcept":"HighChair","language":"es", "distanceToFrozenConcept":2, -"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair", "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer", "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"currentSelections":[["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"]], -"oldJsonLogicalView": {"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","translatedURL":"Trona","language":"SPANISH","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAverageDeliveryTimeInDays","translatedURL":"tieneTiempoMedioDeEntregaEnDias","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasSeatBelt","translatedURL":"tieneCinturónDeSeguridad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isStackable","translatedURL":"esApilable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasEAN","translatedURL":"tieneCódigoEAN","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#madeInCountry","translatedURL":"fabricadoEn","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeight","translatedURL":"tieneAltura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWeightInKilograms","translatedURL":"hasWeightInKilograms","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfCastors","translatedURL":"tieneNúmeroDeRuedas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaximumRecommendedWeight","translatedURL":"tienePesoMáximoRecomendado","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAdjustableHeight","translatedURL":"tieneAlturaRegulable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPackQuantity","translatedURL":"tieneUnidadesPorPaquete","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfLegs","translatedURL":"tieneNúmeroDePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDepth","translatedURL":"tieneProfundidad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegs","translatedURL":"tienePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isFoldable","translatedURL":"esPlegable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWidth","translatedURL":"tieneAnchura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCastors","translatedURL":"tieneRuedas","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","translatedURL":"MateriaPrima","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaterialComposition","translatedURL":"tieneComposiciónDeMaterial","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasFreeSampleDelivery","translatedURL":"seEntregaMuestraGratuita","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasRegulationName","translatedURL":"tieneNombreRegulación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPriceValue","translatedURL":"tieneValorDePrecio","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCurrency","translatedURL":"tieneMoneda","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPriceGranularity","translatedURL":"tieneGranularidadPrecio","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style","translatedURL":"Estilo","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","translatedURL":"Fabricante","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCompanyName","translatedURL":"tieneNombreDeEmpresa","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasTelephone","translatedURL":"tieneTeléfono","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasElectronicMail","translatedURL":"tieneCorreoElectrónico","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasTelefax","translatedURL":"tieneTelefax","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasVATNumber","translatedURL":"tieneNúmeroCIF","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAwards","translatedURL":"tienePremios","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasVatID","translatedURL":"tieneVAT","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAddress","translatedURL":"tieneDirección","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeadquartersInCountries","translatedURL":"tieneSedeEnPaíses","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWebPage","translatedURL":"tienePáginaWeb","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue","translatedURL":"Catálogo","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"41eca155:15df5580a28:-7fbf":{"concept":{"url":"41eca155:15df5580a28:-7fbf","translatedURL":"41eca155:15df5580a28:-7fbf","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","41eca155:15df5580a28:-7fbf"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson","translatedURL":"PersonaDeContacto","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasGuaranteePeriodInMonths","translatedURL":"tienePeríodoDeGarantíaEnMeses","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasGuaranteeConditions","translatedURL":"tieneCondicionesDeGarantía","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegislationName","translatedURL":"tieneNombreLegislación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":0,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"],"hasHiddenDirectParent":false} -} - - -//output: -{"viewStructure":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","translatedURL":"Trona","language":"SPANISH","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAverageDeliveryTimeInDays","translatedURL":"tieneTiempoMedioDeEntregaEnDias","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasSeatBelt","translatedURL":"tieneCinturónDeSeguridad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isStackable","translatedURL":"esApilable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasEAN","translatedURL":"tieneCódigoEAN","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#madeInCountry","translatedURL":"fabricadoEn","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeight","translatedURL":"tieneAltura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWeightInKilograms","translatedURL":"hasWeightInKilograms","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfCastors","translatedURL":"tieneNúmeroDeRuedas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaximumRecommendedWeight","translatedURL":"tienePesoMáximoRecomendado","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAdjustableHeight","translatedURL":"tieneAlturaRegulable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPackQuantity","translatedURL":"tieneUnidadesPorPaquete","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfLegs","translatedURL":"tieneNúmeroDePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDepth","translatedURL":"tieneProfundidad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegs","translatedURL":"tienePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isFoldable","translatedURL":"esPlegable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWidth","translatedURL":"tieneAnchura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCastors","translatedURL":"tieneRuedas","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","translatedURL":"MateriaPrima","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaterialComposition","translatedURL":"tieneComposiciónDeMaterial","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasFreeSampleDelivery","translatedURL":"seEntregaMuestraGratuita","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasRegulationName","translatedURL":"tieneNombreRegulación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPriceValue","translatedURL":"tieneValorDePrecio","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCurrency","translatedURL":"tieneMoneda","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPriceGranularity","translatedURL":"tieneGranularidadPrecio","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style","translatedURL":"Estilo","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasGuaranteePeriodInMonths","translatedURL":"tienePeríodoDeGarantíaEnMeses","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasGuaranteeConditions","translatedURL":"tieneCondicionesDeGarantía","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegislationName","translatedURL":"tieneNombreLegislación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":true}},"frozenConcept":"HighChair","distanceToFrozenConcept":0,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"],"hasHiddenDirectParent":false},"completeStructure":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","translatedURL":"Trona","language":"SPANISH","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAverageDeliveryTimeInDays","translatedURL":"tieneTiempoMedioDeEntregaEnDias","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasSeatBelt","translatedURL":"tieneCinturónDeSeguridad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isStackable","translatedURL":"esApilable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasEAN","translatedURL":"tieneCódigoEAN","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#madeInCountry","translatedURL":"fabricadoEn","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeight","translatedURL":"tieneAltura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWeightInKilograms","translatedURL":"hasWeightInKilograms","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfCastors","translatedURL":"tieneNúmeroDeRuedas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaximumRecommendedWeight","translatedURL":"tienePesoMáximoRecomendado","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAdjustableHeight","translatedURL":"tieneAlturaRegulable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPackQuantity","translatedURL":"tieneUnidadesPorPaquete","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasNumberOfLegs","translatedURL":"tieneNúmeroDePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDepth","translatedURL":"tieneProfundidad","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegs","translatedURL":"tienePatas","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isFoldable","translatedURL":"esPlegable","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWidth","translatedURL":"tieneAnchura","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCastors","translatedURL":"tieneRuedas","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","translatedURL":"MateriaPrima","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasName","translatedURL":"tieneNombre","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasMaterialComposition","translatedURL":"tieneComposiciónDeMaterial","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasFreeSampleDelivery","translatedURL":"seEntregaMuestraGratuita","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCodeValue","translatedURL":"tieneCódigo","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasDescription","translatedURL":"tieneDescripción","isHidden":false}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Material"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasRegulationName","translatedURL":"tieneNombreRegulación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price","translatedURL":"Precio","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPriceValue","translatedURL":"tieneValorDePrecio","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCurrency","translatedURL":"tieneMoneda","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasPriceGranularity","translatedURL":"tieneGranularidadPrecio","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Price"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style","translatedURL":"Estilo","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Style"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour","translatedURL":"Color","isHidden":false},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Colour"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","translatedURL":"Fabricante","isHidden":true},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasCompanyName","translatedURL":"tieneNombreDeEmpresa","isHidden":true},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasTelephone","translatedURL":"tieneTeléfono","isHidden":true},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasElectronicMail","translatedURL":"tieneCorreoElectrónico","isHidden":true},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasTelefax","translatedURL":"tieneTelefax","isHidden":true},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasVATNumber","translatedURL":"tieneNúmeroCIF","isHidden":true},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAwards","translatedURL":"tienePremios","isHidden":true},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasVatID","translatedURL":"tieneVAT","isHidden":true},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasAddress","translatedURL":"tieneDirección","isHidden":true},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeadquartersInCountries","translatedURL":"tieneSedeEnPaíses","isHidden":true},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWebPage","translatedURL":"tienePáginaWeb","isHidden":true}],"objectproperties":{"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue","translatedURL":"Catálogo","isHidden":true},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Catalogue"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation","translatedURL":"Normativa","isHidden":true},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Regulation"],"hasHiddenDirectParent":false},"41eca155:15df5580a28:-7fbf":{"concept":{"url":"41eca155:15df5580a28:-7fbf","translatedURL":"41eca155:15df5580a28:-7fbf","isHidden":true},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","41eca155:15df5580a28:-7fbf"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson","translatedURL":"PersonaDeContacto","isHidden":true},"dataproperties":[],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegislationName","translatedURL":"tieneNombreLegislación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":2,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":true}},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee","translatedURL":"Garantía","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasGuaranteePeriodInMonths","translatedURL":"tienePeríodoDeGarantíaEnMeses","isHidden":false},{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasGuaranteeConditions","translatedURL":"tieneCondicionesDeGarantía","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Guarantee"],"hasHiddenDirectParent":false},"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation":{"concept":{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation","translatedURL":"Legislación","isHidden":false},"dataproperties":[{"url":"http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasLegislationName","translatedURL":"tieneNombreLegislación","isHidden":false}],"objectproperties":{},"frozenConcept":"HighChair","distanceToFrozenConcept":1,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair","http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"],"hasHiddenDirectParent":false}},"frozenConcept":"HighChair","distanceToFrozenConcept":0,"conceptURIPath":["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"],"hasHiddenDirectParent":false},"currentSelections":[["http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"]]} \ No newline at end of file diff --git a/getPropertiesFromGreenGroupExample.txt b/getPropertiesFromGreenGroupExample.txt deleted file mode 100644 index 515e431..0000000 --- a/getPropertiesFromGreenGroupExample.txt +++ /dev/null @@ -1,2 +0,0 @@ -http://localhost:8090/getPropertyValuesFromGreenGroup?inputAsJson={%22conceptURL%22:%22http%3A%2F%2Fwww.aidimme.es%2FFurnitureSectorOntology.owl%23StackerRobot%22,%22propertyURL%22:%22Height%22,%22propertySource%22:%22DIMENSION%22} -http://localhost:8090/getPropertyValuesFromGreenGroup?inputAsJson={%22conceptURL%22:%22http%3A%2F%2Fwww.aidimme.es%2FFurnitureSectorOntology.owl%23StackerRobot%22,%22propertyURL%22:%22http%3A%2F%2Fwww.aidimme.es%2FFurnitureSectorOntology.owl%23compliesWithLegislation%22,%22propertySource%22:%22DOMAIN_SPECIFIC_PROPERTY%22} \ No newline at end of file diff --git a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.4-SNAPSHOT/de.biba.reasoning.mediator-0.0.4-SNAPSHOT.jar b/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.4-SNAPSHOT/de.biba.reasoning.mediator-0.0.4-SNAPSHOT.jar deleted file mode 100644 index 531d265..0000000 Binary files a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.4-SNAPSHOT/de.biba.reasoning.mediator-0.0.4-SNAPSHOT.jar and /dev/null differ diff --git a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.4-SNAPSHOT/de.biba.reasoning.mediator-0.0.4-SNAPSHOT.pom b/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.4-SNAPSHOT/de.biba.reasoning.mediator-0.0.4-SNAPSHOT.pom deleted file mode 100644 index 382e779..0000000 --- a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.4-SNAPSHOT/de.biba.reasoning.mediator-0.0.4-SNAPSHOT.pom +++ /dev/null @@ -1,9 +0,0 @@ - - - 4.0.0 - de.biba.mediator - de.biba.reasoning.mediator - 0.0.4-SNAPSHOT - POM was created from install:install-file - diff --git a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.4-SNAPSHOT/maven-metadata-local.xml b/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.4-SNAPSHOT/maven-metadata-local.xml deleted file mode 100644 index bced332..0000000 --- a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.4-SNAPSHOT/maven-metadata-local.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - de.biba.mediator - de.biba.reasoning.mediator - 0.0.4-SNAPSHOT - - - true - - 20170705151324 - - - jar - 0.0.4-SNAPSHOT - 20170705151324 - - - pom - 0.0.4-SNAPSHOT - 20170705151324 - - - - diff --git a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.7-SNAPSHOT/de.biba.reasoning.mediator-0.0.4-SNAPSHOT.jar b/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.7-SNAPSHOT/de.biba.reasoning.mediator-0.0.4-SNAPSHOT.jar deleted file mode 100644 index 531d265..0000000 Binary files a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.7-SNAPSHOT/de.biba.reasoning.mediator-0.0.4-SNAPSHOT.jar and /dev/null differ diff --git a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.7-SNAPSHOT/maven-metadata-local.xml b/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.7-SNAPSHOT/maven-metadata-local.xml deleted file mode 100644 index bced332..0000000 --- a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/0.0.7-SNAPSHOT/maven-metadata-local.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - de.biba.mediator - de.biba.reasoning.mediator - 0.0.4-SNAPSHOT - - - true - - 20170705151324 - - - jar - 0.0.4-SNAPSHOT - 20170705151324 - - - pom - 0.0.4-SNAPSHOT - 20170705151324 - - - - diff --git a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/maven-metadata-local.xml b/libRepo/de/biba/mediator/de.biba.reasoning.mediator/maven-metadata-local.xml index c125408..954b815 100644 --- a/libRepo/de/biba/mediator/de.biba.reasoning.mediator/maven-metadata-local.xml +++ b/libRepo/de/biba/mediator/de.biba.reasoning.mediator/maven-metadata-local.xml @@ -1,11 +1,11 @@ - - - de.biba.mediator - de.biba.reasoning.mediator - - - 0.0.4-SNAPSHOT - - 20170705151324 - - + + + de.biba.mediator + de.biba.reasoning.mediator + + + 0.0.4-SNAPSHOT + + 20170705151324 + + diff --git a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/de.biba.triple.store.access-0.0.8-SNAPSHOT-jar-with-dependencies.jar b/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/de.biba.triple.store.access-0.0.8-SNAPSHOT-jar-with-dependencies.jar deleted file mode 100644 index 17f7bb1..0000000 Binary files a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/de.biba.triple.store.access-0.0.8-SNAPSHOT-jar-with-dependencies.jar and /dev/null differ diff --git a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/de.biba.triple.store.access-0.0.8-SNAPSHOT.jar b/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/de.biba.triple.store.access-0.0.8-SNAPSHOT.jar deleted file mode 100644 index bd96c66..0000000 Binary files a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/de.biba.triple.store.access-0.0.8-SNAPSHOT.jar and /dev/null differ diff --git a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/de.biba.triple.store.access-0.0.8-SNAPSHOT.pom b/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/de.biba.triple.store.access-0.0.8-SNAPSHOT.pom deleted file mode 100644 index f262b6d..0000000 --- a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/de.biba.triple.store.access-0.0.8-SNAPSHOT.pom +++ /dev/null @@ -1,9 +0,0 @@ - - - 4.0.0 - de.biba.mediator - de.biba.triple.store.access - 0.0.8-SNAPSHOT - POM was created from install:install-file - diff --git a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/maven-metadata-local.xml b/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/maven-metadata-local.xml deleted file mode 100644 index 5195b87..0000000 --- a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.8-SNAPSHOT/maven-metadata-local.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - de.biba.mediator - de.biba.triple.store.access - 0.0.1-SNAPSHOT - - - true - - 20170705192912 - - - jar - 0.0.1-SNAPSHOT - 20170705192912 - - - pom - 0.0.1-SNAPSHOT - 20170705192912 - - - - diff --git a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.9-SNAPSHOT/de.biba.triple.store.access-0.0.9-SNAPSHOT-jar-with-dependencies.jar b/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.9-SNAPSHOT/de.biba.triple.store.access-0.0.9-SNAPSHOT-jar-with-dependencies.jar deleted file mode 100644 index eeca5b4..0000000 Binary files a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.9-SNAPSHOT/de.biba.triple.store.access-0.0.9-SNAPSHOT-jar-with-dependencies.jar and /dev/null differ diff --git a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.9-SNAPSHOT/de.biba.triple.store.access-0.0.9-SNAPSHOT.jar b/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.9-SNAPSHOT/de.biba.triple.store.access-0.0.9-SNAPSHOT.jar deleted file mode 100644 index caea8e2..0000000 Binary files a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.9-SNAPSHOT/de.biba.triple.store.access-0.0.9-SNAPSHOT.jar and /dev/null differ diff --git a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.9-SNAPSHOT/de.biba.triple.store.access-0.0.9-SNAPSHOT.pom b/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.9-SNAPSHOT/de.biba.triple.store.access-0.0.9-SNAPSHOT.pom deleted file mode 100644 index 8a7d189..0000000 --- a/libRepo/de/biba/mediator/de.biba.triple.store.access/0.0.9-SNAPSHOT/de.biba.triple.store.access-0.0.9-SNAPSHOT.pom +++ /dev/null @@ -1,9 +0,0 @@ - - - 4.0.0 - de.biba.mediator - de.biba.triple.store.access - 0.0.9-SNAPSHOT - POM was created from install:install-file - diff --git a/libRepo/de/biba/mediator/de.biba.triple.store.access/maven-metadata-local.xml b/libRepo/de/biba/mediator/de.biba.triple.store.access/maven-metadata-local.xml deleted file mode 100644 index b57c07b..0000000 --- a/libRepo/de/biba/mediator/de.biba.triple.store.access/maven-metadata-local.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - de.biba.mediator - de.biba.triple.store.access - - - 0.0.1-SNAPSHOT - - 20170705192912 - - diff --git a/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/0.0.1-SNAPSHOT/de.biba.wrapper.simplehttpWrapper-0.0.1-SNAPSHOT.jar b/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/0.0.1-SNAPSHOT/de.biba.wrapper.simplehttpWrapper-0.0.1-SNAPSHOT.jar deleted file mode 100644 index 6fe0b95..0000000 Binary files a/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/0.0.1-SNAPSHOT/de.biba.wrapper.simplehttpWrapper-0.0.1-SNAPSHOT.jar and /dev/null differ diff --git a/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/0.0.1-SNAPSHOT/de.biba.wrapper.simplehttpWrapper-0.0.1-SNAPSHOT.pom b/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/0.0.1-SNAPSHOT/de.biba.wrapper.simplehttpWrapper-0.0.1-SNAPSHOT.pom deleted file mode 100644 index d74838f..0000000 --- a/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/0.0.1-SNAPSHOT/de.biba.wrapper.simplehttpWrapper-0.0.1-SNAPSHOT.pom +++ /dev/null @@ -1,9 +0,0 @@ - - - 4.0.0 - de.biba.mediator - de.biba.wrapper.simplehttpWrapper - 0.0.1-SNAPSHOT - POM was created from install:install-file - diff --git a/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/0.0.1-SNAPSHOT/maven-metadata-local.xml b/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/0.0.1-SNAPSHOT/maven-metadata-local.xml deleted file mode 100644 index 0cdd364..0000000 --- a/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/0.0.1-SNAPSHOT/maven-metadata-local.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - de.biba.mediator - de.biba.wrapper.simplehttpWrapper - 0.0.1-SNAPSHOT - - - true - - 20170705193857 - - - jar - 0.0.1-SNAPSHOT - 20170705193857 - - - pom - 0.0.1-SNAPSHOT - 20170705193622 - - - - diff --git a/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/maven-metadata-local.xml b/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/maven-metadata-local.xml deleted file mode 100644 index 5586bf5..0000000 --- a/libRepo/de/biba/mediator/de.biba.wrapper.simplehttpWrapper/maven-metadata-local.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - de.biba.mediator - de.biba.wrapper.simplehttpWrapper - - - 0.0.1-SNAPSHOT - - 20170705193857 - - diff --git a/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/0.0.1-SNAPSHOT/de.biba.wrapper.xmlwrapper-0.0.1-SNAPSHOT.jar b/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/0.0.1-SNAPSHOT/de.biba.wrapper.xmlwrapper-0.0.1-SNAPSHOT.jar deleted file mode 100644 index d600ae2..0000000 Binary files a/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/0.0.1-SNAPSHOT/de.biba.wrapper.xmlwrapper-0.0.1-SNAPSHOT.jar and /dev/null differ diff --git a/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/0.0.1-SNAPSHOT/de.biba.wrapper.xmlwrapper-0.0.1-SNAPSHOT.pom b/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/0.0.1-SNAPSHOT/de.biba.wrapper.xmlwrapper-0.0.1-SNAPSHOT.pom deleted file mode 100644 index f2e59b8..0000000 --- a/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/0.0.1-SNAPSHOT/de.biba.wrapper.xmlwrapper-0.0.1-SNAPSHOT.pom +++ /dev/null @@ -1,9 +0,0 @@ - - - 4.0.0 - de.biba.mediator - de.biba.wrapper.xmlwrapper - 0.0.1-SNAPSHOT - POM was created from install:install-file - diff --git a/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/0.0.1-SNAPSHOT/maven-metadata-local.xml b/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/0.0.1-SNAPSHOT/maven-metadata-local.xml deleted file mode 100644 index 3ad24c4..0000000 --- a/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/0.0.1-SNAPSHOT/maven-metadata-local.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - de.biba.mediator - de.biba.wrapper.xmlwrapper - 0.0.1-SNAPSHOT - - - true - - 20170705193102 - - - jar - 0.0.1-SNAPSHOT - 20170705193102 - - - pom - 0.0.1-SNAPSHOT - 20170705193102 - - - - diff --git a/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/maven-metadata-local.xml b/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/maven-metadata-local.xml deleted file mode 100644 index 66298f7..0000000 --- a/libRepo/de/biba/mediator/de.biba.wrapper.xmlwrapper/maven-metadata-local.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - de.biba.mediator - de.biba.wrapper.xmlwrapper - - - 0.0.1-SNAPSHOT - - 20170705193102 - - diff --git a/nimble-anfrae-solr-props.txt b/nimble-anfrae-solr-props.txt deleted file mode 100644 index 41c47ee..0000000 --- a/nimble-anfrae-solr-props.txt +++ /dev/null @@ -1 +0,0 @@ -http://localhost:8090/getInstantiatedPropertiesFromConcept?inputAsJson=%7B%22concept%22%3A%22http%3A%2F%2Fwww.aidimme.es%2FFurnitureSectorOntology.owl%23Seat%22%2C%22stepRange%22%3A0%2C%22language%22%3A%22es%22%2C%22conceptSource%22%3A%22ONTOLOGICAL%22%2C%22frozenConcept%22%3A%22%22%2C%22distanceToFrozenConcept%22%3A0%2C%22conceptURIPath%22%3A%5B%5D%2C%22currentSelections%22%3A%5B%5D%7D \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2c279af..3ad357d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - 4.0.0 @@ -95,34 +96,22 @@ spring-boot-starter-tomcat 1.4.2.RELEASE - - - - - - + org.apache.solr solr-solrj 6.0.0 - - + + org.apache.marmotta marmotta-client-java 3.3.0 - - - de.biba.mediator - de.biba.reasoning.mediator - 0.0.4-SNAPSHOT - - - de.biba.mediator - de.biba.wrapper.xmlwrapper - 0.0.1-SNAPSHOT - + org.apache.jena jena-arq @@ -134,11 +123,8 @@ 3.1.0 pom - - de.biba.mediator - de.biba.triple.store.access - 0.0.9-SNAPSHOT - + org.glassfish @@ -155,23 +141,12 @@ jdom2 2.0.6 - - de.biba.mediator - de.biba.wrapper.xmlwrapper - 0.0.1-SNAPSHOT - - - org.mockito mockito-core 2.11.0 - - diff --git a/src/main/java/de/biba/triple/store/access/AbstractQueryExecutor.java b/src/main/java/de/biba/triple/store/access/AbstractQueryExecutor.java new file mode 100644 index 0000000..effbbfa --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/AbstractQueryExecutor.java @@ -0,0 +1,342 @@ +package de.biba.triple.store.access; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.apache.jena.ontology.OntModelSpec; +import org.apache.jena.query.Query; +import org.apache.jena.query.QueryExecution; +import org.apache.jena.query.QueryExecutionFactory; +import org.apache.jena.query.QueryFactory; +import org.apache.jena.query.QuerySolution; +import org.apache.jena.query.ResultSet; +import org.apache.jena.query.ResultSetFactory; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.rdf.model.ModelFactory; +import org.apache.jena.shared.JenaException; +import org.apache.jena.util.FileManager; + +import de.biba.triple.store.access.enums.ExecutionMode; +import de.biba.triple.store.access.enums.Language; + +public abstract class AbstractQueryExecutor implements IAbstractQueryExecutor { + + protected String dataSetURL = ""; + protected String urlForQueries = dataSetURL + "/query"; + private Model baseModel = null; + protected ExecutionMode executionMode = ExecutionMode.REMOTE; + private List supportedLangauges = new ArrayList(); + private String languageLabel = null; // inlcuding the URL + + public AbstractQueryExecutor(String bseUri, String languageLabel) { + this.languageLabel = languageLabel; + dataSetURL = bseUri; + urlForQueries = dataSetURL + "/query"; + } + + /* + * (non-Javadoc) + * + * @see + * de.biba.triple.store.access.IAbstractQueryExecutor#getUrlForQueries() + */ + @Override + public String getUrlForQueries() { + return urlForQueries; + } + + /* + * (non-Javadoc) + * + * @see de.biba.triple.store.access.IAbstractQueryExecutor#setModeToRemote() + */ + @Override + public void setModeToRemote() { + executionMode = ExecutionMode.REMOTE; + } + + /* + * (non-Javadoc) + * + * @see de.biba.triple.store.access.IAbstractQueryExecutor#getDataSetURL() + */ + @Override + public String getDataSetURL() { + return dataSetURL; + } + + /* + * (non-Javadoc) + * + * @see + * de.biba.triple.store.access.IAbstractQueryExecutor#createResultList(java. + * lang.Object, java.lang.String) + */ + @Override + public List createResultList(Object result, String propertyName) { + ResultSet result2 = (ResultSet) result; + QuerySolution solution; + List allProperties = new ArrayList(); + if (result2 != null) { + while (result2.hasNext()) { + solution = result2.nextSolution(); + if (solution.get(propertyName) != null) { + if (!allProperties.contains(solution.get(propertyName).toString())){ + allProperties.add(solution.get(propertyName).toString()); + } + } + } + } + return allProperties; + } + + /* + * (non-Javadoc) + * + * @see de.biba.triple.store.access.IAbstractQueryExecutor#setModeToLocal() + */ + @Override + public void setModeToLocal() { + executionMode = ExecutionMode.LOCAL; + } + + /* + * (non-Javadoc) + * + * @see + * de.biba.triple.store.access.IAbstractQueryExecutor#loadOntologyModel(java + * .lang.String) + */ + @Override + public boolean loadOntologyModel(String ontoFile) { + baseModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null); + try { + InputStream in = FileManager.get().open(ontoFile); + try { + baseModel.read(in, null); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + Logger.getAnonymousLogger().log(Level.INFO, "Ontology " + ontoFile + " loaded."); + } catch (JenaException je) { + System.err.println("ERROR" + je.getMessage()); + Logger.getAnonymousLogger().log(Level.SEVERE, je.getMessage()); + je.printStackTrace(); + return false; + + } + return true; + + } + + /* + * (non-Javadoc) + * + * @see de.biba.triple.store.access.IAbstractQueryExecutor#query(java.lang. + * String) + */ + @Override + public Object query(String sparqlStr) { + + switch (executionMode) { + + case LOCAL: + return queryLocal(sparqlStr); + + case REMOTE: + return queryRemote(sparqlStr); + + default: + return null; + + } + + } + + /* + * (non-Javadoc) + * + * @see + * de.biba.triple.store.access.IAbstractQueryExecutor#queryRemote(java.lang. + * String) + */ + @Override + public Object queryRemote(String sparqlStr) { + + if (isNotInit()) { + init(ExecutionMode.REMOTE); + } + + return queryRemoteHelper(sparqlStr); + } + + public Object queryRemoteHelper(String sparqlStr) { + Query query = QueryFactory.create(sparqlStr); + + try (QueryExecution qexec = QueryExecutionFactory.sparqlService(urlForQueries, query)) { + ResultSet results = qexec.execSelect(); + + results = ResultSetFactory.copyResults(results); + // System.out.println(results.getResultVars()); + return results; // Passes the result set out of the try-resources + } catch (Exception e) { + System.out.println("Exception: " + e.getMessage()); + Logger.getAnonymousLogger().log(Level.SEVERE, e.getLocalizedMessage()); + } + return null; + } + + /* + * (non-Javadoc) + * + * @see + * de.biba.triple.store.access.IAbstractQueryExecutor#queryLocal(java.lang. + * String) + */ + @Override + public ResultSet queryLocal(String sparqlStr) { + + if (isNotInit()) { + init(ExecutionMode.LOCAL); + } + + return queryLocalHelper(sparqlStr); + + } + + public ResultSet queryLocalHelper(String sparqlStr) { + Query query = QueryFactory.create(sparqlStr); + try (QueryExecution qexec = QueryExecutionFactory.create(query, baseModel)) { + ResultSet results = qexec.execSelect(); + return ResultSetFactory.copyResults(results); + } catch (Exception e) { + System.out.println("Exception: " + e.getMessage()); + Logger.getAnonymousLogger().log(Level.SEVERE, e.getLocalizedMessage()); + return null; + } + } + + public void init(ExecutionMode executionMode) { + supportedLangauges = new ArrayList(); + if (languageLabel != null && languageLabel.length() > 0) { + // NO I have to check if there a labels available + String sparqlQuery = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: SELECT ?subject ?object WHERE { ?subject <" + + languageLabel + "> ?object.} limit 100"; + Object result = null; + if (executionMode == ExecutionMode.LOCAL) { + result = queryLocalHelper(sparqlQuery); + } + if (executionMode == ExecutionMode.REMOTE) { + result = queryRemoteHelper(sparqlQuery); + } + + List allLabels = createResultList(result, "object"); + for (String str : allLabels) { + int index = str.indexOf("@"); + if (index > -1) { + String language = str.substring(index + 1, index + 3); + Language languageToBeAdded = Language.fromString(language); + if (!supportedLangauges.contains(languageToBeAdded)) { + supportedLangauges.add(languageToBeAdded); + } + } + } + + } + } + + private boolean isNotInit() { + + if (supportedLangauges == null || supportedLangauges.size() == 0) { + return true; + } + + return false; + } + + /* + * (non-Javadoc) + * + * @see de.biba.triple.store.access.IAbstractQueryExecutor# + * removeTypeDescriptionInValues(java.util.List) + */ + @Override + public void removeTypeDescriptionInValues(List allValuesForProperty) { + + for (int i = 0; i < allValuesForProperty.size(); i++) { + String value = allValuesForProperty.get(i); + int index = value.indexOf("^^"); + if (index > -1) { + value = value.substring(0, index); + allValuesForProperty.set(i, value); + } + + } + + } + + /* + * (non-Javadoc) + * + * @see de.biba.triple.store.access.IAbstractQueryExecutor# + * removeTypeDescriptionInValues(java.lang.String) + */ + @Override + public String removeTypeDescriptionInValues(String value) { + int index = value.indexOf("^^"); + if (index > -1) { + value = value.substring(0, index); + } + + return value; + + } + + /* + * (non-Javadoc) + * + * @see de.biba.triple.store.access.IAbstractQueryExecutor#getBaseModel() + */ + @Override + public Model getBaseModel() { + return baseModel; + } + + @Override + public List getSupportedLangauges() { + List languages = new ArrayList(); + + if (supportedLangauges == null || supportedLangauges.size() ==0){ + init(this.executionMode); + } + + for (Language language : supportedLangauges) { + languages.add(language.toString()); + } + return languages; + } + + @Override + public List getNativeSupportedLangauges() { + + if (supportedLangauges == null || supportedLangauges.size() ==0){ + init(this.executionMode); + } + + return supportedLangauges; + } + + public String getLanguageLabel() { + return languageLabel; + } + + @Override + public void setLanguageLabel(String languageLabel) { + this.languageLabel = languageLabel; + } + +} diff --git a/src/main/java/de/biba/triple/store/access/ConfigurationService.java b/src/main/java/de/biba/triple/store/access/ConfigurationService.java new file mode 100644 index 0000000..90dbe80 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/ConfigurationService.java @@ -0,0 +1,29 @@ +package de.biba.triple.store.access; + +public class ConfigurationService { + + private static ConfigurationService instance = null; + String dataSetURL = ""; + + public static ConfigurationService getInstance() { + if (instance == null) { + instance = new ConfigurationService(); + } + return instance; + } + + public void setDataSetUrl(String url) { + int indexOfLastCharcter = url.length() - 2; + if (url != null && url.length() > 3) { + if (url.charAt(indexOfLastCharcter) == '/') { + url = url.substring(0, indexOfLastCharcter); + } + dataSetURL = url; + } + } + + public String getDataSetUrl(){ + return dataSetURL; + } + +} diff --git a/src/main/java/de/biba/triple/store/access/IAbstractQueryExecutor.java b/src/main/java/de/biba/triple/store/access/IAbstractQueryExecutor.java new file mode 100644 index 0000000..a6b4e62 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/IAbstractQueryExecutor.java @@ -0,0 +1,42 @@ +package de.biba.triple.store.access; + +import java.util.List; + +import org.apache.jena.query.ResultSet; +import org.apache.jena.rdf.model.Model; + +import de.biba.triple.store.access.enums.Language; + +public interface IAbstractQueryExecutor { + + String getUrlForQueries(); + + void setModeToRemote(); + + String getDataSetURL(); + + List createResultList(Object result, String propertyName); + + void setModeToLocal(); + + boolean loadOntologyModel(String ontoFile); + + Object query(String sparqlStr); + + Object queryRemote(String sparqlStr); + + ResultSet queryLocal(String sparqlStr); + + void removeTypeDescriptionInValues(List allValuesForProperty); + + String removeTypeDescriptionInValues(String value); + + Model getBaseModel(); + + List getSupportedLangauges(); + + List getNativeSupportedLangauges(); + + void setLanguageLabel(String languageLabel); + +} \ No newline at end of file diff --git a/src/main/java/de/biba/triple/store/access/IPropertyValuesCrawler.java b/src/main/java/de/biba/triple/store/access/IPropertyValuesCrawler.java new file mode 100644 index 0000000..da7548f --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/IPropertyValuesCrawler.java @@ -0,0 +1,11 @@ +package de.biba.triple.store.access; + +import java.util.List; + +public interface IPropertyValuesCrawler extends IAbstractQueryExecutor{ + + List getAllDifferentValuesForAProperty(String propertyURL); + + List getAllDifferentValuesForAProperty(String concept, String propertyURL); + +} \ No newline at end of file diff --git a/src/main/java/de/biba/triple/store/access/IReader.java b/src/main/java/de/biba/triple/store/access/IReader.java new file mode 100644 index 0000000..6d81937 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/IReader.java @@ -0,0 +1,275 @@ +package de.biba.triple.store.access; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.rdf.model.Model; + +import de.biba.triple.store.access.dmo.Entity; +import de.biba.triple.store.access.dmo.Filter; +import de.biba.triple.store.access.dmo.IndividualInformation; +import de.biba.triple.store.access.dmo.ObjectPropertyToDatatypePropertyMapping; +import de.biba.triple.store.access.dmo.PropertyConceptAssignment; +import de.biba.triple.store.access.dmo.PropertyInformation; +import de.biba.triple.store.access.enums.Language; +import de.biba.triple.store.access.enums.PropertyType; + +public interface IReader extends IAbstractQueryExecutor{ + + List getAllDirectSubConcepts(String urlOfClass); + + List getAllTransitiveSubConcepts(String urlOfClass); + + List getAllConcepts(); + + /** + * Try to find a appropriate concept name which meet the given searchterm. + * + * @param searchTerm + * could be a regex or just a string + * @return list of concepts which meet the regex in its uuid + */ + List getAllConcepts(String searchTerm); + + List getAllTransitiveInstances(String urlOfClass); + + /** + * Get All instances by concept url and collects also the requested + * + * WARNING: Methods assumes that the proeprty exists!!! Otherwise it will + * crash parameter values + * + * @param urlOfClass + * @param properties + * @return + */ + Map> getAllTransitiveInstances(String urlOfClass, List properties); + + List getAllTransitiveInstancesAndClasses(String urlOfClass); + + List getAllDirectInstances(String urlOfClass); + + List getDomainOfProperty(String urlOfProperty); + + List getRangeOfProperty(String urlOfProperty); + + List getAllProperties(); + + List getAllProperties(String searchTerm); + + List getAllDirectProperties(String urlOfClass); + + List getAllTransitiveProperties(String urlOfClass); + + Model describeAllProperties(String urlOfClass, Model model); + + /** + * Returns all a properties of the instance as a hashMap + * + * @param urlOfIndividuum + * the url of the instance. Example is: + * http://biba.uni-bremen.de/InnovationGateway#3d_printer + * @return a HashMap in which the key is the property url and the value is + * the object + */ + Map getPropertyValuesOfAIndividium(String urlOfIndividuum); + + + + /* + * * Returns all a properties of the instance as a hashMap + * + * @param urlOfIndividuum the url of the instance. Example is: + * http://biba.uni-bremen.de/InnovationGateway#3d_printer + * + * @return a HashMap in which the key is the property url and the value is + * the object + */ + Map> getPropertyValuesOfAIndividiumForMultipleValues(String urlOfIndividuum); + + /** + * Is is faster than the other merhod but deliver not all informaiton. + * + * @param urlOfConcept + * @param objectproperties + * @return + */ + Map> getPropertyValuesOfAllIndividiumsFastButWithoutObjectPropertyTranslation( + String urlOfConcept, List objectproperties); + + Map> getPropertyValuesOfAllIndividiums(String urlOfConcept, + List objectproperties); + + Map> getPropertyValuesAndDatatypePropertyTypeOfAllIndividiums( + String urlOfConcept, List objectproperties, List filter); + + Map> getPropertyValuesAndDatatypePropertyTypeOfAllIndividiums( + String urlOfConcept, List objectproperties); + + Map> getPropertyValuesAndDatatypePropertyTypeOfAllIndividiumsAndApplyFilter( + String urlOfConcept, List objectproperties, List filter); + + /** + * PREFIX rdf: PREFIX owl: + * PREFIX rdfs: + * PREFIX xsd: + * SELECT ?predicate ?c ?object WHERE { + * { + * + * ?c. ?c + * ?object.} UNION { + * + * ?c. ?c + * ?object.}} + * + * @param result + * @param propertyName + * @return + */ + Map getPropertyValuesOfAIndividium(String urlOfIndividuum, + List objectproperties); + + Map getPropertyValuesOfAIndividiumIncludingType(String urlOfIndividuum, + List objectproperties, List filters); + + List createResultListArray(Object result, String[] propertyNames); + + Model getTheOverallOntology(); + + void clearCache(); + + /** + * This methods used a cached ontology model for describe. The cached + * ontology model is requested once from the triple store. If you want to + * reload the cached ontology you must call clear + * + * @param describeStr + * The complete URL of a concept + * (http://biba.uni-bremen.de/InnovationGateway#Person) + * @return the model + */ + Model describe(String describeStr); + + /** + * Returns the information whether the property is a datatype or + * objectproperty. This information could be used to determine whether the + * value of the property is jaust a value or a individual reference + * + * @param urlOfProperty + * the url of the property, like + * http://biba.uni-bremen.de/InnovationGateway#Description + * @return a enum containing datatypeproperty, objectproperty and unknown + */ + PropertyType getPropertyType(String urlOfProperty); + + String getPropertyTypeRange(String urlOfProperty); + + /** + * this method collects recursively all parent concepts to a given concept + * + * @param urlConcept + * The url of the cocnept + * @return List containing the urls for parent cocnepts + */ + List getTransitiveParentConceptsToAGivenConcept(String urlConcept); + + /** + * This method collects recursively all properties from all parent classes + * until it reach Thing and returns it ( + * + * @param urlConcept + * The url of the concept + * @return A list containing all properties containing the information which + * property belongs to which concept without type of property + */ + List getTransitivePropertiesInDirectionOfParent(String urlConcept); + + /** + * This method collects recursively all properties from all parent classes + * until it reach Thing and returns it ( + * + * @param urlConcept + * The url of the concept + * @return A list containing all properties containing the information which + * property belongs to which concept + type of property + */ + List getTransitivePropertiesIncludingTypeInDirectionOfParent(String urlConcept); + + /** + * Checks to a given uuid of the propertty whether it is functional + * + * @param uuidOfProperty + * @return + */ + boolean isPropertyFunctional(String uuidOfProperty); + + /** + * returns all functional properties including both datatype and object + * properties + * + * @return + */ + List getAllFunctionalProperties(); + + /** + * This methos can ask the label for concept, property and individuals. A + * element could have more than one label. + * + * @param uuid + * uuid of the ontological element + * @return list of labels + */ + List getLabelFromAElement(String uuid); + + // + /** + * select ?a ?b ?c where { + * + * ?c} + */ + + List getHandleFromAElement(String uuid); + + /** + * Returns the individuals which have a reference to a given individua + */ + List getAllIndividualsWhichHasAreferenceToASpeciifcOne(String uuid); + + /** + * select distinct ?instance ?class ?predicate ?c ?object ?error where + * {?instance a ?class. ?class rdfs:subClassOf* + * . ?instance + * ?error. + * FILTER(?error = " 2005"). ?instance ?predicate ?object.} + * + */ + Map> getPropertyValuesOfAllIndividiumsFastButWithoutObjectPropertyTranslation( + String urlOfConcept, List objectproperties, List filters); + + /** + * select distinct ?instance ?class ?predicate ?c ?object ?error where + * {?instance a ?class. ?class rdfs:subClassOf* + * . ?instance + * ?error. + * FILTER(?error = " 2005"). ?instance ?predicate ?object.} + * + */ + Map> getSpecificPropertyValuesOfAllIndividiumsFastButWithoutObjectPropertyTranslation( + String urlOfConcept, List properties, List filters); + + List getAllTransitivePropertiesDirectionParents(String urlOfClass); + + List getAllPropertiesIncludingEverything(String urlOfClass); + + + List getAllConceptsLanguageSpecific(String searchTerm, Language language); + + List getAllConceptsFocusOnlyOnURI(String searchTerm); + + public List getNativeSupportedLangauges(); + + List getAllObjectPropertiesIncludingEverythingAndReturnItsRange(String urlOfClass); + + List getAllPropertiesIncludingEverythingWhichHasValues(String urlOfClass); + +} \ No newline at end of file diff --git a/src/main/java/de/biba/triple/store/access/dmo/DeleteOperationResult.java b/src/main/java/de/biba/triple/store/access/dmo/DeleteOperationResult.java new file mode 100644 index 0000000..4e358fc --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/dmo/DeleteOperationResult.java @@ -0,0 +1,29 @@ +package de.biba.triple.store.access.dmo; + +import java.util.ArrayList; +import java.util.List; + +public class DeleteOperationResult { + + boolean success = false; + List references = new ArrayList(); + public boolean isSuccess() { + return success; + } + public void setSuccess(boolean success) { + this.success = success; + } + public List getReferences() { + return references; + } + public void setReferences(List references) { + this.references = references; + } + @Override + public String toString() { + return "DeleteOperationResult [success=" + success + ", references=" + references + "]"; + } + + + +} diff --git a/src/main/java/de/biba/triple/store/access/dmo/Entity.java b/src/main/java/de/biba/triple/store/access/dmo/Entity.java new file mode 100644 index 0000000..a517acb --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/dmo/Entity.java @@ -0,0 +1,65 @@ +package de.biba.triple.store.access.dmo; + +import de.biba.triple.store.access.enums.ConceptSource; +import de.biba.triple.store.access.enums.Language; + +public class Entity { + + private String url; + private String translatedURL; + private boolean translationLabelWasAvailable; + private Language language; + private ConceptSource conceptSource = ConceptSource.ONTOLOGICAL; + // Flag to indict if the entity should be hidden in the local ontological view + private boolean isHidden = false; + + public ConceptSource getConceptSource() { + return conceptSource; + } + public void setConceptSource(ConceptSource conceptSource) { + this.conceptSource = conceptSource; + } + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + public String getTranslatedURL() { + return translatedURL; + } + public void setTranslatedURL(String translatedURL) { + this.translatedURL = translatedURL; + } + public Language getLanguage() { + return language; + } + public void setLanguage(Language language) { + this.language = language; + } + public boolean isHidden() { + return isHidden; + } + public void setHidden(boolean isHidden) { + this.isHidden = isHidden; + } + + + public boolean isTranslationLabelWasAvailable() { + return translationLabelWasAvailable; + } + public void setTranslationLabelWasAvailable(boolean translationLabelWasAvailable) { + this.translationLabelWasAvailable = translationLabelWasAvailable; + } + + @Override + public String toString() { + return "Entity [url=" + url + ", translatedURL=" + translatedURL + ", translationLabelWasAvailable=" + + translationLabelWasAvailable + ", language=" + language + ", conceptSource=" + conceptSource + + ", isHidden=" + isHidden + "]"; + } + + + + +} diff --git a/src/main/java/de/biba/triple/store/access/dmo/Filter.java b/src/main/java/de/biba/triple/store/access/dmo/Filter.java new file mode 100644 index 0000000..83afb55 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/dmo/Filter.java @@ -0,0 +1,72 @@ +package de.biba.triple.store.access.dmo; + +import java.util.ArrayList; +import java.util.List; + +import de.biba.triple.store.access.enums.Operator; + +/** + * This class implements a filter which has the following details: urlOfProperty + * is the subject of the filter A filter can define a set of values for a + * specific property An operator is required. If no operator is given , = is set + * as default + * + * @author marco_000 + * + */ +public class Filter { + + String urlOfProperty; + List value = new ArrayList(); + Operator operator = Operator.EQUAL; // default is equal + boolean objectproperty = false; + + public boolean isObjectproperty() { + return objectproperty; + } + + public void assignAsObjectproperty(boolean objectproperty) { + this.objectproperty = objectproperty; + } + + public String getUrlOfProperty() { + return urlOfProperty; + } + + public void setUrlOfProperty(String urlOfProperty) { + this.urlOfProperty = urlOfProperty; + } + + public List getValues() { + return value; + } + + // @Deprecated + // public String getValue() { + // return value.get(0); + // } + + public void addValue(String value) { + this.value.add(value); + } + + @Deprecated + public void setValue(String value) { + this.value.add(value); + } + + @Override + public String toString() { + return "Filter [urlOfProperty=" + urlOfProperty + ", value=" + value + ", objectproperty=" + objectproperty + + "]"; + } + + public Operator getOperator() { + return operator; + } + + public void setOperator(Operator operator) { + this.operator = operator; + } + +} diff --git a/src/main/java/de/biba/triple/store/access/dmo/IndividualInformation.java b/src/main/java/de/biba/triple/store/access/dmo/IndividualInformation.java new file mode 100644 index 0000000..70027b3 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/dmo/IndividualInformation.java @@ -0,0 +1,26 @@ +package de.biba.triple.store.access.dmo; + +public class IndividualInformation { + + String urlOfIndividual; + String urlOfClass; + public String getUrlOfIndividual() { + return urlOfIndividual; + } + public void setUrlOfIndividual(String urlOfIndividual) { + this.urlOfIndividual = urlOfIndividual; + } + public String getUrlOfClass() { + return urlOfClass; + } + public void setUrlOfClass(String urlOfClass) { + this.urlOfClass = urlOfClass; + } + @Override + public String toString() { + return "IndividualInformation [urlOfIndividual=" + urlOfIndividual + ", urlOfClass=" + urlOfClass + "]"; + } + + + +} diff --git a/src/main/java/de/biba/triple/store/access/dmo/ObjectPropertyToDatatypePropertyMapping.java b/src/main/java/de/biba/triple/store/access/dmo/ObjectPropertyToDatatypePropertyMapping.java new file mode 100644 index 0000000..62e95b1 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/dmo/ObjectPropertyToDatatypePropertyMapping.java @@ -0,0 +1,39 @@ +package de.biba.triple.store.access.dmo; + +import java.util.ArrayList; +import java.util.List; + +public class ObjectPropertyToDatatypePropertyMapping { + + String urlObjectProperty = ""; + List datatypeProperties = new ArrayList(); + String seperator = ";"; + + public String getUrlObjectProperty() { + return urlObjectProperty; + } + + public void addDatatypeProperty(String urlOfProperty) { + + if (!datatypeProperties.contains(urlOfProperty)) { + datatypeProperties.add(urlOfProperty); + } + } + + public void setUrlObjectProperty(String urlObjectProperty) { + this.urlObjectProperty = urlObjectProperty; + } + + public String getSeperator() { + return seperator; + } + + public void setSeperator(String seperator) { + this.seperator = seperator; + } + + public List getDatatypeProperties() { + return datatypeProperties; + } + +} diff --git a/src/main/java/de/biba/triple/store/access/dmo/PropertyConceptAssignment.java b/src/main/java/de/biba/triple/store/access/dmo/PropertyConceptAssignment.java new file mode 100644 index 0000000..5977ece --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/dmo/PropertyConceptAssignment.java @@ -0,0 +1,38 @@ +package de.biba.triple.store.access.dmo; + +public class PropertyConceptAssignment { + + private String urlOfProperty; + private String urlOfConcept; + private String type; + + + public String getUrlOfProperty() { + return urlOfProperty; + } + public void setUrlOfProperty(String urlOfProperty) { + this.urlOfProperty = urlOfProperty; + } + public String getUrlOfConcept() { + return urlOfConcept; + } + public void setUrlOfConcept(String urlOfConcept) { + this.urlOfConcept = urlOfConcept; + } + + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + @Override + public String toString() { + return "PropertyConceptAssignment [urlOfProperty=" + urlOfProperty + ", urlOfConcept=" + urlOfConcept + + ", type=" + type + "]"; + } + + + + +} diff --git a/src/main/java/de/biba/triple/store/access/dmo/PropertyInformation.java b/src/main/java/de/biba/triple/store/access/dmo/PropertyInformation.java new file mode 100644 index 0000000..2abb802 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/dmo/PropertyInformation.java @@ -0,0 +1,45 @@ +package de.biba.triple.store.access.dmo; + +import java.util.ArrayList; +import java.util.List; + +public class PropertyInformation { + String name; + boolean isItAObjectProperty; + + + public boolean isItAObjectProperty() { + return isItAObjectProperty; + } + public void setItAObjectProperty(boolean isItAObjectProperty) { + this.isItAObjectProperty = isItAObjectProperty; + } + public String getName() { + return name; + } + public void setName(String urlOfProperty) { + this.name = urlOfProperty; + } + String type; + List values = new ArrayList(); + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public List getValues() { + return values; + } + public void setValues(List values) { + this.values = values; + } + @Override + public String toString() { + return "PropertyInformation [name=" + name + ", isItAObjectProperty=" + isItAObjectProperty + ", type=" + type + + ", values=" + values + "]"; + } + + + +} diff --git a/src/main/java/de/biba/triple/store/access/dmo/Value.java b/src/main/java/de/biba/triple/store/access/dmo/Value.java new file mode 100644 index 0000000..c2d1d83 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/dmo/Value.java @@ -0,0 +1,32 @@ +package de.biba.triple.store.access.dmo; + +public class Value { + String value ; + String uUID; + + public Value(){ + + } + + public Value(String value){ + this.value = value; + } + +public String getValue() { + return value; +} +public void setValue(String value) { + this.value = value; +} +public String getuUID() { + return uUID; +} +public void setuUID(String uUID) { + this.uUID = uUID; +} +@Override +public String toString() { + return value; +} + +} diff --git a/src/main/java/de/biba/triple/store/access/enums/ConceptSource.java b/src/main/java/de/biba/triple/store/access/enums/ConceptSource.java new file mode 100644 index 0000000..0fdbad7 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/enums/ConceptSource.java @@ -0,0 +1,7 @@ +package de.biba.triple.store.access.enums; + +public enum ConceptSource { + + ONTOLOGICAL, CUSTOM + +} diff --git a/src/main/java/de/biba/triple/store/access/enums/DataTypePropertyType.java b/src/main/java/de/biba/triple/store/access/enums/DataTypePropertyType.java new file mode 100644 index 0000000..0a69fe1 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/enums/DataTypePropertyType.java @@ -0,0 +1,7 @@ +package de.biba.triple.store.access.enums; + +public enum DataTypePropertyType { + + BOOLEAN, STRING, FLOAT,INT, UNKNOWN, DATE, TXTAREA + +} diff --git a/src/main/java/de/biba/triple/store/access/enums/ExecutionMode.java b/src/main/java/de/biba/triple/store/access/enums/ExecutionMode.java new file mode 100644 index 0000000..3499367 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/enums/ExecutionMode.java @@ -0,0 +1,5 @@ +package de.biba.triple.store.access.enums; + +public enum ExecutionMode { +LOCAL, REMOTE +} diff --git a/src/main/java/de/biba/triple/store/access/enums/Language.java b/src/main/java/de/biba/triple/store/access/enums/Language.java new file mode 100644 index 0000000..c2c3f18 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/enums/Language.java @@ -0,0 +1,71 @@ +package de.biba.triple.store.access.enums; + +public enum Language { + + GERMAN, ENGLISH, SPANISH, SWEDISH, SAMI, UNKNOWN; + + public static Language fromString(String lanuage) { + if (lanuage.equals("de")) { + return Language.GERMAN; + } + if (lanuage.equals("en")) { + return Language.ENGLISH; + } + if (lanuage.equals("es")) { + return Language.SPANISH; + } + + if (lanuage.equals("sv")) { + return Language.SWEDISH; + } + + if (lanuage.equals("se")) { + return Language.SAMI; + } + + return ENGLISH; + + } + + public static String replaceLanguageStringToOldNamingAsAttribute(String inputAsJson) { + inputAsJson = inputAsJson.replace("ENGLISH", "en"); + inputAsJson = inputAsJson.replace("SPANISH", "es"); + inputAsJson = inputAsJson.replace("GERMAN", "de"); + inputAsJson = inputAsJson.replace("SWEDISH", "sv"); + return inputAsJson; + } + + public static String replaceLanguageStringToOldNamingInJSON(String inputAsJson) { + inputAsJson = inputAsJson.replace("\"ENGLISH\"", "\"en\""); + inputAsJson = inputAsJson.replace("\"SPANISH\"", "\"es\""); + inputAsJson = inputAsJson.replace("\"GERMAN\"", "\"de\""); + inputAsJson = inputAsJson.replace("\"SWEDISH\"", "\"sv\""); + return inputAsJson; + } + + /** + * if no translation label is available in a specific language, the english + * translation label should be used + * + * @return the language id of english + */ + public static String getDefaultLanguageID() { + return "en"; + } + + public static String toOntologyPostfix(Language language) { + switch (language) { + case GERMAN: + return "@de"; + case ENGLISH: + return "@en"; + case SPANISH: + return "@es"; + case SWEDISH: + return "@sv"; + case SAMI: + return "@se"; + } + return "@en"; + } +} diff --git a/src/main/java/de/biba/triple/store/access/enums/Operator.java b/src/main/java/de/biba/triple/store/access/enums/Operator.java new file mode 100644 index 0000000..13e558a --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/enums/Operator.java @@ -0,0 +1,24 @@ +package de.biba.triple.store.access.enums; + +public enum Operator { + + EQUAL, GREATER_THAN, EQUAL_TO_OR_GREATER, SMALLER_THAN, EQUAL_TO_OR_SMALLER; + + public String toString() { + switch (this) { + case EQUAL: + return "="; + + case GREATER_THAN: + return ">"; + case EQUAL_TO_OR_GREATER: + return ">="; + case SMALLER_THAN: + return "<"; + case EQUAL_TO_OR_SMALLER: + return "<="; + } + + return "??"; + } +} diff --git a/src/main/java/de/biba/triple/store/access/enums/PropertyType.java b/src/main/java/de/biba/triple/store/access/enums/PropertyType.java new file mode 100644 index 0000000..5e55f1b --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/enums/PropertyType.java @@ -0,0 +1,7 @@ +package de.biba.triple.store.access.enums; + +public enum PropertyType { + + DATATYPEPROPERTY, OBJECTPROPERTY, UNKNOWN + +} diff --git a/src/main/java/de/biba/triple/store/access/jena/PropertyValuesCrawler.java b/src/main/java/de/biba/triple/store/access/jena/PropertyValuesCrawler.java new file mode 100644 index 0000000..60ab05b --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/jena/PropertyValuesCrawler.java @@ -0,0 +1,67 @@ +package de.biba.triple.store.access.jena; + + +import java.util.ArrayList; +import java.util.List; + +import org.apache.jena.query.ResultSet; +import org.apache.jena.rdf.model.Model; + +import de.biba.triple.store.access.AbstractQueryExecutor; +import de.biba.triple.store.access.ConfigurationService; +import de.biba.triple.store.access.IPropertyValuesCrawler; + +public class PropertyValuesCrawler extends AbstractQueryExecutor implements IPropertyValuesCrawler { + + String urlForModelRetrival = dataSetURL + "/data"; + Model retrivedModel = null; + + public PropertyValuesCrawler() { + super(ConfigurationService.getInstance().getDataSetUrl(),null); + } + + public PropertyValuesCrawler(String dataSetURL) { + super(dataSetURL, null); + this.dataSetURL = dataSetURL; + urlForQueries = dataSetURL + "/query"; + urlForModelRetrival = dataSetURL + "/data"; + + } + + /* (non-Javadoc) + * @see de.biba.triple.store.access.jena.IPropertyValuesCrawler#getAllDifferentValuesForAProperty(java.lang.String) + */ + @Override + public List getAllDifferentValuesForAProperty(String propertyURL) { + + List result = new ArrayList(); + String sparQL = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?value where { ?instance <" +propertyURL+"> ?value.}"; + + Object resultSet = query(sparQL); + + result = createResultList(resultSet, "value"); + + return result; + + } + + +/* (non-Javadoc) + * @see de.biba.triple.store.access.jena.IPropertyValuesCrawler#getAllDifferentValuesForAProperty(java.lang.String, java.lang.String) + */ +@Override +public List getAllDifferentValuesForAProperty(String concept, String propertyURL) { + + List result = new ArrayList(); + String sparQL = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?value where { ?instance a ?class. ?class rdfs:subClassOf* <"+concept+"> .?instance <" +propertyURL+"> ?value.}"; + + Object resultSet = query(sparQL); + + result = createResultList(resultSet, "value"); + + return result; + + } + + +} diff --git a/src/main/java/de/biba/triple/store/access/jena/Reader.java b/src/main/java/de/biba/triple/store/access/jena/Reader.java new file mode 100644 index 0000000..249a9f5 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/jena/Reader.java @@ -0,0 +1,330 @@ +package de.biba.triple.store.access.jena; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.apache.jena.graph.Node_Variable.VariableName; +import org.apache.jena.query.DatasetAccessor; +import org.apache.jena.query.DatasetAccessorFactory; +import org.apache.jena.query.QueryExecution; +import org.apache.jena.query.QueryExecutionFactory; +import org.apache.jena.query.QuerySolution; +import org.apache.jena.query.ResultSet; +import org.apache.jena.rdf.model.Model; + +import de.biba.triple.store.access.AbstractQueryExecutor; +import de.biba.triple.store.access.ConfigurationService; +import de.biba.triple.store.access.IReader; +import de.biba.triple.store.access.dmo.Entity; +import de.biba.triple.store.access.dmo.Filter; +import de.biba.triple.store.access.dmo.IndividualInformation; +import de.biba.triple.store.access.dmo.ObjectPropertyToDatatypePropertyMapping; +import de.biba.triple.store.access.dmo.PropertyConceptAssignment; +import de.biba.triple.store.access.dmo.PropertyInformation; +import de.biba.triple.store.access.dmo.Value; +import de.biba.triple.store.access.enums.Language; +import de.biba.triple.store.access.enums.Operator; +import de.biba.triple.store.access.enums.PropertyType; + +public class Reader extends AbstractQueryExecutor implements IReader { + + String urlForModelRetrival = dataSetURL + "/data"; + Model retrivedModel = null; + + public Reader() { + super(ConfigurationService.getInstance().getDataSetUrl(), null); + } + + @Override + public List getAllDirectSubConcepts(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllTransitiveSubConcepts(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllConcepts() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllConcepts(String searchTerm) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllTransitiveInstances(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map> getAllTransitiveInstances(String urlOfClass, + List properties) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllTransitiveInstancesAndClasses(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllDirectInstances(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getDomainOfProperty(String urlOfProperty) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getRangeOfProperty(String urlOfProperty) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllProperties() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllProperties(String searchTerm) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllDirectProperties(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllTransitiveProperties(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Model describeAllProperties(String urlOfClass, Model model) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map getPropertyValuesOfAIndividium(String urlOfIndividuum) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map> getPropertyValuesOfAIndividiumForMultipleValues(String urlOfIndividuum) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map> getPropertyValuesOfAllIndividiumsFastButWithoutObjectPropertyTranslation( + String urlOfConcept, List objectproperties) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map> getPropertyValuesOfAllIndividiums( + String urlOfConcept, List objectproperties) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map> getPropertyValuesAndDatatypePropertyTypeOfAllIndividiums( + String urlOfConcept, List objectproperties, List filter) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map> getPropertyValuesAndDatatypePropertyTypeOfAllIndividiums( + String urlOfConcept, List objectproperties) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map> getPropertyValuesAndDatatypePropertyTypeOfAllIndividiumsAndApplyFilter( + String urlOfConcept, List objectproperties, List filter) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map getPropertyValuesOfAIndividium(String urlOfIndividuum, + List objectproperties) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map getPropertyValuesOfAIndividiumIncludingType(String urlOfIndividuum, + List objectproperties, List filters) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List createResultListArray(Object result, String[] propertyNames) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Model getTheOverallOntology() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void clearCache() { + // TODO Auto-generated method stub + + } + + @Override + public Model describe(String describeStr) { + // TODO Auto-generated method stub + return null; + } + + @Override + public PropertyType getPropertyType(String urlOfProperty) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getPropertyTypeRange(String urlOfProperty) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getTransitiveParentConceptsToAGivenConcept(String urlConcept) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getTransitivePropertiesInDirectionOfParent(String urlConcept) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getTransitivePropertiesIncludingTypeInDirectionOfParent(String urlConcept) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isPropertyFunctional(String uuidOfProperty) { + // TODO Auto-generated method stub + return false; + } + + @Override + public List getAllFunctionalProperties() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getLabelFromAElement(String uuid) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getHandleFromAElement(String uuid) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllIndividualsWhichHasAreferenceToASpeciifcOne(String uuid) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map> getPropertyValuesOfAllIndividiumsFastButWithoutObjectPropertyTranslation( + String urlOfConcept, List objectproperties, List filters) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map> getSpecificPropertyValuesOfAllIndividiumsFastButWithoutObjectPropertyTranslation( + String urlOfConcept, List properties, List filters) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllTransitivePropertiesDirectionParents(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllPropertiesIncludingEverything(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllConceptsLanguageSpecific(String searchTerm, Language language) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllConceptsFocusOnlyOnURI(String searchTerm) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllObjectPropertiesIncludingEverythingAndReturnItsRange(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllPropertiesIncludingEverythingWhichHasValues(String urlOfClass) { + // TODO Auto-generated method stub + return null; + } + + +} \ No newline at end of file diff --git a/src/main/java/de/biba/triple/store/access/jena/Search.java b/src/main/java/de/biba/triple/store/access/jena/Search.java new file mode 100644 index 0000000..ef851ed --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/jena/Search.java @@ -0,0 +1,302 @@ +package de.biba.triple.store.access.jena; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.query.Query; +import org.apache.jena.query.QueryExecution; +import org.apache.jena.query.QueryExecutionFactory; +import org.apache.jena.query.QueryFactory; +import org.apache.jena.query.QuerySolution; +import org.apache.jena.query.ResultSet; +import org.apache.jena.query.ResultSetFactory; + +import de.biba.triple.store.access.ConfigurationService; +import de.biba.triple.store.access.IReader; +import de.biba.triple.store.access.dmo.Filter; +import de.biba.triple.store.access.dmo.IndividualInformation; +import de.biba.triple.store.access.dmo.ObjectPropertyToDatatypePropertyMapping; +import de.biba.triple.store.access.dmo.PropertyInformation; + +public class Search extends Reader { + + String dataSetURL = ""; + String urlForQueries = dataSetURL + "/query"; + + public Search(){ + dataSetURL = ConfigurationService.getInstance().getDataSetUrl(); + urlForQueries = dataSetURL + "/query"; + } + + /** + * Search all individual which satisfy the searchTerms for at least one + * serachProeprty and given concept( join for subclasses) + * + * @param searchTerm + * list of keywords (AND) + * @param searchProperties + * list of properties (UNION) + * @param searchConcept + * @param objectproperties + * mapping between uid and corresponding data property to be + * replaced + * @return a map + */ + public Map> searchAndReturnWholeIndividuals( + List searchTerm, List searchProperties, String searchConcept, + List objectproperties) { + List indis = search(searchTerm, searchProperties, searchConcept); + Map> result = new HashMap>(); + for (String[] indi : indis) { + IndividualInformation individualInformation = new IndividualInformation(); + individualInformation.setUrlOfClass(indi[1]); + individualInformation.setUrlOfIndividual(indi[0]); + result.put(individualInformation, + getPropertyValuesOfAIndividiumIncludingType(indi[0], objectproperties, null)); + } + return result; + } + + /** + * Search all individual which satisfy the searchTerms for at least one + * serachProeprty and given concept( join for subclasses) + * + * @param searchTerm + * list of keywords (AND) + * @param searchProperties + * list of properties (UNION) + * @param searchConcept + * @param objectproperties + * mapping between uid and corresponding data property to be + * replaced + * @return a map + */ + public Map> searchAndReturnWholeIndividuals( + List searchTerm, List searchProperties, String searchConcept, + List objectproperties, List filters) { + List indis = search(searchTerm, searchProperties, searchConcept); + Map> result = new HashMap>(); + for (String[] indi : indis) { + IndividualInformation individualInformation = new IndividualInformation(); + individualInformation.setUrlOfClass(indi[1]); + individualInformation.setUrlOfIndividual(indi[0]); + result.put(individualInformation, + getPropertyValuesOfAIndividiumIncludingType(indi[0], objectproperties, filters)); + } + return result; + } + + public Map> searchTransitiveAllValuesForPropertiesForAGivenConcept(List searchTerm, + List searchProperties, String urlOfConcept) { + + Map> allPropertyValues = new HashMap>(); + List allIndis = search(searchTerm, searchProperties, urlOfConcept); + urlOfConcept = "<" + urlOfConcept + ">"; + for (String[] indi : allIndis) { + String individuum = "<" + indi[0] + ">"; + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?property ?value where { ?property ?x. ?x rdfs:subClassOf* " + + urlOfConcept + ". " + individuum + " ?property ?value.}"; + System.out.println(sparql); + createResultForSearchingPropertyValues(allPropertyValues, sparql); + } + return allPropertyValues; + } + + public Map> searchTransitiveParantsAllValuesForPropertiesForAGivenConcept( + List searchTerm, List searchProperties, String urlOfConcept) { + + Map> allPropertyValues = new HashMap>(); + List allIndis = search(searchTerm, searchProperties, urlOfConcept); + urlOfConcept = "<" + urlOfConcept + ">"; + for (String[] indi : allIndis) { + String individuum = "<" + indi[0] + ">"; + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?property ?value where { ?property ?x. " + + urlOfConcept + " rdfs:subClassOf* ?x." + individuum + " ?property ?value.}"; + System.out.println(sparql); + createResultForSearchingPropertyValues(allPropertyValues, sparql); + } + return allPropertyValues; + } + + public Map> searchDirectAllValuesForPropertiesForAGivenConcept(List searchTerm, + List searchProperties, String urlOfConcept) { + + Map> allPropertyValues = new HashMap>(); + List allIndis = search(searchTerm, searchProperties, urlOfConcept); + urlOfConcept = "<" + urlOfConcept + ">"; + for (String[] indi : allIndis) { + String individuum = "<" + indi[0] + ">"; + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?property ?value where { ?property " + + urlOfConcept + ". " + individuum + " ?property ?value.}"; + System.out.println(sparql); + createResultForSearchingPropertyValues(allPropertyValues, sparql); + } + return allPropertyValues; + } + + /** + * This methods search all properties to a given concept (transitive) and + * its values. This methods has no restrictions + * + * @param urlOfConcept + * @return Map (Key is propertyUUID, Value List of Values) + */ + public Map> searchTransitiveAllValuesForPropertiesForAGivenConcept(String urlOfConcept) { + urlOfConcept = "<" + urlOfConcept + ">"; + Map> allPropertyValues = new HashMap>(); + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?property ?value where { ?property ?x. ?x rdfs:subClassOf* " + + urlOfConcept + ". ?instance ?property ?value.}"; + return createResultForSearchingPropertyValues(allPropertyValues, sparql); + } + + /** + * This methods search all properties to a given concept (transitive) and + * its values. This methods has no restrictions + * + * @param urlOfConcept + * @return Map (Key is propertyUUID, Value List of Values) + */ + public Map> searchTransitiveParentsAllValuesForPropertiesForAGivenConcept( + String urlOfConcept) { + IReader read = new Reader(); + List allIndis = read.getAllTransitiveInstances(urlOfConcept); + urlOfConcept = "<" + urlOfConcept + ">"; + Map> allPropertyValues = new HashMap>(); + + for (String indi : allIndis) { + String individuum = "<" + indi + ">"; + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?property ?value where { ?property ?x. " + + urlOfConcept + " rdfs:subClassOf* ?x." + individuum + " ?property ?value.}"; + System.out.println(sparql); + createResultForSearchingPropertyValues(allPropertyValues, sparql); + } + return allPropertyValues; + + } + + /** + * This methods search all properties to a given concept (direct) and its + * values. This methods has no restrictions + * + * @param urlOfConcept + * @return Map (Key is propertyUUID, Value List of Values) + */ + public Map> searchDirectAllValuesForPropertiesForAGivenConcept(String urlOfConcept) { + urlOfConcept = "<" + urlOfConcept + ">"; + Map> allPropertyValues = new HashMap>(); + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?property ?value where { ?property " + + urlOfConcept + ". ?instance ?property ?value.}"; + return createResultForSearchingPropertyValues(allPropertyValues, sparql); + } + + private Map> createResultForSearchingPropertyValues( + Map> allPropertyValues, String sparql) { + Object result = query(sparql); + List allValues = createResultListArray(result, new String[] { "property", "value" }); + for (String[] row : allValues) { + String propertyName = row[0]; + if (allPropertyValues.containsKey(propertyName)) { + allPropertyValues.get(propertyName).add(row[1]); + } else { + List allValuesForProperty = new ArrayList(); + allValuesForProperty.add(row[1]); + removeTypeDescriptionInValues(allValuesForProperty); + allPropertyValues.put(propertyName, allValuesForProperty); + } + } + + return allPropertyValues; + } + + + protected List search(List searchTerm, List searchProperties, String searchConcept) { + // + // PREFIX owl: PREFIX rdfs: + // PREFIX xsd: + // SELECT distinct ?instance WHERE { + // {?instance a ?x. ?x rdfs:subClassOf* + // . + // ?instance ?a ?object + // .?instance?value0. + // FILTER regex(?value0,"www.h2020.eu"). } UNION {?instance a ?x. ?x + // rdfs:subClassOf* + // . + // ?instance ?a ?object. + // ?instance?value1. + // FILTER regex(?value1,"20").} } + + searchConcept = "<" + searchConcept + ">"; + String sparql = "PREFIX owl: PREFIX rdfs: PREFIX xsd: SELECT distinct ?instance ?x WHERE { "; + + int counter = 0; + if (searchProperties != null) { + for (String property : searchProperties) { + property = "<" + property + ">"; + sparql += "{?instance a ?x. ?x rdfs:subClassOf* " + searchConcept + ". ?instance ?a ?object ."; + + // Now the filter + String filter = ""; + + String variable = "?value" + counter; + + filter += "?instance" + property + "" + variable + ". "; + if (searchTerm != null) { + sparql = addAnfFilterForProperties(searchTerm, sparql, filter, variable); + } + if (counter < searchProperties.size() - 1) { + sparql += " UNION"; + } + counter++; + } + } + + sparql += "}"; + System.out.println(sparql); + Object result = query(sparql); + return + + createResultListArray(result, new String[] { "instance", "x" }); + } + + + private String addAnfFilterForProperties(List searchTerm, String sparql, String filter, String variable) { + for (String str : searchTerm) { + filter += " FILTER regex( lcase("; + filter += variable + ")," + "lcase( \"" + str + "\"))."; + + } + sparql += filter + "}"; + return sparql; + } + + private String createFilterForValues(List filterValues, String urlPropeety) { + String result = ""; + for (int i = 0; i < filterValues.size(); i++) { + String value = filterValues.get(i); + + result += "regex( lcase(" + "<" + urlPropeety + ">" + ")," + "lcase( \"" + value + "\"))"; + + if (i < filterValues.size() - 1) { + result += " || "; + } + } + + return result; + } + + private String extendFilters(String sparql, List filters) { + for (Filter filter : filters) { + + sparql += " FILTER (" + createFilterForValues(filter.getValues(), filter.getUrlOfProperty() + ")."); + + } + return sparql; + + } + + public String getUrlForQueries() { + return urlForQueries; + } +} diff --git a/src/main/java/de/biba/triple/store/access/marmotta/MarmottaPropertyValuesCrawler.java b/src/main/java/de/biba/triple/store/access/marmotta/MarmottaPropertyValuesCrawler.java new file mode 100644 index 0000000..b702469 --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/marmotta/MarmottaPropertyValuesCrawler.java @@ -0,0 +1,72 @@ +package de.biba.triple.store.access.marmotta; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.marmotta.client.ClientConfiguration; +import org.apache.marmotta.client.MarmottaClient; +import org.apache.marmotta.client.clients.SPARQLClient; +import org.apache.marmotta.client.exception.MarmottaClientException; +import org.apache.marmotta.client.model.rdf.RDFNode; +import org.apache.marmotta.client.model.sparql.SPARQLResult; + +import de.biba.triple.store.access.IPropertyValuesCrawler; +import de.biba.triple.store.access.enums.ExecutionMode; +import de.biba.triple.store.access.jena.PropertyValuesCrawler; + +public class MarmottaPropertyValuesCrawler extends PropertyValuesCrawler implements IPropertyValuesCrawler{ + + private ClientConfiguration config = null; + private MarmottaClient client = null; + private String marmottaUri = "http://134.168.33.237:8080/marmotta"; + private SPARQLClient sparqlClient = null; + + public MarmottaPropertyValuesCrawler() { + init(ExecutionMode.REMOTE); + } + + public MarmottaPropertyValuesCrawler(String marmottaUri) { + init(marmottaUri); + } + + + private void init(String uri) { + if (uri == null) { + config = new ClientConfiguration(marmottaUri); + } else { + config = new ClientConfiguration(uri); + + } + client = new MarmottaClient(config); + sparqlClient = client.getSPARQLClient(); + + } + + + public SPARQLResult query(String sparql){ + try { + SPARQLResult result = sparqlClient.select(sparql); + return result; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (MarmottaClientException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + public List createResultList(Object result, String propertyName) { + SPARQLResult result2 = (SPARQLResult) result; + List allProperties = new ArrayList(); + for (int i =0; i < result2.size(); i++){ + + RDFNode node = result2.get(i).get(propertyName); + allProperties.add(node.toString()); + } + return allProperties; + } + +} diff --git a/src/main/java/de/biba/triple/store/access/marmotta/MarmottaReader.java b/src/main/java/de/biba/triple/store/access/marmotta/MarmottaReader.java new file mode 100644 index 0000000..9c945ff --- /dev/null +++ b/src/main/java/de/biba/triple/store/access/marmotta/MarmottaReader.java @@ -0,0 +1,311 @@ +package de.biba.triple.store.access.marmotta; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.apache.http.config.Registry; +import org.apache.http.config.RegistryBuilder; +import org.apache.http.conn.socket.ConnectionSocketFactory; +import org.apache.http.conn.socket.PlainConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.jena.query.Query; +import org.apache.jena.query.QueryExecution; +import org.apache.jena.query.QueryExecutionFactory; +import org.apache.jena.query.QueryFactory; +import org.apache.jena.query.QuerySolution; +import org.apache.jena.query.ResultSet; +import org.apache.jena.query.ResultSetFactory; +import org.apache.marmotta.client.ClientConfiguration; +import org.apache.marmotta.client.MarmottaClient; +import org.apache.marmotta.client.clients.SPARQLClient; +import org.apache.marmotta.client.exception.MarmottaClientException; +import org.apache.marmotta.client.model.rdf.Literal; +import org.apache.marmotta.client.model.rdf.RDFNode; +import org.apache.marmotta.client.model.rdf.URI; +import org.apache.marmotta.client.model.sparql.SPARQLResult; + +import de.biba.triple.store.access.IReader; +import de.biba.triple.store.access.dmo.Entity; +import de.biba.triple.store.access.enums.Language; +import de.biba.triple.store.access.jena.Reader; + +public class MarmottaReader extends Reader implements IReader { + + private ClientConfiguration config = null; + private MarmottaClient client = null; + private String marmottaUri = "http://134.168.33.237:8080/marmotta"; + private SPARQLClient sparqlClient = null; + + public MarmottaReader() { + init(marmottaUri); + } + + public MarmottaReader(String marmottaUri) { + init(marmottaUri); + } + + private void init(String uri) { + marmottaUri = uri; + if (uri == null) { + config = new ClientConfiguration(marmottaUri); + } else { + config = new ClientConfiguration(uri); + + } + + final Registry registry = RegistryBuilder.create() + .register("http", PlainConnectionSocketFactory.getSocketFactory()) + .register("https", SSLConnectionSocketFactory.getSocketFactory()) + .build(); + + final PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(registry); + cm.setMaxTotal(100); + config.setConectionManager(cm); + + + client = new MarmottaClient(config); + sparqlClient = client.getSPARQLClient(); + + } + + public SPARQLResult query(String sparql) { + try { + // sparql = + // sparql.replace("http://www.aidimme.es/FurnitureSectorOntology.owl", + // arg1) + SPARQLResult result = sparqlClient.select(sparql); + return result; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (MarmottaClientException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + public List createResultList(Object result, String propertyName) { + SPARQLResult result2 = (SPARQLResult) result; + List allProperties = new ArrayList(); + if (result2 != null) { + for (int i = 0; i < result2.size(); i++) { + + RDFNode node = result2.get(i).get(propertyName); + if (node instanceof URI || node instanceof Literal) { + if (node instanceof URI){ + URI uri = (URI) node; + allProperties.add(uri.toString()); + } + else{ + Literal literal = (Literal) node; + String language = literal.getLanguage(); + if (language != null){ + allProperties.add(node.toString() + "@" + language); + } + else{ + + allProperties.add(node.toString()); + } + } + } + } + } + return allProperties; + } + + @Override + public List createResultListArray(Object result, String[] propertyNames) { + + for (int i = 0; i < propertyNames.length; i++) { + if (propertyNames[i].contains("?")) { + + propertyNames[i] = propertyNames[i].replace("?", ""); + + } + } + + List allProperties = new ArrayList(); + if (result != null) { + SPARQLResult result2 = (SPARQLResult) result; + if (result2 != null) { + for (int i = 0; i < result2.size(); i++) { + List line = new ArrayList(); + for (String pn : propertyNames) { + RDFNode node = result2.get(i).get(pn); + if (node instanceof URI || node instanceof Literal) { + line.add(node.toString()); + } + } + String[] row = new String[line.size()]; + line.toArray(row); + allProperties.add(row); + + } + } + } + return allProperties; + } + + + + @Override + public List getAllPropertiesIncludingEverything(String urlOfClass) { + + if (!urlOfClass.contains("<")) { + urlOfClass = "<" + urlOfClass + ">"; + } + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: PREFIX mic: select distinct ?property ?type where { { GRAPH { ?property rdfs:range ?type . ?property (rdfs:domain/owl:unionOf/rdf:rest*/rdf:first | rdfs:domain) ?x . filter isIri(?x) . { select ?parents where { { GRAPH { ?uri rdfs:subClassOf*/rdfs:subClassOf ?parents . { select ?uri where { values ?uri { " + + urlOfClass + + " } } } } } UNION { { GRAPH { select ?parents where { values ?parents { " + + urlOfClass + + " } } } } } } } filter (?x in (?parents) ) . } } } order by ?property"; + + Object result = query(sparql); + Logger.getAnonymousLogger().log(Level.INFO, sparql); + List allProperties = createResultList(result, "property"); + return allProperties; + } + + + @Override + public List getAllPropertiesIncludingEverythingWhichHasValues(String urlOfClass) { + + if (!urlOfClass.contains("<")) { + urlOfClass = "<" + urlOfClass + ">"; + } + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: PREFIX mic: select distinct ?property ?type where { { GRAPH { ?property rdfs:range ?type . ?property (rdfs:domain/owl:unionOf/rdf:rest*/rdf:first | rdfs:domain) ?x . filter isIri(?x) . { select ?parents where { { GRAPH { ?uri rdfs:subClassOf*/rdfs:subClassOf ?parents . { select ?uri where { values ?uri { " + + urlOfClass + + " } } } } } UNION { { GRAPH { select ?parents where { values ?parents { " + + urlOfClass + + " } } } } } } } filter (?x in (?parents) ) . } } } order by ?property"; + + Object result = query(sparql); + Logger.getAnonymousLogger().log(Level.INFO, sparql); + List allProperties = createResultList(result, "property"); + return allProperties; + } + + + @Override + public Map getPropertyValuesOfAIndividium(String urlOfIndividuum) { + int counter =0; + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: SELECT ?predicate ?object WHERE { <" + + urlOfIndividuum + ">" + + "?predicate ?object. FILTER (?predicate != )}"; + Logger.getAnonymousLogger().log(Level.INFO, "Request: " + sparql); + Object result = query(sparql); + Map allProperties = new HashMap(); + if (result != null && result instanceof SPARQLResult) { + SPARQLResult result2 = (SPARQLResult) result; + if (result2 != null) { + for (int i = 0; i < result2.size(); i++) { + + RDFNode nodePredicate = result2.get(i).get("predicate"); + RDFNode ndoeObject = result2.get(i).get("object"); + if (ndoeObject instanceof URI || ndoeObject instanceof Literal) { + String predicate = nodePredicate.toString(); + String value = ndoeObject.toString(); + if (!((predicate.contains("rdfs:type")) + || (predicate.contains("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")))) { + if (allProperties.containsKey(predicate)){ + counter++; + allProperties.put(predicate+counter, value); + } + else{ + allProperties.put(predicate, value); + } + } + } + } + } + } + return allProperties; + } + + @Override + public Object queryRemoteHelper(String sparqlStr) { + try { + SPARQLResult results = sparqlClient.select(sparqlStr); + return results; // Passes the result set out of the try-resources + } catch (Exception e) { + Logger.getAnonymousLogger().log(Level.SEVERE, e.getLocalizedMessage()); + System.out.println("Exception: " + e.getMessage()); + } + return null; + } + + public static void main(String[] arvs) { + MarmottaReader marmottaReader = new MarmottaReader(); + SPARQLResult result = marmottaReader.query("SELECT * WHERE { ?subject ?property ?object}LIMIT 10"); + // System.out.println(marmottaReader.getAllConcepts()); + // http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair + System.out.println(marmottaReader + .getAllPropertiesIncludingEverything("http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair")); + System.out.println("#################################"); + System.out.println(marmottaReader.getAllPropertiesIncludingEverything( + "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair")); + + } + + + @Override + public List getAllConceptsFocusOnlyOnURI(String searchTerm) { + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: SELECT distinct ?subject ?codeValue WHERE { ?subject . "; + + sparql += "?instance . ?instance ?type. ?type ?code. ?code ?codeValue."; + + String filter = " FILTER (regex( str("; + filter += "?subject" + ")," + "\"" + searchTerm + "\",\"i\") && regex (str(?codeValue),"+ "\"" + searchTerm + "\",\"i\"))."; + sparql += filter + "}"; + System.out.println(sparql); + Object result = query(sparql); + List allProperties = createResultList(result, "codeValue"); + List resultOfSearchTerm = new ArrayList(); + for (String concept : allProperties) { + + Entity entity = new Entity(); + entity.setUrl(concept); + String value = concept.substring(concept.indexOf("#") + 1); + entity.setTranslatedURL(value); + entity.setLanguage(Language.UNKNOWN); + resultOfSearchTerm.add(entity); + } + return resultOfSearchTerm; + } + + /** + * + */ + @Override + public List getAllConceptsLanguageSpecific(String searchTerm, Language language) { + String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: SELECT distinct ?subject ?translation WHERE { ?subject . "; + sparql += "?subject <"+getLanguageLabel()+"> ?translation. "; + sparql += "?instance . ?instance ?type. ?type ?code. ?code ?codeValue."; + + String filter = " FILTER (regex( str("; + filter += "?translation" + ")," + "\"" + searchTerm + "\",\"i\") && regex (str(?codeValue),"+ "str(?subject)" + "))."; + sparql += filter + "}"; + System.out.println(sparql); + Object result = query(sparql); + List allProperties = createResultListArray(result, new String[]{"subject", "translation"}); + List resultOfSearchTerm = new ArrayList(); + for (String[] element : allProperties) { + + Entity entity = new Entity(); + entity.setUrl(element[0]); + String value = element[1]; + entity.setTranslatedURL(value); + entity.setLanguage(Language.UNKNOWN); + resultOfSearchTerm.add(entity); + } + return resultOfSearchTerm; + } + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/clients/IdentityClient.java b/src/main/java/eu/nimble/service/catalog/search/clients/IdentityClient.java new file mode 100644 index 0000000..44df786 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/clients/IdentityClient.java @@ -0,0 +1,12 @@ +package eu.nimble.service.catalog.search.clients; + +import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +@FeignClient(name = "identity-service", url = "${nimble.identity.url}", fallback = IdentityClientFallback.class) + public interface IdentityClient { + @RequestMapping(value = "/party_by_person/{personId}", produces = {"application/json"}, method = RequestMethod.GET) + Object getPerson(Long personId); + } + diff --git a/src/main/java/eu/nimble/service/catalog/search/clients/IdentityClientFallback.java b/src/main/java/eu/nimble/service/catalog/search/clients/IdentityClientFallback.java new file mode 100644 index 0000000..f1977af --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/clients/IdentityClientFallback.java @@ -0,0 +1,68 @@ +package eu.nimble.service.catalog.search.clients; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.hibernate.validator.internal.util.privilegedactions.GetMethod; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + + +@Component + public class IdentityClientFallback implements IdentityClient { + + + + private static final String PARTY_BY_PERSON = "party_by_person/"; + @Value("${nimble.identity.url}") + private String url; + + @Override + public Object getPerson(Long personId) { + // Create an instance of HttpClient. + HttpClient client = new DefaultHttpClient(); + String url = ""; + if (this.url.charAt(this.url.length()-1) == '/'){ + url = this.url + PARTY_BY_PERSON; + } + else{ + url = this.url +"/" +PARTY_BY_PERSON; + } + + + + // Create a method instance. + HttpGet request = new HttpGet(url); + StringBuffer stringBuffer = new StringBuffer(); + try { + HttpResponse response = client.execute(request); + + // Get the response + BufferedReader rd = new BufferedReader + (new InputStreamReader( + response.getEntity().getContent())); + + String line = ""; + while ((line = rd.readLine()) != null) { + stringBuffer.append(line); + } + return stringBuffer.toString(); + + } catch (ClientProtocolException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + } + diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/DefaultPropertyFactory.java b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/DefaultPropertyFactory.java new file mode 100644 index 0000000..89f1df2 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/DefaultPropertyFactory.java @@ -0,0 +1,92 @@ +package eu.nimble.service.catalog.search.impl.Indexing; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import eu.nimble.service.catalog.search.impl.dao.PropertyType; + +public class DefaultPropertyFactory extends IndexingServiceConstant{ + + + + public List createProperties() { + + List result = new ArrayList(); + + result.add(createNameProperty()); + result.add(createDescriptionProperty()); + result.add(createPriceProperty()); + result.add(createCatalogieIdProperty()); + + return result; + } + + private PropertyType createPriceProperty() { + PropertyType r = new PropertyType(); + r.setVisible(true); + r.setUri(namespace + "price"); + Collection idxFieldNames = new ArrayList(); + idxFieldNames.add("price"); + r.setItemFieldNames(idxFieldNames); + Map labelMap = new HashMap(); + labelMap.put("en", "Price"); + labelMap.put("es", "Precios"); + labelMap.put("sv", "Pris"); + r.setLabel(labelMap); + + r.setRange(HTTP_WWW_W3_ORG_2001_XML_SCHEMA+ "float"); + return r; + } + + private PropertyType createDescriptionProperty() { + PropertyType r = new PropertyType(); + r.setVisible(true); + r.setUri(namespace + "description"); + Collection idxFieldNames = new ArrayList(); + idxFieldNames.add("description"); + r.setItemFieldNames(idxFieldNames); + Map labelMap = new HashMap(); + labelMap.put("en", "Description"); + labelMap.put("es", "Descripción"); + labelMap.put("sv", "beskrivning"); + r.setLabel(labelMap); + r.setRange(HTTP_WWW_W3_ORG_2001_XML_SCHEMA+ "string"); + return r; + } + + private PropertyType createNameProperty() { + PropertyType r = new PropertyType(); + r.setVisible(true); + r.setUri(namespace + "name"); + Collection idxFieldNames = new ArrayList(); + idxFieldNames.add("label"); + r.setItemFieldNames(idxFieldNames); + Map labelMap = new HashMap(); + labelMap.put("en", "Name"); + labelMap.put("es", "Nombre"); + labelMap.put("sv", "Namn"); + r.setRange(HTTP_WWW_W3_ORG_2001_XML_SCHEMA+ "string"); + r.setLabel(labelMap); + return r; + } + + private PropertyType createCatalogieIdProperty() { + PropertyType r = new PropertyType(); + r.setVisible(true); + r.setUri(namespace + "catalogueId"); + Collection idxFieldNames = new ArrayList(); + idxFieldNames.add("catalogueId"); + r.setItemFieldNames(idxFieldNames); + Map labelMap = new HashMap(); + labelMap.put("en", "CatalogueId"); + labelMap.put("es", "ID de catálogo"); + labelMap.put("sv", "Katalog ID"); + r.setRange(HTTP_WWW_W3_ORG_2001_XML_SCHEMA+ "string"); + r.setLabel(labelMap); + return r; + } + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/IndexFieldCache.java b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/IndexFieldCache.java new file mode 100644 index 0000000..7f9be7f --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/IndexFieldCache.java @@ -0,0 +1,230 @@ +package eu.nimble.service.catalog.search.impl.Indexing; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.google.gson.internal.LinkedTreeMap; + +import de.biba.triple.store.access.enums.Language; +import eu.nimble.service.catalog.search.impl.dao.IndexFields; +import eu.nimble.service.catalog.search.impl.dao.PropertyRelevance; + +/** + * This cache is required to know which indexFields can be sued for which solr query + * @author fma + * + */ +public class IndexFieldCache extends IndexingServiceConstant{ + + private static final String HTTP_UNKNOWN_SOURCE_DESCRIPTION = "http://UnknownSource#description"; + private static final String HTTP_UNKNOWN_SOURCE_PRICE = "http://UnknownSource#price"; + private List allndexFields = new ArrayList(); + private Map indexFieldPerPropertyURL = new HashMap (); + private Map indexFieldPerPropertyURLManuallyAdded = new HashMap (); + //private Map propertyRelevanceByPropertyURL = new HashMap(); + private Map> propertyRelevancesByConceptURL = new HashMap>(); + + public List detectLanguagesNyIndexFields(){ + + List result = new LinkedList<>(); + + for (IndexFields field :allndexFields){ + if (field.getFieldName().contains("_labels")){ + String prefix = field.getDynamicPart(); + Language language = Language.fromString(prefix); + result.add(language); + } + } + return result; + } + + public IndexFieldCache() { + super(); + addManualFilters(); + } + + + public void addManualFilters(){ + //("http://UnknownSource#name"); + //http://UnknownSource#description"); + //("http://UnknownSource#price"); + + IndexFields fieldsName = new IndexFields(); + fieldsName.setDataType(this.HTTP_WWW_W3_ORG_2001_XML_SCHEMA + "string"); + fieldsName.setFieldName("allLabels"); + fieldsName.setUri("http://UnknownSource#name"); + indexFieldPerPropertyURLManuallyAdded.put("http://UnknownSource#name", fieldsName); + + + IndexFields fieldsDecription = new IndexFields(); + fieldsDecription.setDataType(this.HTTP_WWW_W3_ORG_2001_XML_SCHEMA + "string"); + fieldsDecription.setFieldName("en_desc"); + fieldsDecription.setUri(HTTP_UNKNOWN_SOURCE_DESCRIPTION); + indexFieldPerPropertyURLManuallyAdded.put(HTTP_UNKNOWN_SOURCE_DESCRIPTION, fieldsDecription); + + IndexFields fieldsPrice = new IndexFields(); + fieldsPrice.setDataType(this.HTTP_WWW_W3_ORG_2001_XML_SCHEMA + "double"); + fieldsPrice.setFieldName("_price"); + fieldsPrice.setUri(HTTP_UNKNOWN_SOURCE_PRICE); + indexFieldPerPropertyURLManuallyAdded.put(HTTP_UNKNOWN_SOURCE_PRICE, fieldsPrice); + + IndexFields fieldsCatalogueID = new IndexFields(); + fieldsCatalogueID.setDataType(this.HTTP_WWW_W3_ORG_2001_XML_SCHEMA + "string"); + fieldsCatalogueID.setFieldName("catalogueId"); + fieldsCatalogueID.setUri(HTTP_UNKNOWN_SOURCE_PRICE); + indexFieldPerPropertyURLManuallyAdded.put(HTTP_UNKNOWN_SOURCE_PRICE, fieldsCatalogueID); + + + } + + + public void insertAllIndexFields(Collection indexFields){ + allndexFields.clear(); + Iterator iterator = (Iterator) ((Object)indexFields.iterator()); + while (iterator.hasNext()){ + com.google.gson.internal.LinkedTreeMap map = iterator.next(); + + IndexFields field = new IndexFields(); + field.setUri((String) map.get("uri")); + field.setFieldName((String) map.get("fieldName")); + field.setDataType((String)map.get("dataType")); + field.setDynamicBase((String)map.get("dynamicBase")); + field.setMappedName((String)map.get("mappedName")); + field.setDynamicPart((String)map.get("dynamicPart")); + + allndexFields.add(field); + + if (field.getUri() != null && field.getUri().length() > 0){ + indexFieldPerPropertyURL.put(field.getUri(), field); + } + } + + adaptPriceProperty(allndexFields); + adaptDescriptionProperty(allndexFields); + } + + private void adaptPriceProperty(List allndexFields2) { + List relevantPriceFieldNames = new ArrayList(); + for (IndexFields indexFields: allndexFields2){ + + if (indexFields.getDynamicBase()!= null && indexFields.getDynamicBase().equals("*_price")){ + relevantPriceFieldNames.add(indexFields.getFieldName()); + } + + } + + if (relevantPriceFieldNames.size() > 0){ + indexFieldPerPropertyURLManuallyAdded.get(HTTP_UNKNOWN_SOURCE_PRICE).getDifferentFieldNames().addAll(relevantPriceFieldNames); + } + + } + + + private void adaptDescriptionProperty(List allndexFields2) { + List relevantPriceFieldNames = new ArrayList(); + for (IndexFields indexFields: allndexFields2){ + if (indexFields.getDynamicBase()!= null && indexFields.getDynamicBase().equals("*_desc")){ + relevantPriceFieldNames.add(indexFields.getFieldName()); + } + + } + + if (relevantPriceFieldNames.size() > 0){ + indexFieldPerPropertyURLManuallyAdded.get(HTTP_UNKNOWN_SOURCE_DESCRIPTION).getDifferentFieldNames().addAll(relevantPriceFieldNames); + } + + } + + public boolean isIndexFieldInfoContained(String propoertyUrl){ + return indexFieldPerPropertyURL.containsKey(propoertyUrl); + } + + public boolean isPropertyRelevanceInfoContained(String concept, String propoertyUrl){ + if( propertyRelevancesByConceptURL.containsKey(concept) && propertyRelevancesByConceptURL.get(concept).containsKey(propoertyUrl)){ + return true; + } + return false; + } + + + public boolean isPropertyRelevanceGiven(String concept, String propoertyUrl){ + if( propertyRelevancesByConceptURL.containsKey(concept) && propertyRelevancesByConceptURL.get(concept).containsKey(propoertyUrl)){ + return propertyRelevancesByConceptURL.get(concept).get(propoertyUrl).isItRelevant(); + } + return false; + } + + public void addProopertyRelevance(String conceptURL, String propertyURL, PropertyRelevance pRelevance){ + Map pRRelevanceMap = null; + if (propertyRelevancesByConceptURL.containsKey(conceptURL)){ + pRRelevanceMap = propertyRelevancesByConceptURL.get(conceptURL); + } + else{ + pRRelevanceMap = new HashMap(); + propertyRelevancesByConceptURL.put(conceptURL, pRRelevanceMap); + } + pRRelevanceMap.put(propertyURL, pRelevance); + } + + public String getIndexFieldForAOntologicalProperty( String propertyURL){ + if (propertyURL != null && propertyURL.length() > 0 && indexFieldPerPropertyURL.containsKey(propertyURL)){ + return indexFieldPerPropertyURL.get(propertyURL).getFieldName(); + } + Logger.getAnonymousLogger().log(Level.WARNING, "Found no fieldname for: " + propertyURL); + return null; + } + + + + + + public String getIndexFieldForAnyKindOfProperty( String propertyURL){ + if (propertyURL != null && propertyURL.length() > 0 && indexFieldPerPropertyURL.containsKey(propertyURL)){ + return indexFieldPerPropertyURL.get(propertyURL).getFieldName(); + } + + if (propertyURL != null && propertyURL.length() > 0 && indexFieldPerPropertyURLManuallyAdded.containsKey(propertyURL)){ + return indexFieldPerPropertyURLManuallyAdded.get(propertyURL).getFieldName(); + } + + Logger.getAnonymousLogger().log(Level.WARNING, "Found no fieldname for: " + propertyURL); + return null; + } + + + public IndexFields getIndexFieldForAnyKindOfPropertyAsIndexFields( String propertyURL){ + if (propertyURL != null && propertyURL.length() > 0 && indexFieldPerPropertyURL.containsKey(propertyURL)){ + return indexFieldPerPropertyURL.get(propertyURL); + } + + if (propertyURL != null && propertyURL.length() > 0 && indexFieldPerPropertyURLManuallyAdded.containsKey(propertyURL)){ + return indexFieldPerPropertyURLManuallyAdded.get(propertyURL); + } + + Logger.getAnonymousLogger().log(Level.WARNING, "Found no fieldname for: " + propertyURL); + return null; + } + + + public IndexFields getIndexFieldDAOForAOntologicalProperty( String propertyURL){ + if (propertyURL != null && propertyURL.length() > 0){ + return indexFieldPerPropertyURL.get(propertyURL); + } + Logger.getAnonymousLogger().log(Level.WARNING, "Found no fieldname for: " + propertyURL); + return null; + } + + + + + + + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/IndexingServiceConstant.java b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/IndexingServiceConstant.java new file mode 100644 index 0000000..d6ccf57 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/IndexingServiceConstant.java @@ -0,0 +1,9 @@ +package eu.nimble.service.catalog.search.impl.Indexing; + +public abstract class IndexingServiceConstant { + public final String HTTP_WWW_W3_ORG_2001_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema#"; + public String namespace = "http://UnknownSource#"; + public String nameSPACEUBL = "http://www.nimble-project.org/resource/ubl#"; + public static final String HTTP_WWW_NIMBLE_PROJECT_ORG_RESOURCE_UBL = "http://www.nimble-project.org/resource/ubl#"; + public static final String N_ULL = "NUll"; +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/IndexingServiceReader.java b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/IndexingServiceReader.java new file mode 100644 index 0000000..11a11dd --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/IndexingServiceReader.java @@ -0,0 +1,1392 @@ +package eu.nimble.service.catalog.search.impl.Indexing; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.json.JSONArray; +import org.json.JSONObject; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +import de.biba.triple.store.access.dmo.Entity; +import de.biba.triple.store.access.enums.ConceptSource; +import de.biba.triple.store.access.enums.Language; +import eu.nimble.service.catalog.search.factories.ValueGroupingFactory; +import eu.nimble.service.catalog.search.impl.dao.ClassType; +import eu.nimble.service.catalog.search.impl.dao.ClassTypes; +import eu.nimble.service.catalog.search.impl.dao.Filter; +import eu.nimble.service.catalog.search.impl.dao.Group; +import eu.nimble.service.catalog.search.impl.dao.IndexFields; +import eu.nimble.service.catalog.search.impl.dao.ItemMappingFieldInformation; +import eu.nimble.service.catalog.search.impl.dao.LocalOntologyView; +import eu.nimble.service.catalog.search.impl.dao.PropertyRelevance; +import eu.nimble.service.catalog.search.impl.dao.PropertyType; +import eu.nimble.service.catalog.search.impl.dao.UBLResult; +import eu.nimble.service.catalog.search.impl.dao.enums.PropertySource; +import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteOptionalSelect; +import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteSelect; +import eu.nimble.service.catalog.search.impl.dao.input.InputParameterForGetReferencesFromAConcept; +import eu.nimble.service.catalog.search.impl.dao.input.InputParameterdetectMeaningLanguageSpecific; +import eu.nimble.service.catalog.search.impl.dao.input.InputParamterForGetLogicalView; +import eu.nimble.service.catalog.search.impl.dao.item.ItemType; +import eu.nimble.service.catalog.search.impl.dao.item.SOLRResult; +import eu.nimble.service.catalog.search.impl.dao.output.OutputForExecuteSelect; +import eu.nimble.service.catalog.search.impl.dao.output.OutputForGetLogicalView; +import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertiesFromConcept; +import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertyFromConcept; +import eu.nimble.service.catalog.search.impl.dao.output.TranslationResult; + +public class IndexingServiceReader extends IndexingServiceConstant { + + private static final String AUTHORIZATION = "Authorization"; + private static final String FIND_ANY_VALUE = ":[*%20TO%20*]"; + private String url = ""; + private String urlForClassInformation = ""; + private String urlForPropertyInformation = ""; + private String urlForPropertyInformationUBL = ""; + private String urlForItemInformation = ""; + private String urlForIndexFields = ""; + private PropertyInformationCache propertyInformationCache = new PropertyInformationCache(); + private TaxonomyCache taxonomyCache = new TaxonomyCache(); + private IndexFieldCache indexFieldCache = new IndexFieldCache(); + private Map allRelevantPropertyValuesForLanguageCompletion = new HashMap(); + + public IndexingServiceReader(String url) { + super(); + this.url = url; + if (url.charAt(url.length() - 1) != '/') { + url += "/"; + } + urlForClassInformation = url + "class"; + urlForPropertyInformation = url + "property"; + urlForPropertyInformationUBL = url + "property"; + urlForItemInformation = url + "item"; + urlForIndexFields = url + "item/fields"; + + Collection allFields = requestAllIndexFields(); + indexFieldCache.insertAllIndexFields(allFields); + + } + + public String getUrlForPropertyInformationUBL() { + return urlForPropertyInformationUBL; + } + + public Collection requestAllIndexFields() { + + String url = urlForIndexFields; + String response = invokeHTTPMethod(url,null); + Gson gson = new Gson(); + Collection result = gson.fromJson(response, Collection.class); + return result; + + } + + public void setUrlForPropertyInformationUBL(String urlForPropertyInformationUBL) { + this.urlForPropertyInformationUBL = urlForPropertyInformationUBL + "property"; + } + + private String invokeHTTPMethod(String url,String bearerToken) { + Logger.getAnonymousLogger().log(Level.INFO, "Try out: " + url); + HttpClient client = new DefaultHttpClient(); + HttpGet request = new HttpGet(url); + if (bearerToken == null) { + request.setHeader(AUTHORIZATION, "Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICIxYnNrM09PZkNzdWF0LXV1X0lqU2JxX2QwMmtZM2NteXJheUpXeE93MmlZIn0.eyJqdGkiOiIzMGVjMTNlMy1lNWMzLTQ0ZTktOTcwYi1mOTczNDM5YmUyYjQiLCJleHAiOjE1ODQzNDUxMjgsIm5iZiI6MCwiaWF0IjoxNTg0MzQxNTI4LCJpc3MiOiJodHRwOi8vbmltYmxlLXN0YWdpbmcuc2FsemJ1cmdyZXNlYXJjaC5hdDo4MDgwL2F1dGgvcmVhbG1zL21hc3RlciIsImF1ZCI6Im5pbWJsZV9jbGllbnQiLCJzdWIiOiJiZDEyZTg5Zi1jMjA5LTQ1OTYtYmM5Zi0xMmY4MzQwOWY3YjIiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJuaW1ibGVfY2xpZW50IiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiZGM0ZjI0NGQtZjRlYS00ZWZjLTlmNGItNWNlZjJjMDMxYmRiIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJuaW1ibGVfdXNlciIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsIm1hbmFnZS1hY2NvdW50LWxpbmtzIiwidmlldy1wcm9maWxlIl19fSwibmFtZSI6IkZyYW5rZSBNYXJjbyIsInByZWZlcnJlZF91c2VybmFtZSI6Im1hcmNvZnJhbmtlODJAZ29vZ2xlbWFpbC5jb20iLCJnaXZlbl9uYW1lIjoiRnJhbmtlIiwiZmFtaWx5X25hbWUiOiJNYXJjbyIsImVtYWlsIjoibWFyY29mcmFua2U4MkBnb29nbGVtYWlsLmNvbSJ9.GdsP7wsjCLnyNFR6dWAEWtwPCysgvYG0YCKu8sRBAtWHeGkZYMQWcivB_vtGCO3Ts53fr-az_R-wrn0rkeSk4hXctTPRa6m3pd3QMxwRhxRAlDZOmxl-cJp2ZXdqZwPTyVtfVdExRycbqycdAlFc2Ig44oqL2rS3r1RMEomK9Vhm80kT22TIKprqcjyLIdoZ6eAIG6l2ini8qpoG_tw4KVkQdu_hMZS_lvkzdk6ahS5cpMOUas36OfZR_ijlpNdKama5LHF6Lhp9wSnu7j6A2ycQ6CltfKRGTbIZX9qJ87Gu845h3yoXp9QYGbvOGHGoZ2ztgXTteZxcjz3AfQZ9WA"); + } + else { + request.setHeader(AUTHORIZATION, bearerToken); + } + StringBuffer stringBuffer = new StringBuffer(); + try { + HttpResponse response = client.execute(request); + + // Get the response + BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); + + String line = ""; + while ((line = rd.readLine()) != null) { + stringBuffer.append(line); + } + rd.close(); + Logger.getAnonymousLogger().log(Level.INFO, "Success: " + url); + return stringBuffer.toString(); + + } catch (ClientProtocolException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + Logger.getAnonymousLogger().log(Level.SEVERE, "Error: " + url); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + Logger.getAnonymousLogger().log(Level.SEVERE, "Error: " + url); + } + return null; + } + + /** + * The peroperties have three sources ontology, ubl, unknown. + * + * @param urlOfClass + * @param bearerToken + * @return + */ + public List getAllPropertiesIncludingEverything(String urlOfClass, String bearerToken) { + + List propInfos = new ArrayList(); + String httpGetURL = urlForClassInformation + "?uri=" + URLEncoder.encode(urlOfClass); + String result = invokeHTTPMethod(httpGetURL,bearerToken); + Logger.getAnonymousLogger().log(Level.INFO, result); + List allProperties = new ArrayList(); + Gson gson = new Gson(); + ClassType r = gson.fromJson(result, ClassType.class); + if (r != null) { + if (r.getProperties() != null) { + r.getProperties().forEach(x -> allProperties.add(x)); + } + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "Find no class informaiton to: " + urlOfClass + " by using: " + httpGetURL); + } + // allProperties.add(result); + + List propInfosUBL = requestStandardPropertiesFromUBL(bearerToken); + propInfosUBL.forEach(x -> { + String propertyURL = x.getUri(); + boolean relevant = checkWhetherPropertyIsRelevant(propertyURL, urlOfClass,bearerToken); + if (x.isVisible() && relevant) { + propInfos.add(x); + x.setConceptSource(ConceptSource.CUSTOM); + allProperties.add(x.getUri()); + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "UBL specifc property is marked as not visible or has no property values in the catalogie: " + + propertyURL); + } + }); + + List propInfosStandard = requestStandardPropertiesFromUnknownSopurce(); + propInfosStandard.forEach(x -> { + boolean relevant = checkWhetherPropertyIsRelevant(x.getUri(), urlOfClass, bearerToken); + if(relevant){ + x.setConceptSource(ConceptSource.CUSTOM); + allProperties.add(x.getUri()); + propInfos.add(x); + } + }); + + if (!propertyInformationCache.isConceptAlreadyContained(urlOfClass)) { + + + //propInfos.addAll(propInfosUBL); + //propInfos.addAll(propInfosStandard); + + for (String propertyURL : allProperties) { + boolean relevant = checkWhetherPropertyIsRelevant(propertyURL, urlOfClass,bearerToken); + if (relevant) { + PropertyType p = requestPropertyInfos(gson, propertyURL,bearerToken); + if (p != null && p.isVisible()) { + p.setConceptSource(ConceptSource.ONTOLOGICAL); + propInfos.add(p); + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "Ignore property, because it is set to be invisible: " + propertyURL); + } + } + // propInfos.add(requestPropertyInfos(gson, propertyURL)); + } + if (propInfos.size() > 0) { + propertyInformationCache.addConcept(urlOfClass, propInfos); + } else { + Logger.getAnonymousLogger().log(Level.WARNING, "Cannot request property infos of class " + urlOfClass); + } + + } + Iterator iterator = allProperties.iterator(); + while (iterator.hasNext()) { + String property = iterator.next(); + PropertyType pType = propertyInformationCache.getPropertyTypeForASingleProperty(urlOfClass, property); + if (pType == null) { + iterator.remove(); + } + } + return allProperties; + } + + private void synchronizeTaxonomyCache(String urlOfClass, ClassType r) { + if (r.getAllChildren() != null && r.getAllChildren().size() > 0) { + List list = new ArrayList(r.getAllChildren()); + taxonomyCache.addAllSubConcepts(urlOfClass, list); + } + + if (r.getAllParents() != null && r.getAllParents().size() > 0) { + List list = new ArrayList(r.getAllParents()); + taxonomyCache.addAllUpperConcepts(urlOfClass, list); + } + } + + private List requestStandardPropertiesFromUnknownSopurce() { + + DefaultPropertyFactory factory = new DefaultPropertyFactory(); + + return factory.createProperties(); + } + + public List requestStandardPropertiesFromUBL(String bearerToken) { + // https://nimble-platform.salzburgresearch.at/nimble/indexing-service/property/select?q=nameSpace:%22http://www.nimble-project.org/resource/ubl%23%22) + String urlOfUBBL = HTTP_WWW_NIMBLE_PROJECT_ORG_RESOURCE_UBL; + String httpGetURL = urlForPropertyInformationUBL + "/select?q=nameSpace:" + + URLEncoder.encode("\"" + urlOfUBBL + "\""); + String result = invokeHTTPMethod(httpGetURL,bearerToken); + // System.out.println(result); + + Gson gson = new Gson(); + UBLResult r = gson.fromJson(result, UBLResult.class); + for (PropertyType pType : r.getResult()) { + if (pType.getUri().equals("http://www.nimble-project.org/resource/ubl#certificateType")) { + + if (!pType.getItemFieldNames().contains("certificateType")) { + pType.getItemFieldNames().add("certificateType"); + } + } + if (pType.getUri().equals("http://www.nimble-project.org/resource/ubl#freeOfCharge")) { + + if (!pType.getItemFieldNames().contains("freeOfCharge")) { + pType.getItemFieldNames().add("freeOfCharge"); + } + } + if (pType.getUri().equals("http://www.nimble-project.org/resource/ubl#manufacturerId")) { + + if (!pType.getItemFieldNames().contains("manufacturerId")) { + pType.getItemFieldNames().add("manufacturerId"); + } + } + } + return r.getResult(); + } + + public List detectPossibleConceptsLanguageSpecific( + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific, String bearerToken) { + List result = new ArrayList(); + String field = "_txt"; + Language language = inputParameterdetectMeaningLanguageSpecific.getLanguage(); + String prefixLanguage = Language.toOntologyPostfix(language).replaceAll("@", ""); + field = prefixLanguage + field; + String keyword = inputParameterdetectMeaningLanguageSpecific.getKeyword(); + + String url = this.urlForClassInformation + "/select?" + "q=" + field + ":*" + + URLEncoder.encode("\"" + keyword + "\"") + "&rows=100"; + + String resultString = invokeHTTPMethod(url,bearerToken); + + Gson gson = new Gson(); + ClassTypes r = gson.fromJson(resultString, ClassTypes.class); + for (ClassType concept : r.getResult()) { + + if (checkWhetherIndividualsAreAvailable(concept,bearerToken)) { + + Entity entity = new Entity(); + entity.setConceptSource(ConceptSource.ONTOLOGICAL); + entity.setLanguage(inputParameterdetectMeaningLanguageSpecific.getLanguage()); + entity.setUrl(concept.getUri()); + if (concept.getLabel().get(prefixLanguage)!= null) { + entity.setTranslatedURL(concept.getLabel().get(prefixLanguage)); + entity.setTranslationLabelWasAvailable(true); + } + else { + entity.setTranslatedURL(concept.getLabel().get(Language.getDefaultLanguageID())); + entity.setTranslationLabelWasAvailable(false); + } + entity.setHidden(false); + result.add(entity); + + synchronizeTaxonomyCache(concept.getUri(), concept); + } + } + + // + + return result; + } + + private boolean checkWhetherIndividualsAreAvailable(ClassType concept, String bearerToken) { + // TODO Auto-generated method stub -- + String url = urlForItemInformation + "/select?fq=commodityClassficationUri:" + + URLEncoder.encode("\"" + concept.getUri() + "\"") + "&rows=1"; + String response = invokeHTTPMethod(url,bearerToken); + // System.out.println(response); + Gson gson = new Gson(); + SOLRResult result = gson.fromJson(response, SOLRResult.class); + if (result.getResult() != null && result.getResult().size() > 0) { + return true; + } + return false; + } + + /** + * This method creates the grapg based view for the explorative search. The + * depth can be defined. + * + * @param paramterForGetLogicalView + * @param bearerToken + * @return a logical view + */ + public String getLogicalView(InputParamterForGetLogicalView paramterForGetLogicalView, String bearerToken) { + + OutputForGetLogicalView outputStructure = new OutputForGetLogicalView(); + LocalOntologyView completeStructure = new LocalOntologyView(); + eu.nimble.service.catalog.search.impl.dao.Entity concept = new eu.nimble.service.catalog.search.impl.dao.Entity(); + concept.setUrl(paramterForGetLogicalView.getConcept()); + + boolean shallThePropertyCacheUpdated = !propertyInformationCache + .isConceptAlreadyContained(paramterForGetLogicalView.getConcept()); + + String url = urlForClassInformation + "?uri=" + URLEncoder.encode(paramterForGetLogicalView.getConcept()); + String resultString = invokeHTTPMethod(url,bearerToken); + Gson gson = new Gson(); + ClassType r = gson.fromJson(resultString, ClassType.class); + String prefixLanguage = Language.toOntologyPostfix(paramterForGetLogicalView.getLanguageAsLanguage()) + .replaceAll("@", ""); + + concept.setUrl(paramterForGetLogicalView.getConcept()); + if (r != null) { + concept.setTranslatedURL(r.getLabel().get(prefixLanguage)); + } else { + concept.setTranslatedURL(paramterForGetLogicalView.getConcept()); + } + concept.setLanguage(paramterForGetLogicalView.getLanguageAsLanguage()); + completeStructure.setConcept(concept); + + List uriPath = new ArrayList(); + uriPath.add(concept.getUrl()); + completeStructure.setConceptURIPath(uriPath); + + List allPropertyTypes = new ArrayList(); + + if (shallThePropertyCacheUpdated) { + + requestAllPropertiesFromDifferentSources(paramterForGetLogicalView, completeStructure, concept, gson, r, + prefixLanguage, allPropertyTypes,bearerToken); + + } else { + Logger.getAnonymousLogger().log(Level.INFO, "Use the cached properties instead of asking them again: " + + paramterForGetLogicalView.getConcept()); + List allProps = propertyInformationCache + .getAllCachedPropertiesForAConcept(paramterForGetLogicalView.getConcept()); + allProps.forEach(pType -> addDetailsToProperty(completeStructure, concept, prefixLanguage, pType.getUri(), + pType, pType.getConceptSource())); + } + + outputStructure.setCompleteStructure(completeStructure); + LocalOntologyView structureForView = completeStructure.getVisibleLocalOntologyViewStructure(); + outputStructure.setViewStructure(structureForView); + outputStructure.setCurrentSelections(paramterForGetLogicalView.getCurrentSelections()); + + String result = gson.toJson(outputStructure); + return result; + + } + + private void requestAllPropertiesFromDifferentSources(InputParamterForGetLogicalView paramterForGetLogicalView, + LocalOntologyView completeStructure, eu.nimble.service.catalog.search.impl.dao.Entity concept, Gson gson, + ClassType r, String prefixLanguage, List allPropertyTypes, String bearerToken) { + if (r != null && r.getProperties() != null) { + + for (String propertyURL : r.getProperties()) { + + boolean relevant = checkWhetherPropertyIsRelevant(propertyURL, paramterForGetLogicalView.getConcept(),bearerToken); + if (relevant) { + eu.nimble.service.catalog.search.impl.dao.PropertyType propertyType = requestPropertyInfos(gson, + propertyURL, bearerToken); + if (propertyType.isVisible()) { + allPropertyTypes.add(propertyType); + propertyType.setConceptSource(ConceptSource.ONTOLOGICAL); + addDetailsToProperty(completeStructure, concept, prefixLanguage, propertyURL, propertyType, + ConceptSource.ONTOLOGICAL); + } + } + } + } + + List propInfosUBL = requestStandardPropertiesFromUBL(bearerToken); + for (PropertyType propertyType : propInfosUBL) { + String propertyURL = propertyType.getUri(); + boolean relevant = checkWhetherPropertyIsRelevant(propertyURL, paramterForGetLogicalView.getConcept(),bearerToken); + if (propertyType.isVisible() && relevant) { + allPropertyTypes.add(propertyType); + propertyType.setConceptSource(ConceptSource.CUSTOM); + addDetailsToProperty(completeStructure, concept, prefixLanguage, propertyType.getUri(), propertyType, + ConceptSource.CUSTOM); + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "UBL specifc property is marked as not visible or has no property values in the catalogie: " + + propertyURL); + } + + } + + List propInfosStandard = requestStandardPropertiesFromUnknownSopurce(); + for (PropertyType propertyType : propInfosStandard) { + boolean relevant = checkWhetherPropertyIsRelevant(propertyType.getUri(), paramterForGetLogicalView.getConcept(),bearerToken); + + if (propertyType.isVisible() &&relevant) { + allPropertyTypes.add(propertyType); + propertyType.setConceptSource(ConceptSource.CUSTOM); + addDetailsToProperty(completeStructure, concept, prefixLanguage, propertyType.getUri(), propertyType, + ConceptSource.CUSTOM); + } + } + + // store The Property Types in the cache. + if (!propertyInformationCache.isConceptAlreadyContained(paramterForGetLogicalView.getConcept())) { + propertyInformationCache.addConcept(paramterForGetLogicalView.getConcept(), allPropertyTypes); + } + } + + public boolean checkWhetherPropertyIsRelevant(String propertyURL, String conceptURL, String bearerToken) { + + + if (indexFieldCache.isPropertyRelevanceInfoContained(conceptURL, propertyURL)) { + return indexFieldCache.isPropertyRelevanceGiven(conceptURL, propertyURL); + } else { + String nameField = indexFieldCache.getIndexFieldForAnyKindOfProperty(propertyURL); + // Happens if no fieldname mapping is available + if (nameField == null) { + return false; + } + + String url = urlForItemInformation + "/select?" + determineRelevantConcepts(conceptURL, false); + if (propertyURL.contains(this.namespace)){ + url+= "&fq=" + nameField + FIND_ANY_VALUE+ "&rows=1"; + } + else{ + + url+= "&fq=" + nameField + FIND_ANY_VALUE + + "&facet.field==" + nameField + "&rows=1"; + } + String response = invokeHTTPMethod(url,bearerToken); + + // System.out.println(response); + Gson gson = new Gson(); + SOLRResult result = null; + try{ + result = gson.fromJson(response, SOLRResult.class); + + } + catch(Exception e){ + Logger.getAnonymousLogger().log(Level.SEVERE, "HTTPGET failed: " + url); + Logger.getAnonymousLogger().log(Level.SEVERE, e.getMessage()); + e.printStackTrace(); + } + + if (result == null || result.getResult().size() == 0 ) { + url = urlForItemInformation + "/select?" + determineRelevantConcepts(conceptURL, true); + if (propertyURL.contains(this.namespace)){ + url+= "&fq=" + nameField + FIND_ANY_VALUE+ "&rows=1"; + } + else{ + + url+= "&fq=" + nameField + FIND_ANY_VALUE + + "&facet.field==" + nameField + "&rows=1"; + } + response = invokeHTTPMethod(url,bearerToken); + + // System.out.println(response); + gson = new Gson(); + try{ + result = gson.fromJson(response, SOLRResult.class); + } + catch(Exception e){ + Logger.getAnonymousLogger().log(Level.SEVERE, "HTTPGET failed: " + url); + Logger.getAnonymousLogger().log(Level.SEVERE, e.getMessage()); + e.printStackTrace(); + } + } + + if (result != null && result.getResult().size() == 1 ) { + + + PropertyRelevance propertyRelevance = new PropertyRelevance(); + propertyRelevance.setHasItBeenChecked(true); + propertyRelevance.setItRelevant(true); + propertyRelevance.setLastCheck(new Date()); + indexFieldCache.addProopertyRelevance(conceptURL, propertyURL, propertyRelevance); + + + return true; + } else { + PropertyRelevance propertyRelevance = new PropertyRelevance(); + propertyRelevance.setHasItBeenChecked(true); + propertyRelevance.setItRelevant(false); + propertyRelevance.setLastCheck(new Date()); + indexFieldCache.addProopertyRelevance(conceptURL, propertyURL, propertyRelevance); + + return false; + } + } + + } + + private void addDetailsToProperty(LocalOntologyView completeStructure, + eu.nimble.service.catalog.search.impl.dao.Entity concept, String prefixLanguage, String propertyURL, + eu.nimble.service.catalog.search.impl.dao.PropertyType propertyType, ConceptSource conceptSource) { + eu.nimble.service.catalog.search.impl.dao.Entity entity = new eu.nimble.service.catalog.search.impl.dao.Entity(); + entity.setUrl(propertyURL); + entity.setConceptSource(conceptSource); + entity.setTranslatedURL(propertyType.getLabel().get(prefixLanguage)); + if (isItADatatypeProperty(propertyType)) { + completeStructure.addDataproperties(entity); + } else { + LocalOntologyView localOntologyView2 = new LocalOntologyView(); + + eu.nimble.service.catalog.search.impl.dao.Entity conceptRange = new eu.nimble.service.catalog.search.impl.dao.Entity(); + conceptRange.setUrl(propertyType.getRange()); + conceptRange.setTranslatedURL(entity.getTranslatedURL()); + // conceptRan + + localOntologyView2.setConcept(conceptRange); + localOntologyView2.setObjectPropertySource(entity.getUrl()); + localOntologyView2.setFrozenConcept(concept.getUrl()); + localOntologyView2.setDistanceToFrozenConcept(1); + List newPaht = new ArrayList(completeStructure.getConceptURIPath()); + newPaht.add(propertyType.getRange()); + localOntologyView2.setConceptURIPath(newPaht); + completeStructure.getObjectproperties().put(propertyType.getRange(), localOntologyView2); + } + } + + private eu.nimble.service.catalog.search.impl.dao.PropertyType requestPropertyInfos(Gson gson, String propertyURL, String bearerToken) { + + if (!propertyURL.contains(namespace) && (!propertyURL.contains(nameSPACEUBL))) { + + String url; + eu.nimble.service.catalog.search.impl.dao.PropertyType propertyType = null; + url = urlForPropertyInformation + "?uri=" + URLEncoder.encode(propertyURL); + String propertyInfo = invokeHTTPMethod(url,bearerToken); + try { + propertyType = gson.fromJson(propertyInfo, + eu.nimble.service.catalog.search.impl.dao.PropertyType.class); + } catch (Exception e) { + Logger.getAnonymousLogger().log(Level.WARNING, + "There is no propertyInfos available for: " + propertyURL + "URL: " + url); + } + return propertyType; + } + return null; + } + + private boolean isItADatatypeProperty(eu.nimble.service.catalog.search.impl.dao.PropertyType propertyType) { + if (propertyType.getRange().contains(HTTP_WWW_W3_ORG_2001_XML_SCHEMA)) { + return true; + } + return false; + } + + public List getAllDifferentValuesForAProperty(String conceptURL, String propertyURL, String bearerToken) { + Gson gson = new Gson(); + List allValues = new ArrayList(); + eu.nimble.service.catalog.search.impl.dao.PropertyType propertyType = requestPropertyInfosFromCache(conceptURL, + propertyURL); + + if (propertyType != null) { + String url = urlForItemInformation + "/select?" + determineRelevantConcepts(conceptURL, false); + + if (indexFieldCache.isIndexFieldInfoContained(propertyURL)) { + String fieldName = indexFieldCache.getIndexFieldForAOntologicalProperty(propertyURL); + url += "&fq=" + fieldName + ":[*%20TO%20*]&facet.field=" + fieldName; + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "Found no index field dliverd by /index/item/fields: " + propertyURL); + } + url += "&rows=10000"; + String items = invokeHTTPMethod(url,bearerToken); + JSONObject jsonObject = new JSONObject(items); + JSONArray results = null; + try{ + results = jsonObject.getJSONArray("result"); + } + catch (Exception e) { + // TODO: handle exception + } + if (results == null || results.length() == 0) { + url = urlForItemInformation + "/select?" + determineRelevantConcepts(conceptURL, true); + + if (indexFieldCache.isIndexFieldInfoContained(propertyURL)) { + String fieldName = indexFieldCache.getIndexFieldForAOntologicalProperty(propertyURL); + url += "&fq=" + fieldName + ":[*%20TO%20*]&facet.field=" + fieldName; + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "Found no index field dliverd by /index/item/fields: " + propertyURL); + } + url += "&rows=10000"; + items = invokeHTTPMethod(url,bearerToken); + jsonObject = new JSONObject(items); + results = jsonObject.getJSONArray("result"); + } + + if (results != null && results.length() > 0) { + for (String fieldName : propertyType.getItemFieldNames()) { + for (int i = 0; i < results.length(); i++) { + JSONObject ob = (JSONObject) results.get(i); + extractValuesOfAFieldName(allValues, fieldName, ob); + } + } + if (allValues.isEmpty()) { + gson = new Gson(); + SOLRResult result = gson.fromJson(items, SOLRResult.class); + for (eu.nimble.service.catalog.search.impl.dao.item.ItemType itemType : result.getResult()) { + + // I have to decide which kind of proepty it is. Each + // kind needs + // an one extraction process + PropertyType pType = propertyInformationCache.getPropertyTypeForASingleProperty(conceptURL, + propertyURL); + + if (pType != null) { + + if (pType.getConceptSource().equals(ConceptSource.ONTOLOGICAL)) { + boolean contained = false; + String value = ""; + if (itemType.getBooleanValue() != null + && itemType.getBooleanValueDirect().containsKey(propertyURL)) { + contained = true; + value = String.valueOf(itemType.getBooleanValueDirect().get(propertyURL)); + } + + if (itemType.getDoubleValue() != null + && itemType.getDoubleValueDirect().containsKey(propertyURL)) { + contained = true; + value = String.valueOf(itemType.getDoubleValueDirect().get(propertyURL)); + } + + if (itemType.getStringValue() != null + && itemType.getStringValueDirect().containsKey(propertyURL)) { + contained = true; + Collection valuesInDifferentLangauges = itemType.getStringValueDirect() + .get(propertyURL); + // TODO need to be chnaged + Language chosenLangauge = Language.ENGLISH; + String lPrefix = "@" + LanguageAdapter.createPrefix(chosenLangauge); + Iterator iterator = valuesInDifferentLangauges.iterator(); + boolean found = false; + String anyValue = null; + while (iterator.hasNext()) { + String v = iterator.next(); + if (anyValue == null) { + anyValue = v; + } + value = v.replace(lPrefix, ""); + allRelevantPropertyValuesForLanguageCompletion.put(value, v); + found = true; + } + if (!found) { + value = anyValue; + } + // value = + // String.valueOf(itemType.getStringValueDirect().get(propertyURL)); + } + + if (contained) { + if (!allValues.contains(value)) { + allValues.add(value); + } + } + + } + } + } + } + // propertyType.getItemFieldNames()? + return allValues; + } else { + Logger.getAnonymousLogger().log(Level.WARNING, "Cannot get property values from: " + propertyURL); + return Collections.EMPTY_LIST; + } + } else { + Logger.getAnonymousLogger().log(Level.WARNING, "Cannot get property type from: " + propertyURL); + return Collections.EMPTY_LIST; + + } + + } + + private String determineRelevantConcepts(String conceptURL, boolean onlyConcept) { + + List children = taxonomyCache.getAllChildrenConcepts(conceptURL); + if (onlyConcept) { + children.clear(); + } + children.add(conceptURL); + + String result = "fq=commodityClassficationUri:"; + if (children.size() > 1) { + result += "%28"; + } + for (int i = 0; i < children.size(); i++) { + + result += URLEncoder.encode("\"" + children.get(i) + "\""); + if (i < children.size() - 1) { + result += "%20OR%20"; + } + } + if (children.size() > 1) { + result += "%29"; + } + + return result; + } + + private PropertyType requestPropertyInfosFromCache(String conceptURL, String propertyURL) { + if (propertyInformationCache.isConceptAlreadyContained(conceptURL)) { + return propertyInformationCache.getPropertyTypeForASingleProperty(conceptURL, propertyURL); + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "getDifferentValues has been executed before getLogicalView/getProperties. Is not valid"); + } + return null; + } + + private void extractValuesOfAFieldName(List allValues, String fieldName, JSONObject ob) { + if (ob.has(fieldName)) { + Object targetValue = ob.get(fieldName); + if (targetValue instanceof JSONObject) { + JSONObject elment = (JSONObject) targetValue; + if (elment.keySet().size() == 1) { + elment.keys().forEachRemaining(x -> { + String v = elment.get(x).toString(); + if (!allValues.contains(v)) { + allValues.add(v); + } + }); + + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "More than one key. what is the default key fpr the value:" + fieldName); + } + } + if (targetValue instanceof String) { + String v = String.valueOf(targetValue); + if (!allValues.contains(v)) { + allValues.add(v); + } + } + + if (targetValue instanceof Integer) { + String v = String.valueOf(targetValue); + if (!allValues.contains(v)) { + allValues.add(v); + } + } + + if (targetValue instanceof Float) { + String v = String.valueOf(targetValue); + if (!allValues.contains(v)) { + allValues.add(v); + } + } + if (targetValue instanceof Double) { + String v = String.valueOf(targetValue); + if (!allValues.contains(v)) { + allValues.add(v); + } + } + if (targetValue instanceof Boolean) { + String v = String.valueOf(targetValue); + if (!allValues.contains(v)) { + allValues.add(v); + } + } + + } + } + + /** + * This method is used to request all property vlaues for a given product + * (individual/catalogue item). The name is a relict from the ontology + * driven solution + * + * @param inputParamaterForExecuteOptionalSelect + * @return {@link OutputForExecuteSelect} + */ + public OutputForExecuteSelect createOPtionalSPARQLAndExecuteIT( + InputParamaterForExecuteOptionalSelect inputParamaterForExecuteOptionalSelect, String bearerToken) { + String uri = inputParamaterForExecuteOptionalSelect.getUuid(); + String url = urlForItemInformation + "/select?fq=uri:" + uri; + OutputForExecuteSelect result = new OutputForExecuteSelect(); + // result.setInput(inputParamaterForExecuteOptionalSelect); + result.getUuids().add(inputParamaterForExecuteOptionalSelect.getUuid()); + String response = invokeHTTPMethod(url, bearerToken); + Gson gson = new Gson(); + SOLRResult responseObject = gson.fromJson(response, SOLRResult.class); + JSONObject jsonObject = new JSONObject(response); + JSONArray results = jsonObject.getJSONArray("result"); + Map>> intermediateResult = new HashMap>>(); + List allProps = new ArrayList(); + if (results != null) { + + // Have to define the header information. It is based on standrad, + // ubl and common result + allProps.addAll(propertyInformationCache.getAllStandardProps()); + allProps.addAll(propertyInformationCache.getAllUBLSpeciifcProperties()); + // have to collect ontological property + ItemType itemType = responseObject.getResult().get(0); + for (String key : itemType.getBooleanValueDirect().keySet()) { + PropertyType pType = propertyInformationCache.getPropertyTypeForASingleProperty(key); + allProps.add(pType); + } + for (String key : itemType.getDoubleValueDirect().keySet()) { + PropertyType pType = propertyInformationCache.getPropertyTypeForASingleProperty(key); + allProps.add(pType); + } + for (String key : itemType.getStringValueDirect().keySet()) { + PropertyType pType = propertyInformationCache.getPropertyTypeForASingleProperty(key); + allProps.add(pType); + } + + // Create intermediate result + columns list + for (PropertyType property : allProps) { + if (property == null) { + continue; + } + List> r = new ArrayList>(); + intermediateResult.put(property, r); + Language lang = inputParamaterForExecuteOptionalSelect.getLanguage(); + if (lang != null && !(lang.equals(Language.UNKNOWN))) { + String currentLabel = getLanguageLabel(property, + inputParamaterForExecuteOptionalSelect.getLanguage()); + result.getColumns().add(currentLabel); + } else { + String currentLabel = getLanguageLabel(property, Language.ENGLISH); + result.getColumns().add(currentLabel); + } + } + + for (int i = 0; i < results.length(); i++) { + JSONObject ob = (JSONObject) results.get(i); + updateCacheForFieldNames(ob,bearerToken); + + for (String fieldName : ob.keySet()) { + if (propertyInformationCache.isNameFieldAlreadyContained(fieldName)) { + PropertyType propertyType = propertyInformationCache.getPropertyTypeForANameField(fieldName); + + boolean isContained = false; + if (propertyType != null) { + for (PropertyType p : intermediateResult.keySet()) { + if (p.equals(propertyType)) { + isContained = true; + } + } + } + + if (isContained) { + + List allValues = new ArrayList(); + extractValuesOfAFieldName(allValues, fieldName, ob); + intermediateResult.get(propertyType).add(allValues); + + // result.getRows().add((ArrayList) + // allValues); + + } + + } else { + if (((fieldName.equals("stringValue")) || (fieldName.equals("doubleValue")) + || (fieldName.equals("booleanValue")))) { + // have to extract ontological properties TODO + // Logger.getAnonymousLogger().log(Level.INFO, + // "Ontological propperty not supported yet..."); + } + } + } + + // use the Java object to get access to the ontological + // properties. It just simplier that using JSON + ItemType item = responseObject.getResult().get(i); + for (String key : item.getStringValueDirect().keySet()) { + PropertyType pType = propertyInformationCache.getPropertyTypeForASingleProperty(key); + if (pType != null) { + + Collection valuesInDifferentLangauges = itemType.getStringValueDirect() + .get(pType.getUri()); + Language chosenLangauge = inputParamaterForExecuteOptionalSelect.getLanguage(); + String lPrefix = "@" + LanguageAdapter.createPrefix(chosenLangauge); + Iterator iterator = valuesInDifferentLangauges.iterator(); + boolean found = true; + String anyValue = null; + String value = null; + while (iterator.hasNext()) { + String v = iterator.next(); + if (anyValue == null) { + anyValue = v.substring(0, v.indexOf("@")); + } + if (v.contains(lPrefix)) { + value = v.replace(lPrefix, ""); + + } + } + if (value == null) { + value = anyValue; + } + + Collection values = item.getStringValueDirect().get(pType.getUri()); + List list = new ArrayList(); + list.add(value); + intermediateResult.get(pType).add(list); + } + + } + for (String key : item.getDoubleValueDirect().keySet()) { + PropertyType pType = propertyInformationCache.getPropertyTypeForASingleProperty(key); + if (pType != null) { + Collection values = item.getDoubleValueDirect().get(pType.getUri()); + List list = new ArrayList(values); + intermediateResult.get(pType).add(list); + } + + } + + for (String key : item.getBooleanValueDirect().keySet()) { + PropertyType pType = propertyInformationCache.getPropertyTypeForASingleProperty(key); + if (pType != null) { + Boolean values = item.getBooleanValueDirect().get(pType.getUri()); + List list = new ArrayList(); + list.add(String.valueOf(values)); + intermediateResult.get(pType).add(list); + } + } + + } + + } else { + Logger.getAnonymousLogger().log(Level.WARNING, "Cannot get property values from: " + uri); + } + + if (intermediateResult.size() > 0) { + PropertyType firstProperty = intermediateResult.keySet().iterator().next(); + int resultSize = 1; + + for (int i = 0; i < resultSize; i++) { + ArrayList oneRow = new ArrayList(); + result.getRows().add(oneRow); + for (PropertyType property : allProps) { + if (property != null) { + if (intermediateResult.get(property).size() > i) { + oneRow.add(intermediateResult.get(property).get(i).toString()); + } else { + oneRow.add(N_ULL); + } + } + // result.getRows().add(oneRow); + } + } + + } + return result; + } + + private void updateCacheForFieldNames(JSONObject ob, String bearerToken) { + JSONArray conceptURIArray = ob.getJSONArray("classificationUri"); + conceptURIArray.forEach(x -> { + String conceptURL = (String) x; + if (!propertyInformationCache.isConceptAlreadyContained(conceptURL)) { + getAllPropertiesIncludingEverything(conceptURL,bearerToken); + } + }); + } + + private String getLanguageLabel(PropertyType propertyType, Language language) { + String prefixLanguage = Language.toOntologyPostfix(language).replaceAll("@", ""); + String label = propertyType.getLabel().get(prefixLanguage); + if (label != null) { + return label; + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "Found no language label for: " + propertyType.getUri() + " for language: " + language); + return propertyType.getLocalName(); + } + } + + /** + * This method returns all mappable fieldNames which can be used to filter a + * product with specific property values + * + * @return + */ + public List getAllMappableFields() { + List result = new ArrayList(); + String url = urlForItemInformation + "/fields"; + String respoonse = invokeHTTPMethod(url, null); + Gson gson = new Gson(); + List r = gson.fromJson(respoonse, List.class); + // System.out.println(r); + if (r != null) { + result.addAll(r); + } + return result; + + } + + public OutputForExecuteSelect createSPARQLAndExecuteIT( + InputParamaterForExecuteSelect inputParamaterForExecuteSelect, String bearerToken) { + // TODO Auto-generated method stub + /** + * http://nimble-staging.salzburgresearch.at/index/item/select?fq=commodityClassficationUri:%22http://www.aidimme.es/FurnitureSectorOntology.owl%23Product%22&fq=localName:540*&fq=price:* + * e + */ + String url = urlForItemInformation + "/select?" + + determineRelevantConcepts(inputParamaterForExecuteSelect.getConcept(), false); + // String url = urlForItemInformation + + // "/select?fq=commodityClassficationUri:" + // + URLEncoder.encode("\"" + + // inputParamaterForExecuteSelect.getConcept() + "\""); + String query = "&q="; + // I have to adapt to existing propoerties + for (String propertyURL : inputParamaterForExecuteSelect.getParametersURL()) { + String fieldName = indexFieldCache.getIndexFieldForAnyKindOfProperty(propertyURL); + IndexFields current = indexFieldCache.getIndexFieldForAnyKindOfPropertyAsIndexFields(propertyURL); + if (current != null && current.isASingleFieldNameToBeConsidered()) { + String filterValue = determineFQValue(propertyURL, inputParamaterForExecuteSelect.getFilters(), + current.getDataType()); + url += "&fq=" + fieldName + filterValue; + } else { + String filterValue = determineFQValue(propertyURL, inputParamaterForExecuteSelect.getFilters(), + current.getDataType()); + if (query.length() > 5) { + query += "AND"; + } + query += "(" + determineORString(current, filterValue) + ")"; + } + } + + if (query.length() > 4) { + url += query; + } + String response = invokeHTTPMethod(url,bearerToken); + // System.out.println(response); + Gson gson = new Gson(); + SOLRResult result = gson.fromJson(response, SOLRResult.class); + + if (result.getResult() == null || result.getResult().size() == 0) { + url = urlForItemInformation + "/select?" + + determineRelevantConcepts(inputParamaterForExecuteSelect.getConcept(), true); + // String url = urlForItemInformation + + // "/select?fq=commodityClassficationUri:" + // + URLEncoder.encode("\"" + + // inputParamaterForExecuteSelect.getConcept() + "\""); + query = "&q="; + // I have to adapt to existing propoerties + for (String propertyURL : inputParamaterForExecuteSelect.getParametersURL()) { + String fieldName = indexFieldCache.getIndexFieldForAnyKindOfProperty(propertyURL); + IndexFields current = indexFieldCache.getIndexFieldForAnyKindOfPropertyAsIndexFields(propertyURL); + if (current != null && current.isASingleFieldNameToBeConsidered()) { + String filterValue = determineFQValue(propertyURL, inputParamaterForExecuteSelect.getFilters(), + current.getDataType()); + url += "&fq=" + fieldName + filterValue; + } else { + String filterValue = determineFQValue(propertyURL, inputParamaterForExecuteSelect.getFilters(), + current.getDataType()); + if (query.length() > 5) { + query += "AND"; + } + query += "(" + determineORString(current, filterValue) + ")"; + } + } + + if (query.length() > 4) { + url += query; + } + response = invokeHTTPMethod(url,bearerToken); + // System.out.println(response); + gson = new Gson(); + result = gson.fromJson(response, SOLRResult.class); + } + + List columns = new ArrayList(); + columns.addAll(inputParamaterForExecuteSelect.getParameters()); + OutputForExecuteSelect outputForExecuteSelect = new OutputForExecuteSelect(); + + outputForExecuteSelect.setColumns(columns); + outputForExecuteSelect.setInput(inputParamaterForExecuteSelect); + List> rows = new ArrayList>(); + outputForExecuteSelect.setRows(rows); + int index = 0; + for (eu.nimble.service.catalog.search.impl.dao.item.ItemType itemType : result.getResult()) { + outputForExecuteSelect.getUuids().add(itemType.getUri()); + ArrayList row = new ArrayList(); + rows.add(row); + for (String propertyURL : inputParamaterForExecuteSelect.getParametersURL()) { + + // I have to decide which kind of proepty it is. Each kind needs + // an one extraction process + PropertyType pType = propertyInformationCache + .getPropertyTypeForASingleProperty(inputParamaterForExecuteSelect.getConcept(), propertyURL); + + if (pType != null) { + + if (pType.getConceptSource().equals(ConceptSource.ONTOLOGICAL)) { + boolean contained = false; + String value = ""; + if (itemType.getBooleanValue() != null + && itemType.getBooleanValueDirect().containsKey(propertyURL)) { + contained = true; + value = String.valueOf(itemType.getBooleanValueDirect().get(propertyURL)); + } + + if (itemType.getDoubleValue() != null + && itemType.getDoubleValueDirect().containsKey(propertyURL)) { + contained = true; + value = String.valueOf(itemType.getDoubleValueDirect().get(propertyURL)); + } + + if (itemType.getStringValue() != null + && itemType.getStringValueDirect().containsKey(propertyURL)) { + contained = true; + Collection valuesInDifferentLangauges = itemType.getStringValueDirect() + .get(propertyURL); + Language chosenLangauge = inputParamaterForExecuteSelect.getLanguage(); + String lPrefix = "@" + LanguageAdapter.createPrefix(chosenLangauge); + Iterator iterator = valuesInDifferentLangauges.iterator(); + boolean found = false; + String anyValue = null; + while (iterator.hasNext()) { + String v = iterator.next(); + if (anyValue == null) { + anyValue = v.substring(0, v.indexOf("@")); + } + if (v.contains(lPrefix)) { + value = v.replace(lPrefix, ""); + found = true; + } + } + if (!found) { + value = anyValue; + } + // value = + // String.valueOf(itemType.getStringValueDirect().get(propertyURL)); + } + + if (itemType.getCustomProperties() != null + && itemType.getCustomProperties().containsKey(propertyURL)) { + contained = true; + value = String.valueOf(itemType.getCustomProperties().get(propertyURL)); + } + + if (contained) { + row.add(value); + } else { + Logger.getAnonymousLogger().log(Level.SEVERE, + "found no value for requested property: " + propertyURL); + row.add(N_ULL); + } + } else { + // Custom Properties using extractionMethod + List allValues = new ArrayList(); + Iterator iterator = pType.getItemFieldNames().iterator(); + while (iterator.hasNext()) { + String fieldName = (String) iterator.next(); + + JSONObject jsonObject = new JSONObject(response); + JSONArray results = jsonObject.getJSONArray("result"); + if (results != null) { + + JSONObject ob = (JSONObject) results.get(index); + extractValuesOfAFieldName(allValues, fieldName, ob); + + } + + } + if (allValues.size() > 0) { + row.add(allValues.get(0)); + } else { + Logger.getAnonymousLogger().log(Level.WARNING, "Found no value for: " + pType.getUri()); + row.add(N_ULL); + } + } + + } + + } + index++; + + } + return outputForExecuteSelect; + } + + private String determineORString(IndexFields current, String filterValue) { + String result = ""; + for (int i = 0; i < current.getDifferentFieldNames().size(); i++) { + result += current.getDifferentFieldNames().get(i) + filterValue; + + if (i < current.getDifferentFieldNames().size() - 1) { + result += "%20OR%20"; + } + } + + return result; + + } + + private String determineFQValue(String propertyURL, List filters, String dataType) { + + String result = ":"; + for (Filter filter : filters) { + if (filter.getProperty().equals(propertyURL)) { + + if (filter.getExactValue() != null && filter.getExactValue().length() > 0) { + if (dataType.toLowerCase().contains("string")) { + + String rightValue = filter.getExactValue(); + if (allRelevantPropertyValuesForLanguageCompletion.containsKey(rightValue)) { + rightValue = allRelevantPropertyValuesForLanguageCompletion.get(rightValue); + } + result += URLEncoder.encode("\"" + rightValue + "\""); + result += ""; + return result; + } else { + result += URLEncoder.encode(filter.getExactValue()); + result += ""; + return result; + } + } else { + result = "[" + filter.getMin() + "%20TO%20" + filter.getMax() + "]"; + return result; + } + } + } + + return FIND_ANY_VALUE; + } + + public OutputForPropertiesFromConcept getAllTransitiveProperties(String conceptURL, Language language, String bearerToken) { + + OutputForPropertiesFromConcept result = new OutputForPropertiesFromConcept(); + String prefixLanguage = Language.toOntologyPostfix(language).replaceAll("@", ""); + + List properties = getAllPropertiesIncludingEverything(conceptURL,bearerToken); + for (String urlOfProperty : properties) { + PropertyType propertyType = propertyInformationCache.getPropertyTypeForASingleProperty(conceptURL, + urlOfProperty); + OutputForPropertyFromConcept outputForPropertyFromConcept = new OutputForPropertyFromConcept(); + outputForPropertyFromConcept.setPropertyURL(urlOfProperty); + if (propertyType.getLabel() != null) { + String label = propertyType.getLabel().get(prefixLanguage); + if (label == null) { + if (propertyType.getLabel().containsKey(LanguageAdapter.getEnglishPrefix())) { + label = propertyType.getLabel().get(LanguageAdapter.getEnglishPrefix()); + } + } + outputForPropertyFromConcept.setTranslatedProperty(label); + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + prefixLanguage + "Found no translation for: " + urlOfProperty); + String label = urlOfProperty.substring(urlOfProperty.indexOf("#") + 1); + outputForPropertyFromConcept.setTranslatedProperty(label); + + } + outputForPropertyFromConcept.setPropertySource(PropertySource.DOMAIN_SPECIFIC_PROPERTY); + if (propertyType.getRange().contains(HTTP_WWW_W3_ORG_2001_XML_SCHEMA)) { + outputForPropertyFromConcept.setDatatypeProperty(true); + outputForPropertyFromConcept.setObjectProperty(false); + } else { + outputForPropertyFromConcept.setDatatypeProperty(false); + outputForPropertyFromConcept.setObjectProperty(true); + } + result.getOutputForPropertiesFromConcept().add(outputForPropertyFromConcept); + } + + return result; + + } + + public Map> generateGroup(int amountOfGroups, String conceptURL, String propertyURL, + Language language, String bearerToken) { + + String prefixLanguage = Language.toOntologyPostfix(language).replaceAll("@", ""); + PropertyType propertyType = propertyInformationCache.getPropertyTypeForASingleProperty(conceptURL, propertyURL); + + String shortPropertyName = propertyType.getLabel().get(prefixLanguage); + + List values = getAllDifferentValuesForAProperty(conceptURL, propertyURL,bearerToken); + for (int i = 0; i < values.size(); i++) { + String str = values.get(i); + int index = str.lastIndexOf("^"); + if (index > -1) { + str = str.substring(0, index - 1); + } + str = str.replace(",", "."); + values.set(i, str); + } + if (values != null && values.size() > 0) { + try { + ValueGroupingFactory valueGroupingFactory = new ValueGroupingFactory(); + return valueGroupingFactory.generateGrouping(amountOfGroups, values, shortPropertyName); + + } catch (Exception e) { + Logger.getAnonymousLogger().log(Level.WARNING, + "Cannot transform data from " + propertyURL + " into floats"); + } + } else { + return new HashMap>(); + } + return new HashMap>(); + } + + public List getSupportedLanguages(String bearerToken) { + // TODO Auto-generated method stub + List allProps = requestStandardPropertiesFromUBL(bearerToken); + + //choose another source for detetcting the languages + if (allProps == null || allProps.size()==0){ + List langs = indexFieldCache.detectLanguagesNyIndexFields(); + List allSupportedLanguages = new ArrayList<>(); + for (Language language: langs){ + String r = Language.toOntologyPostfix(language); + if (r != null){ + r = r.substring(1); + } + allSupportedLanguages.add(r); + } + return allSupportedLanguages; + + } + + List allSupportedLanguages = new ArrayList<>(); + for (PropertyType pType : allProps) { + pType.getLabel().keySet().forEach(x -> { + if (!allSupportedLanguages.contains(String.valueOf(x))) { + allSupportedLanguages.add(x); + } + }); + } + return allSupportedLanguages; + } + + public List getAllObjectPropertiesIncludingEverythingAndReturnItsRange( + InputParameterForGetReferencesFromAConcept inputParameterForGetReferencesFromAConcept, String bearerToken) { + // TODO Auto-generated method stub + return null; + } + + public TranslationResult translateProperty(String value, Language language, String languageLabel) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/LanguageAdapter.java b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/LanguageAdapter.java new file mode 100644 index 0000000..13ae93f --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/LanguageAdapter.java @@ -0,0 +1,33 @@ +package eu.nimble.service.catalog.search.impl.Indexing; + +import de.biba.triple.store.access.enums.Language; + +public class LanguageAdapter { + + private static final String EN = "en"; + + + public static String createPrefix(Language language){ + + if(language==null){ + return getEnglishPrefix(); + } + + if (language.equals(Language.ENGLISH)){ + return EN; + } + if (language.equals(Language.GERMAN)){ + return "de"; + } + if (language.equals(Language.SPANISH)){ + return "es"; + } + return EN; + } + + + public static String getEnglishPrefix(){ + return EN; + } + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/PropertyInformationCache.java b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/PropertyInformationCache.java new file mode 100644 index 0000000..e6260e2 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/PropertyInformationCache.java @@ -0,0 +1,167 @@ +package eu.nimble.service.catalog.search.impl.Indexing; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +import eu.nimble.service.catalog.search.impl.dao.PropertyType; + +public class PropertyInformationCache extends IndexingServiceConstant { + + private static final String REQUESTED_PROPS_WHICH_ARE_NOT_IN_THE_CACHE = "Requested props which are not in the cache"; + private Map> cachedProeprtiesPerConceptURI = new HashMap>(); + private Map cachedPropertiesPerNamefield = new HashMap(); + private List allStandardProps = new ArrayList(); + private List allUBLSpeciifcProperties = new ArrayList(); + private Map allPropertytype = new HashMap(); + + public boolean isConceptAlreadyContained(String conceptUri) { + return cachedProeprtiesPerConceptURI.containsKey(conceptUri); + } + + public void addConcept(String concept, List properties) { + cachedProeprtiesPerConceptURI.put(concept, properties); + + //Store it in the overall propertyMap + properties.forEach( x-> allPropertytype.put(x.getUri(), x)); + + //Store it in the standard propoerties + properties.forEach( x-> { + if (x.getUri().contains(namespace)){ + boolean canBeAdded = true; + for (PropertyType ptype: allStandardProps){ + if (ptype.getItemFieldNames().equals(x.getItemFieldNames())){ + canBeAdded = false; + break; + } + } + if (canBeAdded){ + allStandardProps.add(x); + } + } + }); + + + //Store it in the ubl propoerties + properties.forEach( x-> { + if (x.getUri().contains(nameSPACEUBL)){ + boolean canBeAdded = true; + for (PropertyType ptype: allUBLSpeciifcProperties){ + if (ptype.getItemFieldNames().equals(x.getItemFieldNames())){ + canBeAdded = false; + break; + } + } + if (canBeAdded){ + allUBLSpeciifcProperties.add(x); + } + } + }); + + for (PropertyType propertyType : properties) { + if (propertyType != null && propertyType.getItemFieldNames() != null) { + propertyType.getItemFieldNames().forEach(x -> { + if (x != null) { + cachedPropertiesPerNamefield.put(x, propertyType); + } + }); + } else { + if (propertyType != null) { + Logger.getAnonymousLogger().log(Level.WARNING, + "There is no fieldnames for: " + propertyType.getUri()); + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "There is no property information available for: " + concept); + } + + } + } + + } + + public List getAllStandardProps() { + if (allStandardProps.size()==0){ + Logger.getAnonymousLogger().log(Level.WARNING, REQUESTED_PROPS_WHICH_ARE_NOT_IN_THE_CACHE); + } + return allStandardProps; + } + + public void setAllStandardProps(List allStandardProps) { + + this.allStandardProps.clear(); + this.allStandardProps.addAll(allStandardProps); + } + + public List getAllUBLSpeciifcProperties() { + if (allUBLSpeciifcProperties.size()==0){ + Logger.getAnonymousLogger().log(Level.WARNING, REQUESTED_PROPS_WHICH_ARE_NOT_IN_THE_CACHE); + } + return allUBLSpeciifcProperties; + } + + public void setAllUBLSpeciifcProperties(List allUBLSpeciifcProperties) { + this.allUBLSpeciifcProperties.clear(); + this.allUBLSpeciifcProperties.addAll(allUBLSpeciifcProperties); + } + + public boolean isNameFieldAlreadyContained(String nameField) { + return cachedPropertiesPerNamefield.containsKey(nameField); + } + + public PropertyType getPropertyTypeForANameField(String nameField) { + return cachedPropertiesPerNamefield.get(nameField); + } + + public PropertyType getPropertyTypeForASingleProperty(String conceptURL, String propertyURL) { + List r = getAllCachedPropertiesForAConcept(conceptURL); + List filteredResult = r.stream().filter(x -> x.getUri().equals(propertyURL)) + .collect(Collectors.toList()); + if (filteredResult != null && filteredResult.size() > 0) { + return filteredResult.get(0); + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "Expect to find the property: " + propertyURL + " for the concept: " + conceptURL); + ; + return null; + } + } + + + public PropertyType getPropertyTypeForASingleProperty( String propertyURL) { + PropertyType result = allPropertytype.get(propertyURL); + if (result != null) { + return result; + } else { + Logger.getAnonymousLogger().log(Level.WARNING, + "Expect to find the property: " + propertyURL + " for any the concept: "); + ; + return null; + } + } + + + public List getAllCachedPropertiesForAConcept(String conceptURL) { + List result = new ArrayList(); + if (cachedProeprtiesPerConceptURI.containsKey(conceptURL)) { + cachedProeprtiesPerConceptURI.get(conceptURL).forEach(x -> result.add(x)); + } + + return result; + } + + + + + + @Override + public String toString() { + return "PropertyInformationCache [cachedProeprtiesPerConceptURI=" + cachedProeprtiesPerConceptURI + + ", cachedPropertiesPerNamefield=" + cachedPropertiesPerNamefield + ", allStandardProps=" + + allStandardProps + ", allUBLSpeciifcProperties=" + allUBLSpeciifcProperties + "]"; + } + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/TaxonomyCache.java b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/TaxonomyCache.java new file mode 100644 index 0000000..f145a1f --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/Indexing/TaxonomyCache.java @@ -0,0 +1,67 @@ +package eu.nimble.service.catalog.search.impl.Indexing; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class TaxonomyCache { + + private Map> cacheUPPerConceptURL = new HashMap>(); + private Map> cacheDownPerConceptURL = new HashMap>(); + + + public void addAllSubConcepts(String conceptURL, List children){ + + List copy = new ArrayList(); + copy.addAll(children); + + cacheDownPerConceptURL.put(conceptURL, copy); + } + + public void addAllUpperConcepts(String conceptURL, List parents){ + + + List copy = new ArrayList(); + copy.addAll(parents); + + cacheUPPerConceptURL.put(conceptURL, copy); + } + + + /** + * Returns all children to a given concept + * @param conceptURL the unique uel of a cocnept/category + * @return in any case a list. If there is no result it returns an empty list + */ + public List getAllChildrenConcepts(String conceptURL){ + List result = new ArrayList(); + if (cacheDownPerConceptURL.containsKey(conceptURL)){ + result.addAll(cacheDownPerConceptURL.get(conceptURL)); + } + else{ + Logger.getAnonymousLogger().log(Level.WARNING, "Concept is not part of the Taxonomy Cache"); + } + return result; + } + + + /** + * Returns all parents to a given concept + * @param conCeptURL the unique uel of a cocnept/category + * @return in any case a list. If there is no result it returns an empty list + */ + public List getAllParentsConcepts(String conceptURL){ + List result = new ArrayList(); + if (cacheUPPerConceptURL.containsKey(conceptURL)){ + result.addAll(cacheUPPerConceptURL.get(conceptURL)); + } + else{ + Logger.getAnonymousLogger().log(Level.WARNING, "Concept is not part of the Taxonomy Cache"); + } + return result; + } + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/SOLRAccess/EntityMappingService.java b/src/main/java/eu/nimble/service/catalog/search/impl/SOLRAccess/EntityMappingService.java index 5498332..e7b0b91 100644 --- a/src/main/java/eu/nimble/service/catalog/search/impl/SOLRAccess/EntityMappingService.java +++ b/src/main/java/eu/nimble/service/catalog/search/impl/SOLRAccess/EntityMappingService.java @@ -1,13 +1,20 @@ package eu.nimble.service.catalog.search.impl.SOLRAccess; -import java.util.logging.Level; -import java.util.logging.Logger; + public class EntityMappingService { - public String mapPropertyURIToFieldName(String proeprtyUI){ - Logger.getAnonymousLogger().log(Level.WARNING, "No entity mapping available. Return URI: " + proeprtyUI); - return proeprtyUI; + private SOLRReader solrReader = null; + + + + public EntityMappingService(SOLRReader solrReader) { + super(); + this.solrReader = solrReader; + } + + public String mapPropertyURIToFieldName(String propertyUrl, String conceptURL){ + return solrReader.getNameForIdxField(propertyUrl, conceptURL); } public boolean isAPropertySpecificField(String column) { @@ -15,9 +22,8 @@ public boolean isAPropertySpecificField(String column) { return column.contains("lmf.")?false:true; } - public String mapFieldNameToProperty(String fieldName){ - Logger.getAnonymousLogger().log(Level.WARNING, "No entity mapping available. Return URI: " + fieldName); - return fieldName; + public String mapFieldNameToProperty(String propertyUrl, String conceptURL){ + return solrReader.getPropertyURLBasedOnIdxField(propertyUrl, conceptURL); } diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/SOLRAccess/SOLRReader.java b/src/main/java/eu/nimble/service/catalog/search/impl/SOLRAccess/SOLRReader.java index 3b7517e..efc8890 100644 --- a/src/main/java/eu/nimble/service/catalog/search/impl/SOLRAccess/SOLRReader.java +++ b/src/main/java/eu/nimble/service/catalog/search/impl/SOLRAccess/SOLRReader.java @@ -47,6 +47,7 @@ public class SOLRReader implements IReader { + private static final String FIELD_FOR_IDX_FIELD = "idxField"; private static final String LMF_URI = "lmf.uri"; private static final String FIELD_FOR_PROPERTY_URI = LMF_URI; private HttpSolrClient client = null; @@ -59,6 +60,7 @@ public class SOLRReader implements IReader { private final String labelFieldForSpanish = "label_es"; private final String labelFieldForEnglish = "label_en"; private final String labelFieldForGerman = "label_de"; + private final String labelFieldForDefaultCase = "label"; private EntityMappingService entityMappingService; @@ -97,10 +99,11 @@ public void init() { clientForIntensionalQueriesProperties = new HttpSolrClient(urlForIntensionalQueriesProperties, httpClient); clientForIntensionalQueriesConcepts = new HttpSolrClient(urlForIntensionalQueriesConcepts, httpClient); - entityMappingService = new EntityMappingService(); + entityMappingService = new EntityMappingService(this); } - public Map createKeyValueOfAllPropertiesFromResultList(Object resultSet, Language language) { + public Map createKeyValueOfAllPropertiesFromResultList(String conceptURL, Object resultSet, + Language language) { QueryResponse response = (QueryResponse) resultSet; SolrDocumentList results = response.getResults(); Map valueMap = new HashMap(); @@ -109,7 +112,7 @@ public Map createKeyValueOfAllPropertiesFromResultList(Object re Collection columns = solrDocument.getFieldNames(); for (String column : columns) { if (entityMappingService.isAPropertySpecificField(column)) { - String propertyURI = entityMappingService.mapFieldNameToProperty(column); + String propertyURI = entityMappingService.mapFieldNameToProperty(column, conceptURL); String propertyTranslated = translateProperty(propertyURI, language); valueMap.put(propertyURI, String.valueOf(solrDocument.getFieldValue(column))); } @@ -234,10 +237,23 @@ public Object query(String arg0, String field, String... filter) { public Object queryIntensionalProperties(String arg0) { SolrQuery query = new SolrQuery(); query.setQuery(arg0); - // query.addFilterQuery("cat:electronics","store:amazon.com"); query.setFields("*"); query.setStart(0); - // query.set("defType", "edismax"); + try { + QueryResponse response = clientForIntensionalQueriesProperties.query(query); + return response; + } catch (Exception e) { + Logger.getAnonymousLogger().log(Level.WARNING, e.getMessage()); + } + return null; + } + + public Object queryIntensionalProperties(String arg0, int maxResultAmount) { + SolrQuery query = new SolrQuery(); + query.setQuery(arg0); + query.setFields("*"); + query.setStart(0); + query.setRows(maxResultAmount); try { QueryResponse response = clientForIntensionalQueriesProperties.query(query); return response; @@ -486,6 +502,20 @@ public List getAllPropertiesIncludingEverything(String arg0) { return propertyURLS; } + public String getNameForIdxField(String propertyUrl, String conceptURL) { + String query = ""; + if (conceptURL != null) { + query = "class: " + "\"" + conceptURL + "\"" + " And " + FIELD_FOR_PROPERTY_URI + " : \"" + propertyUrl + + "\""; + } else { + query = FIELD_FOR_PROPERTY_URI + " : \"" + propertyUrl + "\""; + } + Object response = queryIntensionalProperties(query); + List indexFields = createResultList(response, FIELD_FOR_IDX_FIELD); + + return indexFields.size() > 0 ? indexFields.get(0) : null; + } + @Override public List getAllPropertiesIncludingEverythingWhichHasValues(String arg0) { // TODO Auto-generated method stub @@ -555,21 +585,21 @@ public List getLabelFromAElement(String arg0) { public List getNativeSupportedLangauges() { List languges = new ArrayList(); String query = labelFieldForEnglish + ":*"; - Object response = queryIntensionalProperties(query); + Object response = queryIntensionalProperties(query, 1); List result = createResultList(response, "id"); if (result.size() > 0) { languges.add(Language.ENGLISH); } query = labelFieldForGerman + ":*"; - response = queryIntensionalProperties(query); + response = queryIntensionalProperties(query, 1); result = createResultList(response, "id"); if (result.size() > 0) { languges.add(Language.GERMAN); } query = labelFieldForSpanish + ":*"; - response = queryIntensionalProperties(query); + response = queryIntensionalProperties(query, 1); result = createResultList(response, "id"); if (result.size() > 0) { languges.add(Language.SPANISH); @@ -635,14 +665,14 @@ public Map getPropertyValuesOfAIndividium(String uuid) { // TODO Auto-generated method stub String query = LMF_URI + ":" + uuid; Object resposne = query(query); - return createKeyValueOfAllPropertiesFromResultList(resposne, Language.ENGLISH); + return createKeyValueOfAllPropertiesFromResultList(null, resposne, Language.ENGLISH); } public Map getPropertyValuesOfAIndividium(String uuid, Language language) { // TODO Auto-generated method stub String query = LMF_URI + ":" + "\"" + uuid + "\""; Object resposne = query(query); - return createKeyValueOfAllPropertiesFromResultList(resposne, language); + return createKeyValueOfAllPropertiesFromResultList(null, resposne, language); } @Override @@ -795,7 +825,7 @@ private String deriveFieldFromLanguage(Language language) { default: Logger.getAnonymousLogger().log(Level.WARNING, "Received no language information. Use the English translation"); - queryPrefix = labelFieldForEnglish; + queryPrefix = labelFieldForDefaultCase; break; } @@ -810,14 +840,14 @@ public List getAllValuesForAGivenProperty(String concept, String propert "No connection or item_commodity_classification_uri doesn't exists. Try without concept binding"); response = query("*:*"); } - property = entityMappingService.mapPropertyURIToFieldName(property); + property = entityMappingService.mapPropertyURIToFieldName(property, concept); List values = createResultList(response, property); return values; } public OutputForExecuteSelect createSPARQLAndExecuteIT( InputParamaterForExecuteSelect inputParamaterForExecuteSelect) { - EntityMappingService entityMappingService = new EntityMappingService(); + EntityMappingService entityMappingService = new EntityMappingService(this); String concept = inputParamaterForExecuteSelect.getConcept(); String query = "item_commodity_classification_uri:" + "\"" + concept + "\""; if (concept.equals("*")) { @@ -828,7 +858,7 @@ public OutputForExecuteSelect createSPARQLAndExecuteIT( for (eu.nimble.service.catalog.search.impl.dao.Filter filter : inputParamaterForExecuteSelect.getFilters()) { if ((filter.getExactValue() != null) && (filter.getExactValue().length() > 0)) { String proeprtyUI = filter.getProperty(); - fq += " " + entityMappingService.mapPropertyURIToFieldName(proeprtyUI); + fq += " " + entityMappingService.mapPropertyURIToFieldName(proeprtyUI, concept); fq += " : "; fq += filter.getExactValue(); } @@ -836,20 +866,20 @@ public OutputForExecuteSelect createSPARQLAndExecuteIT( if (filter.isHasMaxBeenSet() && filter.isHasMinBeenSet()) { String proeprtyUI = filter.getProperty(); - fq += " " + entityMappingService.mapPropertyURIToFieldName(proeprtyUI); + fq += " " + entityMappingService.mapPropertyURIToFieldName(proeprtyUI, concept); fq += " : "; // min max proeprtyUI = filter.getProperty(); - fq += " +" + entityMappingService.mapPropertyURIToFieldName(proeprtyUI); + fq += " +" + entityMappingService.mapPropertyURIToFieldName(proeprtyUI, concept); fq += " : "; fq += "[" + filter.getMinAsInt() + " TO " + filter.getMaxAsInt() + "]"; } else { String proeprtyUI = filter.getProperty(); - fq += " " + entityMappingService.mapPropertyURIToFieldName(proeprtyUI); + fq += " " + entityMappingService.mapPropertyURIToFieldName(proeprtyUI, concept); fq += " : "; if (filter.isHasMaxBeenSet()) { @@ -868,7 +898,7 @@ public OutputForExecuteSelect createSPARQLAndExecuteIT( String fl = ""; for (String uri : inputParamaterForExecuteSelect.getParametersURL()) { - fl += entityMappingService.mapPropertyURIToFieldName(uri) + " , "; + fl += entityMappingService.mapPropertyURIToFieldName(uri, concept) + " , "; } ; if (fl.length() > 2) { @@ -878,7 +908,7 @@ public OutputForExecuteSelect createSPARQLAndExecuteIT( String[] columns = new String[inputParamaterForExecuteSelect.getParametersURL().size() + 1]; int index = 0; for (String uri : inputParamaterForExecuteSelect.getParametersURL()) { - String field = entityMappingService.mapPropertyURIToFieldName(uri); + String field = entityMappingService.mapPropertyURIToFieldName(uri, concept); columns[index] = field; index++; } @@ -1050,4 +1080,19 @@ public OutputForPropertyValuesFromOrangeGroup getPropertyValuesFromOrangeGroup( // TODO Auto-generated method stub return new OutputForPropertyValuesFromOrangeGroup(); } + + public String getPropertyURLBasedOnIdxField(String fieldName, String conceptURL) { + String query = ""; + + if (conceptURL != null) { + query = "class: " + "\"" + conceptURL + "\"" + " And " + FIELD_FOR_IDX_FIELD + " : \"" + fieldName + "\""; + } else { + query = FIELD_FOR_IDX_FIELD + " : \"" + fieldName + "\""; + } + Object response = queryIntensionalProperties(query); + List indexFields = createResultList(response, FIELD_FOR_PROPERTY_URI); + + return indexFields.size() > 0 ? indexFields.get(0) : null; + + } } diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/SearchController.java b/src/main/java/eu/nimble/service/catalog/search/impl/SearchController.java index 4adf41a..b06b2f2 100644 --- a/src/main/java/eu/nimble/service/catalog/search/impl/SearchController.java +++ b/src/main/java/eu/nimble/service/catalog/search/impl/SearchController.java @@ -12,6 +12,7 @@ import javax.annotation.PostConstruct; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpStatus; @@ -19,6 +20,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; @@ -28,10 +30,14 @@ import de.biba.triple.store.access.dmo.Entity; import de.biba.triple.store.access.enums.Language; import de.biba.triple.store.access.enums.PropertyType; +import eu.nimble.service.catalog.search.clients.IdentityClient; +import eu.nimble.service.catalog.search.impl.Indexing.IndexingServiceReader; import eu.nimble.service.catalog.search.impl.SOLRAccess.SOLRReader; import eu.nimble.service.catalog.search.impl.dao.Group; import eu.nimble.service.catalog.search.impl.dao.HybridConfiguration; import eu.nimble.service.catalog.search.impl.dao.LocalOntologyView; +import eu.nimble.service.catalog.search.impl.dao.PartType; +import eu.nimble.service.catalog.search.impl.dao.SearchConfig; import eu.nimble.service.catalog.search.impl.dao.enums.PropertySource; import eu.nimble.service.catalog.search.impl.dao.enums.TypeOfDataSource; import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteOptionalSelect; @@ -54,14 +60,16 @@ import eu.nimble.service.catalog.search.impl.dao.output.OutputForSQPFromOrangeGroup; import eu.nimble.service.catalog.search.impl.dao.output.Reference; import eu.nimble.service.catalog.search.impl.dao.output.TranslationResult; -import eu.nimble.service.catalog.search.mediator.MediatorEntryPoint; -import eu.nimble.service.catalog.search.mediator.MediatorSPARQLDerivationAndExecution; +//import eu.nimble.service.catalog.search.mediator.MediatorEntryPoint; +//import eu.nimble.service.catalog.search.mediator.MediatorSPARQLDerivationAndExecution; import eu.nimble.service.catalog.search.services.NimbleAdaptionServiceOfSearchResults; import eu.nimble.service.catalog.search.services.SQPDerivationService; @Controller public class SearchController { + private static final String INDEX = "index"; + private static final org.slf4j.Logger logger = LoggerFactory.getLogger(SearchController.class); private static final String NULL_ASSIGNED_VALUE = "null"; @@ -69,32 +77,45 @@ public class SearchController { @Value("${nimble.shared.property.config.d:C:/Resources/NIMBLE/config.xml}") private String generalConfigurationPath; - @Value("${nimble.shared.property.ontologyfile:null}") - private String ontologyFile; +// @Value("${nimble.shared.property.ontologyfile:null}") +// private String ontologyFile; - @Value("${nimble.shared.property.marmottauri:null}") - private String marmottaUri; - +// @Value("${nimble.shared.property.marmottauri:null}") +// private String marmottaUri; + + //http://nimble-dev.ikap.biba.uni-bremen.de:9101/ + @Value("${nimble.shared.property.indexingserviceuri:http://nimble-staging.salzburgresearch.at/index/}") + //@Value("${nimble.shared.property.indexingserviceuri:http://nimble-dev.ikap.biba.uni-bremen.de/index/}") + private String indexingserviceuri; + private String orginial; @Value("${nimble.shared.property.useSOLRIndex:false}") private boolean useSOLRIndex; - + + @Value("${nimble.shared.property.useIndexingService:true}") + private boolean useIndexingService; + @Value("${nimble.shared.property.useSimplifiedSPARQL:true}") private boolean useSimplifiedSPARQL; @Value("${nimble.shared.property.languagelabel:http://www.aidimme.es/FurnitureSectorOntology.owl#translation}") private String languageLabel; - + @Value("${nimble.shared.property.catalogue.search.configuration:./src/main/resources/sqpConfiguration.xml}") private String sqpConfigurationPath; - + @Value("${nimble.shared.property.hybridConfiguration}") private String hybridConfiguration; - private MediatorSPARQLDerivationAndExecution sparqlDerivation = null; + //private MediatorSPARQLDerivationAndExecution sparqlDerivation = null; private SQPDerivationService sQPDerivationService = null; - //private NimbleAdaptionServiceOfSearchResults nimbleAdaptionServiceOfSearchResults = null; - private SOLRReader solrReader = null; + // private NimbleAdaptionServiceOfSearchResults + // nimbleAdaptionServiceOfSearchResults = null; + private SOLRReader solrReader = null; private HybridConfiguration hConfiguration = new HybridConfiguration(); + private IndexingServiceReader indexingServiceReader = null; + + @Autowired + private IdentityClient identityClient; public HybridConfiguration gethConfiguration() { return hConfiguration; @@ -106,75 +127,85 @@ public void sethConfiguration(HybridConfiguration hConfiguration) { @PostConstruct public void init() { + logger.info("Shall indexing service be used: " + useIndexingService); + if (useIndexingService) { + //indexingserviceuri = "http://nimble-dev.ikap.biba.uni-bremen.de/index/"; + logger.info("Initializing with indexingServiceUri:" + indexingserviceuri); + orginial = indexingserviceuri; - logger.info("Initializing with marmottaUri: {}, languageLabel: {}, sqpConfigurationPath: {}", - marmottaUri, languageLabel, sqpConfigurationPath); - - if ((ontologyFile == null ||ontologyFile.equals(NULL_ASSIGNED_VALUE)) && (marmottaUri == null || marmottaUri.equals(NULL_ASSIGNED_VALUE))) { - sparqlDerivation = new MediatorSPARQLDerivationAndExecution(); - if (useSOLRIndex){ - - if (marmottaUri == null || marmottaUri.equals(NULL_ASSIGNED_VALUE)){ - this.solrReader = new SOLRReader(); - } - else{ - String prefix = ""; - char lastCharacter = marmottaUri.charAt(marmottaUri.length()-1); - if (lastCharacter!= '/'){ - prefix = "/"; - } - - String url = marmottaUri + prefix + "solr/" + "catalogue2"; - String urlForIntensionalQueriesProperties = marmottaUri + prefix + "solr/"+ "properties"; - String urlForIntensionalQueriesConcepts = marmottaUri + prefix + "solr/"+ "catalogue2"; - this.solrReader = new SOLRReader(url, urlForIntensionalQueriesProperties, urlForIntensionalQueriesConcepts); - } - - } + + indexingServiceReader = new IndexingServiceReader(indexingserviceuri); } else { +// logger.info("Initializing with marmottaUri: {}, languageLabel: {}, sqpConfigurationPath: {}", marmottaUri, +// languageLabel, sqpConfigurationPath); +// +// if ((ontologyFile == null || ontologyFile.equals(NULL_ASSIGNED_VALUE)) +// && (marmottaUri == null || marmottaUri.equals(NULL_ASSIGNED_VALUE))) { +// //sparqlDerivation = new MediatorSPARQLDerivationAndExecution(); +// if (useSOLRIndex) { +// +// if (marmottaUri == null || marmottaUri.equals(NULL_ASSIGNED_VALUE)) { +// this.solrReader = new SOLRReader(); +// } else { +// String prefix = ""; +// char lastCharacter = marmottaUri.charAt(marmottaUri.length() - 1); +// if (lastCharacter != '/') { +// prefix = "/"; +// } +// +// String url = marmottaUri + prefix + "solr/" + "catalogue2"; +// String urlForIntensionalQueriesProperties = marmottaUri + prefix + "solr/" + "properties"; +// String urlForIntensionalQueriesConcepts = marmottaUri + prefix + "solr/" + "catalogue2"; +// this.solrReader = new SOLRReader(url, urlForIntensionalQueriesProperties, +// urlForIntensionalQueriesConcepts); +// } +// +// } +// } else { +// +// if (!ontologyFile.equals(NULL_ASSIGNED_VALUE)) { +// +// File f = new File(ontologyFile); +// if (f.exists()) { +// Logger.getAnonymousLogger().log(Level.INFO, "Load defined ontology file: " + ontologyFile); +// //sparqlDerivation = new MediatorSPARQLDerivationAndExecution(ontologyFile); +// } else { +// Logger.getAnonymousLogger().log(Level.WARNING, +// " CANNOT load defined ontology file: " + ontologyFile); +//// Logger.getAnonymousLogger().log(Level.INFO, +//// "Load STANDARD ontology file: " + MediatorSPARQLDerivationAndExecution.FURNITURE2_OWL); +//// sparqlDerivation = new MediatorSPARQLDerivationAndExecution(); +// } +// } else { +// //sparqlDerivation = new MediatorSPARQLDerivationAndExecution(marmottaUri, true, +// // sQPDerivationService); +// } +// } + //sparqlDerivation.setLanguagelabel(languageLabel); + //sQPDerivationService = new SQPDerivationService(sparqlDerivation, sqpConfigurationPath); + //sparqlDerivation.updatesqpDerivationService(sQPDerivationService); - if (!ontologyFile.equals(NULL_ASSIGNED_VALUE)) { +// if (useSOLRIndex && this.solrReader == null) { +// +// if (marmottaUri == null || marmottaUri.equals(NULL_ASSIGNED_VALUE)) { +// this.solrReader = new SOLRReader(); +// } else { +// String prefix = ""; +// char lastCharacter = marmottaUri.charAt(marmottaUri.length() - 1); +// if (lastCharacter != '/') { +// prefix = "/"; +// } +// +// String url = marmottaUri + prefix + "solr/" + "catalogue2"; +// String urlForIntensionalQueriesProperties = marmottaUri + prefix + "solr/" + "properties"; +// String urlForIntensionalQueriesConcepts = marmottaUri + prefix + "solr/" + "catalogue2"; +// this.solrReader = new SOLRReader(url, urlForIntensionalQueriesProperties, +// urlForIntensionalQueriesConcepts); +// } +// } - File f = new File(ontologyFile); - if (f.exists()) { - Logger.getAnonymousLogger().log(Level.INFO, "Load defined ontology file: " + ontologyFile); - sparqlDerivation = new MediatorSPARQLDerivationAndExecution(ontologyFile); - } else { - Logger.getAnonymousLogger().log(Level.WARNING, - " CANNOT load defined ontology file: " + ontologyFile); - Logger.getAnonymousLogger().log(Level.INFO, - "Load STANDARD ontology file: " + MediatorSPARQLDerivationAndExecution.FURNITURE2_OWL); - sparqlDerivation = new MediatorSPARQLDerivationAndExecution(); - } - } else { - sparqlDerivation = new MediatorSPARQLDerivationAndExecution(marmottaUri, true,sQPDerivationService); - } - } - sparqlDerivation.setLanguagelabel(languageLabel); - sQPDerivationService = new SQPDerivationService(sparqlDerivation, sqpConfigurationPath); - sparqlDerivation.updatesqpDerivationService(sQPDerivationService); - - if (useSOLRIndex && this.solrReader==null){ - - if (marmottaUri == null || marmottaUri.equals(NULL_ASSIGNED_VALUE)){ - this.solrReader = new SOLRReader(); - } - else{ - String prefix = ""; - char lastCharacter = marmottaUri.charAt(marmottaUri.length()-1); - if (lastCharacter!= '/'){ - prefix = "/"; - } - - String url = marmottaUri + prefix + "solr/" + "catalogue2"; - String urlForIntensionalQueriesProperties = marmottaUri + prefix + "solr/"+ "properties"; - String urlForIntensionalQueriesConcepts = marmottaUri + prefix + "solr/"+ "catalogue2"; - this.solrReader = new SOLRReader(url, urlForIntensionalQueriesProperties, urlForIntensionalQueriesConcepts); - } + hConfiguration = createConfigurationBasedOnEnvVariable(hybridConfiguration); } - - hConfiguration = createConfigurationBasedOnEnvVariable(hybridConfiguration); - } @@ -187,67 +218,63 @@ public void setSolrReader(SOLRReader solrReader) { } private HybridConfiguration createConfigurationBasedOnEnvVariable(String hybridConfiguration2) { - if (hybridConfiguration2!= null){ - String[] allSOLRSources = hybridConfiguration2.split(","); - HybridConfiguration conf = new HybridConfiguration(); - for (int i =0; i < allSOLRSources.length; i++){ - allSOLRSources[i] = allSOLRSources[i].replaceAll(" ", ""); - setSpecificMethodsToSOLR(allSOLRSources, conf, i); - } - return conf; - } - else{ + if (hybridConfiguration2 != null) { + String[] allSOLRSources = hybridConfiguration2.split(","); + HybridConfiguration conf = new HybridConfiguration(); + for (int i = 0; i < allSOLRSources.length; i++) { + allSOLRSources[i] = allSOLRSources[i].replaceAll(" ", ""); + setSpecificMethodsToSOLR(allSOLRSources, conf, i); + } + return conf; + } else { return new HybridConfiguration(); } - - + } -/** - * Based on variables of HybridConfiguration - * detectMeaningLanguageSpecific = "MARMOTTA"; - executeSPARQLWithOptionalSelect = "MARMOTTA"; - executeSPARQLSelect = "MARMOTTA"; - getPropertyValuesDiscretised = "MARMOTTA"; - getReferencesFromAConcept = "MARMOTTA"; - getPropertyValuesFromGreenGroup = "MARMOTTA"; - getPropertyValuesFromOrangeGroup = "MARMOTTA"; - getLogicalView = "MARMOTTA"; - getPropertyFromConcept = "MARMOTTA"; - getInstantiatedPropertiesFromConcept = "MARMOTTA"; - - * @param allSOLRSources - * @param conf - * @param i - */ + + /** + * Based on variables of HybridConfiguration detectMeaningLanguageSpecific = + * "MARMOTTA"; executeSPARQLWithOptionalSelect = "MARMOTTA"; + * executeSPARQLSelect = "MARMOTTA"; getPropertyValuesDiscretised = + * "MARMOTTA"; getReferencesFromAConcept = "MARMOTTA"; + * getPropertyValuesFromGreenGroup = "MARMOTTA"; + * getPropertyValuesFromOrangeGroup = "MARMOTTA"; getLogicalView = + * "MARMOTTA"; getPropertyFromConcept = "MARMOTTA"; + * getInstantiatedPropertiesFromConcept = "MARMOTTA"; + * + * @param allSOLRSources + * @param conf + * @param i + */ private void setSpecificMethodsToSOLR(String[] allSOLRSources, HybridConfiguration conf, int i) { - if (allSOLRSources[i].equals("detectMeaningLanguageSpecific")){ + if (allSOLRSources[i].equals("detectMeaningLanguageSpecific")) { conf.setDetectMeaningLanguageSpecific("SOLR"); } - if (allSOLRSources[i].equals("executeSPARQLWithOptionalSelect")){ + if (allSOLRSources[i].equals("executeSPARQLWithOptionalSelect")) { conf.setExecuteSPARQLWithOptionalSelect("SOLR"); } - if (allSOLRSources[i].equals("executeSPARQLSelect")){ + if (allSOLRSources[i].equals("executeSPARQLSelect")) { conf.setExecuteSPARQLSelect("SOLR"); } - if (allSOLRSources[i].equals("getPropertyValuesDiscretised")){ + if (allSOLRSources[i].equals("getPropertyValuesDiscretised")) { conf.setGetPropertyValuesDiscretised("SOLR"); } - if (allSOLRSources[i].equals("getReferencesFromAConcept")){ + if (allSOLRSources[i].equals("getReferencesFromAConcept")) { conf.setGetReferencesFromAConcept("SOLR"); } - if (allSOLRSources[i].equals("getPropertyValuesFromGreenGroup")){ + if (allSOLRSources[i].equals("getPropertyValuesFromGreenGroup")) { conf.setGetPropertyValuesFromGreenGroup("SOLR"); } - if (allSOLRSources[i].equals("getPropertyValuesFromOrangeGroup")){ + if (allSOLRSources[i].equals("getPropertyValuesFromOrangeGroup")) { conf.setGetPropertyValuesFromOrangeGroup("SOLR"); } - if (allSOLRSources[i].equals("getLogicalView")){ + if (allSOLRSources[i].equals("getLogicalView")) { conf.setGetLogicalView("SOLR"); } - if (allSOLRSources[i].equals("getPropertyFromConcept")){ + if (allSOLRSources[i].equals("getPropertyFromConcept")) { conf.setGetPropertyFromConcept("SOLR"); } - if (allSOLRSources[i].equals("getInstantiatedPropertiesFromConcept")){ + if (allSOLRSources[i].equals("getInstantiatedPropertiesFromConcept")) { conf.setGetInstantiatedPropertiesFromConcept("SOLR"); } } @@ -260,108 +287,160 @@ public void setSqpConfigurationPath(String sqpConfigurationPath) { this.sqpConfigurationPath = sqpConfigurationPath; } - public String getOntologyFile() { - return ontologyFile; - } - - public void setOntologyFile(String ontologyFile) { - this.ontologyFile = ontologyFile; - } - - @RequestMapping(value = "/query", method = RequestMethod.GET) - HttpEntity query(@RequestParam("query") String query) { - { - Gson gson = new Gson(); - InputParameter parameter = gson.fromJson(query, InputParameter.class); - MediatorEntryPoint service = new MediatorEntryPoint(generalConfigurationPath, parameter); - eu.nimble.service.catalog.search.mediator.datatypes.MediatorResult result = service.query(); - - return new ResponseEntity(result.toOutput(parameter.getTypeOfOutput()), HttpStatus.OK); - } - } +// public String getOntologyFile() { +// return ontologyFile; +// } +// +// public void setOntologyFile(String ontologyFile) { +// this.ontologyFile = ontologyFile; +// } + +// @RequestMapping(value = "/query", method = RequestMethod.GET) +// HttpEntity query(@RequestParam("query") String query) { +// { +// Gson gson = new Gson(); +// InputParameter parameter = gson.fromJson(query, InputParameter.class); +//// MediatorEntryPoint service = new MediatorEntryPoint(generalConfigurationPath, parameter); +//// eu.nimble.service.catalog.search.mediator.datatypes.MediatorResult result = service.query(); +// +// return new ResponseEntity(result.toOutput(parameter.getTypeOfOutput()), HttpStatus.OK); +// } +// } + + + @CrossOrigin @RequestMapping(value = "/test", method = RequestMethod.GET) HttpEntity query() { + { - String result =" Titel

lala

"; - return new ResponseEntity(result, HttpStatus.OK); - } - } - - @CrossOrigin - @Deprecated - @RequestMapping(value = "/detectMeaning", method = RequestMethod.GET) - HttpEntity detectMeaning(@RequestParam("keyword") String keyword) { - try { - List concepts = sparqlDerivation.detectPossibleConcepts(keyword); - MeaningResult meaningResult = new MeaningResult(); - List data = new ArrayList(); - - meaningResult.setConceptOverview(data); - meaningResult.setSearchTyp("ExplorativeSearch"); - - for (String concept : concepts) { - int index = -1; - if (index == -1) { - index = concept.indexOf("#"); - } - if (index == -1) { - index = concept.lastIndexOf("/"); - } - index++; - String concept2 = concept.substring(index); - - eu.nimble.service.catalog.search.impl.dao.Entity entity = new eu.nimble.service.catalog.search.impl.dao.Entity(); - entity.setLanguage(Language.UNKNOWN); - entity.setUrl(concept); - entity.setTranslatedURL(concept2); - data.add(entity); - - } - + SearchConfig config = new SearchConfig(); + config.setIndexingActive(useIndexingService); + config.setUrlOfIOndexingService(indexingserviceuri); + config.setUseSOLRIndex(useSOLRIndex); + config.setHybridConfiguration(hybridConfiguration); + //config.setMarmottaUri(marmottaUri); Gson gson = new Gson(); - String result = ""; - result = gson.toJson(meaningResult); - + String result = gson.toJson(config); + + //String result = " Titel

lala

"; return new ResponseEntity(result, HttpStatus.OK); - } catch (Exception e) { - return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } - } +// @CrossOrigin +// @Deprecated +// @RequestMapping(value = "/detectMeaning", method = RequestMethod.GET) +// HttpEntity detectMeaning(@RequestParam("keyword") String keyword) { +// try { +// List concepts = sparqlDerivation.detectPossibleConcepts(keyword); +// MeaningResult meaningResult = new MeaningResult(); +// List data = new ArrayList(); +// +// meaningResult.setConceptOverview(data); +// meaningResult.setSearchTyp("ExplorativeSearch"); +// +// for (String concept : concepts) { +// int index = -1; +// if (index == -1) { +// index = concept.indexOf("#"); +// } +// if (index == -1) { +// index = concept.lastIndexOf("/"); +// } +// index++; +// String concept2 = concept.substring(index); +// +// eu.nimble.service.catalog.search.impl.dao.Entity entity = new eu.nimble.service.catalog.search.impl.dao.Entity(); +// entity.setLanguage(Language.UNKNOWN); +// entity.setUrl(concept); +// entity.setTranslatedURL(concept2); +// data.add(entity); +// +// } +// +// Gson gson = new Gson(); +// String result = ""; +// result = gson.toJson(meaningResult); +// +// return new ResponseEntity(result, HttpStatus.OK); +// } catch (Exception e) { +// return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); +// } +// +// } + @CrossOrigin @RequestMapping(value = "/detectMeaningLanguageSpecific", method = RequestMethod.GET) - HttpEntity detectMeaningLanguageSpecific(@RequestParam("inputAsJson") String inputAsJson) { + HttpEntity detectMeaningLanguageSpecific(@RequestParam("inputAsJson") String inputAsJson,@RequestHeader(value = "Authorization") String bearerToken ) { try { Logger.getAnonymousLogger().log(Level.INFO, "Invoke: detectMeaningLanguageSpecific: " + inputAsJson); Gson gson = new Gson(); + inputAsJson = Language.replaceLanguageStringToOldNamingInJSON(inputAsJson); InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = gson .fromJson(inputAsJson, InputParameterdetectMeaningLanguageSpecific.class); - if (!useSOLRIndex || hConfiguration.getDetectMeaningLanguageSpecific()!=TypeOfDataSource.SOLR){ - List concepts = sparqlDerivation.detectPossibleConceptsLanguageSpecific( - inputParameterdetectMeaningLanguageSpecific.getKeyword(), - inputParameterdetectMeaningLanguageSpecific.getLanguage(),languageLabel,useSimplifiedSPARQL); - MeaningResult meaningResult = new MeaningResult(); - meaningResult.setConceptOverview(concepts); - meaningResult.setSearchTyp("ExplorativeSearch"); - meaningResult.setSource(TypeOfDataSource.MARMOTTA); - - Gson output = new Gson(); - String result = ""; - result = output.toJson(meaningResult); - return new ResponseEntity(result, HttpStatus.OK); + + long userID = inputParameterdetectMeaningLanguageSpecific.getUserID(); + if (userID == 0) { + userID = 1217l; // TODO Remove if UI send usually a userId } - else{ +// Object contextInfos = identityClient.getPerson(userID); +// PartType partype = null; +// if (contextInfos instanceof PartType) { +// partype = (PartType) contextInfos; +// } +// if (contextInfos instanceof String) { +// String content = (String) contextInfos; +// if (((String) content).charAt(0) == '[') { +// content = content.substring(1, content.length() - 1); +// } +// partype = gson.fromJson(content, PartType.class); +// } + + logger.info("Use" + useIndexingService + ": " + indexingserviceuri); + if (useIndexingService) { + List concepts = indexingServiceReader + .detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific, bearerToken); + Gson output = new Gson(); + String result = ""; + MeaningResult meaningResult = new MeaningResult(); - meaningResult.setConceptOverview(solrReader.getAllConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific.getKeyword(), inputParameterdetectMeaningLanguageSpecific.getLanguage())); + meaningResult.setConceptOverview(concepts); meaningResult.setSearchTyp("ExplorativeSearch"); - meaningResult.setSource(TypeOfDataSource.SOLR); - String result = ""; - Gson output = new Gson(); + meaningResult.setSource(TypeOfDataSource.INDEXING_SERVICE); + result = output.toJson(meaningResult); return new ResponseEntity(result, HttpStatus.OK); + + } else { + + if (!useSOLRIndex || hConfiguration.getDetectMeaningLanguageSpecific() != TypeOfDataSource.SOLR) { + + Logger.getAnonymousLogger().log(Level.SEVERE, "Not supported any longer"); + + List concepts = new ArrayList(); + MeaningResult meaningResult = new MeaningResult(); + meaningResult.setConceptOverview(concepts); + meaningResult.setSearchTyp("ExplorativeSearch"); + meaningResult.setSource(TypeOfDataSource.MARMOTTA); + + Gson output = new Gson(); + String result = ""; + result = output.toJson(meaningResult); + return new ResponseEntity(result, HttpStatus.OK); + } else { + MeaningResult meaningResult = new MeaningResult(); + meaningResult.setConceptOverview(solrReader.getAllConceptsLanguageSpecific( + inputParameterdetectMeaningLanguageSpecific.getKeyword(), + inputParameterdetectMeaningLanguageSpecific.getLanguage())); + meaningResult.setSearchTyp("ExplorativeSearch"); + meaningResult.setSource(TypeOfDataSource.SOLR); + String result = ""; + Gson output = new Gson(); + result = output.toJson(meaningResult); + return new ResponseEntity(result, HttpStatus.OK); + } } } catch (Exception e) { @@ -370,6 +449,10 @@ HttpEntity detectMeaningLanguageSpecific(@RequestParam("inputAsJson") St } + + + + /** * Returns from a given concept (must be the unique url) the data properties * and obejctproperties and to each objecproperty a concept in the case the @@ -449,17 +532,36 @@ HttpEntity detectMeaningLanguageSpecific(@RequestParam("inputAsJson") St @CrossOrigin @RequestMapping(value = "/getLogicalView", method = RequestMethod.POST) - HttpEntity getLogicalView(@RequestBody InputParamterForGetLogicalView paramterForGetLogicalView) { + HttpEntity getLogicalView(@RequestBody InputParamterForGetLogicalView paramterForGetLogicalView, @RequestHeader(value = "Authorization") String bearerToken) { try { - String result = helperForLogicalView(paramterForGetLogicalView); + + String result = ""; + if (useIndexingService) { + correctReceivedLanguageTerm(paramterForGetLogicalView); + result = indexingServiceReader.getLogicalView(paramterForGetLogicalView, bearerToken); + } else { + result = helperForLogicalView(paramterForGetLogicalView); + } return new ResponseEntity(result, HttpStatus.OK); } catch (Exception e) { + logger.error(e.getMessage()); return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } } + /** + * The problem arises that the UI send deifferent terms for the chosen language. For English it is "en" or "ENGLISCH" + * @param paramterForGetLogicalView updated within the reference + */ + private void correctReceivedLanguageTerm(InputParamterForGetLogicalView paramterForGetLogicalView) { + + String language = paramterForGetLogicalView.getLanguage(); + language = Language.replaceLanguageStringToOldNamingAsAttribute(language); + paramterForGetLogicalView.setLanguage(language); + } + public String helperForLogicalView(InputParamterForGetLogicalView paramterForGetLogicalView) { Logger.getAnonymousLogger().log(Level.INFO, "Invoke: getLogicalView:."); LocalOntologyView referenceLocalViewRoot = null; @@ -470,14 +572,14 @@ public String helperForLogicalView(InputParamterForGetLogicalView paramterForGet eu.nimble.service.catalog.search.impl.dao.Entity concept = new eu.nimble.service.catalog.search.impl.dao.Entity(); concept.setUrl(paramterForGetLogicalView.getConcept()); - String label =""; - - if (!useSOLRIndex || hConfiguration.getGetLogicalView()!=TypeOfDataSource.SOLR){ - label = sparqlDerivation.translateConcept(paramterForGetLogicalView.getConcept(), - paramterForGetLogicalView.getLanguageAsLanguage(), languageLabel).getTranslation(); - } - else{ - label = solrReader.translateConcept(paramterForGetLogicalView.getConcept(), paramterForGetLogicalView.getLanguageAsLanguage()); + String label = ""; + + if (!useSOLRIndex || hConfiguration.getGetLogicalView() != TypeOfDataSource.SOLR) { + Logger.getAnonymousLogger().log(Level.INFO, "Not supported any longer"); + label = "Not supported"; + } else { + label = solrReader.translateConcept(paramterForGetLogicalView.getConcept(), + paramterForGetLogicalView.getLanguageAsLanguage()); } concept.setTranslatedURL(label); concept.setLanguage(paramterForGetLogicalView.getLanguageAsLanguage()); @@ -533,14 +635,11 @@ public String helperForLogicalView(InputParamterForGetLogicalView paramterForGet for (int i = 0; i < paramterForGetLogicalView.getStepRange(); i++) { for (LocalOntologyView concept2 : allAdressedConcepts.keySet()) { LocalOntologyView view = null; - if (!useSOLRIndex || hConfiguration.getGetLogicalView()!=TypeOfDataSource.SOLR){ - view = sparqlDerivation.getViewForOneStepRange(concept2.getConcept().getUrl(), - concept2, allAdressedConcepts.get(concept2), - Language.fromString(paramterForGetLogicalView.getLanguage())); - } - else{ - view = solrReader.getViewForOneStepRange(concept2.getConcept().getUrl(), - concept2, allAdressedConcepts.get(concept2), + if (!useSOLRIndex || hConfiguration.getGetLogicalView() != TypeOfDataSource.SOLR) { + view = null; + } else { + view = solrReader.getViewForOneStepRange(concept2.getConcept().getUrl(), concept2, + allAdressedConcepts.get(concept2), Language.fromString(paramterForGetLogicalView.getLanguage())); } if (i == 0) { @@ -570,21 +669,24 @@ public String helperForLogicalView(InputParamterForGetLogicalView paramterForGet outputStructure.setCurrentSelections(paramterForGetLogicalView.getCurrentSelections()); // Try to extend the properties to Nimble specific ones -// if (needANimbleSpecificAdapation()) { -// -// List additionalEntitiesViewStrucutre = nimbleAdaptionServiceOfSearchResults -// .getAdditionalPropertiesForAConcept(outputStructure.getViewStructure().getDataproperties()); -// for (Entity entity : additionalEntitiesViewStrucutre) { -// outputStructure.getViewStructure().getDataproperties().add(entity); -// } -// -// List additionalEntitiesViewCompleteStructure = nimbleAdaptionServiceOfSearchResults -// .getAdditionalPropertiesForAConcept(outputStructure.getCompleteStructure().getDataproperties()); -// for (Entity entity : additionalEntitiesViewCompleteStructure) { -// outputStructure.getCompleteStructure().getDataproperties().add(entity); -// } -// -// } + // if (needANimbleSpecificAdapation()) { + // + // List + // additionalEntitiesViewStrucutre = + // nimbleAdaptionServiceOfSearchResults + // .getAdditionalPropertiesForAConcept(outputStructure.getViewStructure().getDataproperties()); + // for (Entity entity : additionalEntitiesViewStrucutre) { + // outputStructure.getViewStructure().getDataproperties().add(entity); + // } + // + // List additionalEntitiesViewCompleteStructure = + // nimbleAdaptionServiceOfSearchResults + // .getAdditionalPropertiesForAConcept(outputStructure.getCompleteStructure().getDataproperties()); + // for (Entity entity : additionalEntitiesViewCompleteStructure) { + // outputStructure.getCompleteStructure().getDataproperties().add(entity); + // } + // + // } String result = gson.toJson(outputStructure); return result; @@ -597,30 +699,30 @@ public String helperForLogicalView(InputParamterForGetLogicalView paramterForGet * The URL of the chosen concept the same as getLogicalView * @return JSON including both groups */ - @CrossOrigin - @RequestMapping(value = "/getSQPFromOrangeGroup", method = RequestMethod.GET) - HttpEntity getSQP(@RequestParam("inputAsJson") String inputAsJson) { - try { - Gson gson = new Gson(); - InputParamterForGetLogicalView inputParamterForGetLogicalView = gson.fromJson(inputAsJson, - InputParamterForGetLogicalView.class); - - String concept = inputParamterForGetLogicalView.getConcept(); - List entries = sQPDerivationService.getListOfAvailableSQPs(concept); - - OutputForSQPFromOrangeGroup outputForSQPFromOrangeGroup = new OutputForSQPFromOrangeGroup(); - outputForSQPFromOrangeGroup.getListOfSQP().addAll(entries); - String result = ""; - result = gson.toJson(outputForSQPFromOrangeGroup); - - return new ResponseEntity(result, HttpStatus.OK); - } - - catch (Exception e) { - return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); - } - - } +// @CrossOrigin +// @RequestMapping(value = "/getSQPFromOrangeGroup", method = RequestMethod.GET) +// HttpEntity getSQP(@RequestParam("inputAsJson") String inputAsJson) { +// try { +// Gson gson = new Gson(); +// InputParamterForGetLogicalView inputParamterForGetLogicalView = gson.fromJson(inputAsJson, +// InputParamterForGetLogicalView.class); +// +// String concept = inputParamterForGetLogicalView.getConcept(); +// List entries = sQPDerivationService.getListOfAvailableSQPs(concept); +// +// OutputForSQPFromOrangeGroup outputForSQPFromOrangeGroup = new OutputForSQPFromOrangeGroup(); +// outputForSQPFromOrangeGroup.getListOfSQP().addAll(entries); +// String result = ""; +// result = gson.toJson(outputForSQPFromOrangeGroup); +// +// return new ResponseEntity(result, HttpStatus.OK); +// } +// +// catch (Exception e) { +// return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); +// } +// +// } /** * Returns the properties of of a cocnept @@ -632,76 +734,86 @@ HttpEntity getSQP(@RequestParam("inputAsJson") String inputAsJson) { */ @CrossOrigin @RequestMapping(value = "/getPropertyFromConcept", method = RequestMethod.GET) - HttpEntity getPropertyFromConcept(@RequestParam("inputAsJson") String inputAsJson) { + HttpEntity getPropertyFromConcept(@RequestParam("inputAsJson") String inputAsJson,@RequestHeader(value = "Authorization") String bearerToken) { try { Gson gson = new Gson(); InputParamterForGetLogicalView inputParamterForGetLogicalView = gson.fromJson(inputAsJson, InputParamterForGetLogicalView.class); - - String concept = inputParamterForGetLogicalView.getConcept(); - - if (!useSOLRIndex || hConfiguration.getGetPropertyFromConcept()!=TypeOfDataSource.SOLR){ - OutputForPropertiesFromConcept propertiesFromConcept = sparqlDerivation.getAllTransitiveProperties(concept); - concept = sparqlDerivation.getURIOfConcept(concept); - for (OutputForPropertyFromConcept prop : propertiesFromConcept.getOutputForPropertiesFromConcept()) { - if (prop.getPropertySource()==PropertySource.DOMAIN_SPECIFIC_PROPERTY){ - TranslationResult name = sparqlDerivation.translateProperty(prop.getPropertyURL(), - Language.fromString(inputParamterForGetLogicalView.getLanguage()), languageLabel); - prop.setTranslatedProperty(name.getTranslation()); - } - else{ - String uri = prop.getPropertyURL(); - String name = uri.substring(uri.indexOf("#") + 1); - prop.setTranslatedProperty(name); - } - } - String result = ""; - result = gson.toJson(propertiesFromConcept); - return new ResponseEntity(result, HttpStatus.OK); - } - else{ - OutputForPropertiesFromConcept propertiesFromConcept = new OutputForPropertiesFromConcept(); - propertiesFromConcept.setLanguage(inputParamterForGetLogicalView.getLanguageAsLanguage()); - List properties = solrReader.getAllPropertiesIncludingEverything(concept); - for (String prop: properties){ - OutputForPropertyFromConcept outputForPropertyFromConcept = new OutputForPropertyFromConcept(); - PropertySource source = PropertySource.DOMAIN_SPECIFIC_PROPERTY; - outputForPropertyFromConcept.setPropertySource(source); - PropertyType type = solrReader.getPropertyType(prop); - if (type == PropertyType.DATATYPEPROPERTY){ - outputForPropertyFromConcept.setDatatypeProperty(true); - outputForPropertyFromConcept.setObjectProperty(false); - } - if (type == PropertyType.OBJECTPROPERTY){ - outputForPropertyFromConcept.setDatatypeProperty(false); - outputForPropertyFromConcept.setObjectProperty(true); - } - if (type == PropertyType.UNKNOWN){ - outputForPropertyFromConcept.setDatatypeProperty(false); - outputForPropertyFromConcept.setObjectProperty(false); - Logger.getAnonymousLogger().log(Level.WARNING, "Found no type for: " + prop); - } - outputForPropertyFromConcept.setPropertyURL(prop); - String translatedProperty = solrReader.translateProperty(prop, inputParamterForGetLogicalView.getLanguageAsLanguage()); - outputForPropertyFromConcept.setTranslatedProperty(translatedProperty); - propertiesFromConcept.getOutputForPropertiesFromConcept().add(outputForPropertyFromConcept); - } - + if (useIndexingService) { + correctReceivedLanguageTerm(inputParamterForGetLogicalView); + OutputForPropertiesFromConcept propertiesFromConcept = indexingServiceReader + .getAllTransitiveProperties(concept, inputParamterForGetLogicalView.getLanguageAsLanguage(), bearerToken); String result = ""; result = gson.toJson(propertiesFromConcept); return new ResponseEntity(result, HttpStatus.OK); - } + } else { + + // if (!useSOLRIndex || hConfiguration.getGetPropertyFromConcept() != TypeOfDataSource.SOLR) { +// OutputForPropertiesFromConcept propertiesFromConcept = sparqlDerivation +// .getAllTransitiveProperties(concept); +// concept = sparqlDerivation.getURIOfConcept(concept); +// for (OutputForPropertyFromConcept prop : propertiesFromConcept +// .getOutputForPropertiesFromConcept()) { +// if (prop.getPropertySource() == PropertySource.DOMAIN_SPECIFIC_PROPERTY) { +// TranslationResult name = sparqlDerivation.translateProperty(prop.getPropertyURL(), +// Language.fromString(inputParamterForGetLogicalView.getLanguage()), languageLabel); +// prop.setTranslatedProperty(name.getTranslation()); +// } else { +// String uri = prop.getPropertyURL(); +// String name = uri.substring(uri.indexOf("#") + 1); +// prop.setTranslatedProperty(name); +// } +// } +// String result = ""; +// result = gson.toJson(propertiesFromConcept); +// +// return new ResponseEntity(null, HttpStatus.OK); +// } else { + OutputForPropertiesFromConcept propertiesFromConcept = new OutputForPropertiesFromConcept(); + propertiesFromConcept.setLanguage(inputParamterForGetLogicalView.getLanguageAsLanguage()); + List properties = solrReader.getAllPropertiesIncludingEverything(concept); + for (String prop : properties) { + OutputForPropertyFromConcept outputForPropertyFromConcept = new OutputForPropertyFromConcept(); + PropertySource source = PropertySource.DOMAIN_SPECIFIC_PROPERTY; + outputForPropertyFromConcept.setPropertySource(source); + PropertyType type = solrReader.getPropertyType(prop); + if (type == PropertyType.DATATYPEPROPERTY) { + outputForPropertyFromConcept.setDatatypeProperty(true); + outputForPropertyFromConcept.setObjectProperty(false); + } + if (type == PropertyType.OBJECTPROPERTY) { + outputForPropertyFromConcept.setDatatypeProperty(false); + outputForPropertyFromConcept.setObjectProperty(true); + } + if (type == PropertyType.UNKNOWN) { + outputForPropertyFromConcept.setDatatypeProperty(false); + outputForPropertyFromConcept.setObjectProperty(false); + Logger.getAnonymousLogger().log(Level.WARNING, "Found no type for: " + prop); + } + outputForPropertyFromConcept.setPropertyURL(prop); + String translatedProperty = solrReader.translateProperty(prop, + inputParamterForGetLogicalView.getLanguageAsLanguage()); + outputForPropertyFromConcept.setTranslatedProperty(translatedProperty); + propertiesFromConcept.getOutputForPropertiesFromConcept().add(outputForPropertyFromConcept); + } + + String result = ""; + result = gson.toJson(propertiesFromConcept); + + return new ResponseEntity(result, HttpStatus.OK); + } + // } } catch (Exception e) { + e.printStackTrace(); return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } } - /** * Returns the properties of of a cocnept @@ -713,79 +825,90 @@ HttpEntity getPropertyFromConcept(@RequestParam("inputAsJson") String in */ @CrossOrigin @RequestMapping(value = "/getInstantiatedPropertiesFromConcept", method = RequestMethod.GET) - HttpEntity getInstantiatedPropertiesFromConcept(@RequestParam("inputAsJson") String inputAsJson) { + HttpEntity getInstantiatedPropertiesFromConcept(@RequestParam("inputAsJson") String inputAsJson,@RequestHeader(value = "Authorization") String bearerToken) { - try { Gson gson = new Gson(); InputParamterForGetLogicalView inputParamterForGetLogicalView = gson.fromJson(inputAsJson, InputParamterForGetLogicalView.class); String concept = inputParamterForGetLogicalView.getConcept(); - - if (!useSOLRIndex || hConfiguration.getGetInstantiatedPropertiesFromConcept()!=TypeOfDataSource.SOLR){ - - OutputForPropertiesFromConcept propertiesFromConcept = sparqlDerivation.getAllTransitiveProperties(concept); - concept = sparqlDerivation.getURIOfConcept(concept); - for (OutputForPropertyFromConcept prop : propertiesFromConcept.getOutputForPropertiesFromConcept()) { - TranslationResult name = sparqlDerivation.translateProperty(prop.getPropertyURL(), - Language.fromString(inputParamterForGetLogicalView.getLanguage()), languageLabel); - prop.setTranslatedProperty(name.getTranslation()); - } - String result = ""; - result = gson.toJson(propertiesFromConcept); - - return new ResponseEntity(result, HttpStatus.OK); - - } - else{ - OutputForPropertiesFromConcept propertiesFromConcept = new OutputForPropertiesFromConcept(); - propertiesFromConcept.setLanguage(inputParamterForGetLogicalView.getLanguageAsLanguage()); - List properties = solrReader.getAllPropertiesIncludingEverything(concept); - for (String prop: properties){ - OutputForPropertyFromConcept outputForPropertyFromConcept = new OutputForPropertyFromConcept(); - PropertySource source = PropertySource.DOMAIN_SPECIFIC_PROPERTY; - outputForPropertyFromConcept.setPropertySource(source); - PropertyType type = solrReader.getPropertyType(prop); - if (type == PropertyType.DATATYPEPROPERTY){ - outputForPropertyFromConcept.setDatatypeProperty(true); - outputForPropertyFromConcept.setObjectProperty(false); - } - if (type == PropertyType.OBJECTPROPERTY){ - outputForPropertyFromConcept.setDatatypeProperty(false); - outputForPropertyFromConcept.setObjectProperty(true); - } - if (type == PropertyType.UNKNOWN){ - outputForPropertyFromConcept.setDatatypeProperty(false); - outputForPropertyFromConcept.setObjectProperty(false); - Logger.getAnonymousLogger().log(Level.WARNING, "Found no type for: " + prop); - } - outputForPropertyFromConcept.setPropertyURL(prop); - String translatedProperty = solrReader.translateProperty(prop, inputParamterForGetLogicalView.getLanguageAsLanguage()); - outputForPropertyFromConcept.setTranslatedProperty(translatedProperty); - propertiesFromConcept.getOutputForPropertiesFromConcept().add(outputForPropertyFromConcept); - } - + if (useIndexingService) { + OutputForPropertiesFromConcept propertiesFromConcept = indexingServiceReader + .getAllTransitiveProperties(concept, inputParamterForGetLogicalView.getLanguageAsLanguage(),bearerToken); String result = ""; result = gson.toJson(propertiesFromConcept); return new ResponseEntity(result, HttpStatus.OK); - - } - + } else { + +// if (!useSOLRIndex +// || hConfiguration.getGetInstantiatedPropertiesFromConcept() != TypeOfDataSource.SOLR) { +// +// OutputForPropertiesFromConcept propertiesFromConcept = sparqlDerivation +// .getAllTransitiveProperties(concept); +// concept = sparqlDerivation.getURIOfConcept(concept); +// for (OutputForPropertyFromConcept prop : propertiesFromConcept +// .getOutputForPropertiesFromConcept()) { +// TranslationResult name = sparqlDerivation.translateProperty(prop.getPropertyURL(), +// Language.fromString(inputParamterForGetLogicalView.getLanguage()), languageLabel); +// prop.setTranslatedProperty(name.getTranslation()); +// } +// String result = ""; +// result = gson.toJson(propertiesFromConcept); +// +// return new ResponseEntity(result, HttpStatus.OK); +// +// } else { + OutputForPropertiesFromConcept propertiesFromConcept = new OutputForPropertiesFromConcept(); + propertiesFromConcept.setLanguage(inputParamterForGetLogicalView.getLanguageAsLanguage()); + List properties = solrReader.getAllPropertiesIncludingEverything(concept); + for (String prop : properties) { + OutputForPropertyFromConcept outputForPropertyFromConcept = new OutputForPropertyFromConcept(); + PropertySource source = PropertySource.DOMAIN_SPECIFIC_PROPERTY; + outputForPropertyFromConcept.setPropertySource(source); + PropertyType type = solrReader.getPropertyType(prop); + if (type == PropertyType.DATATYPEPROPERTY) { + outputForPropertyFromConcept.setDatatypeProperty(true); + outputForPropertyFromConcept.setObjectProperty(false); + } + if (type == PropertyType.OBJECTPROPERTY) { + outputForPropertyFromConcept.setDatatypeProperty(false); + outputForPropertyFromConcept.setObjectProperty(true); + } + if (type == PropertyType.UNKNOWN) { + outputForPropertyFromConcept.setDatatypeProperty(false); + outputForPropertyFromConcept.setObjectProperty(false); + Logger.getAnonymousLogger().log(Level.WARNING, "Found no type for: " + prop); + } + outputForPropertyFromConcept.setPropertyURL(prop); + String translatedProperty = solrReader.translateProperty(prop, + inputParamterForGetLogicalView.getLanguageAsLanguage()); + outputForPropertyFromConcept.setTranslatedProperty(translatedProperty); + propertiesFromConcept.getOutputForPropertiesFromConcept().add(outputForPropertyFromConcept); + } + + String result = ""; + result = gson.toJson(propertiesFromConcept); + + return new ResponseEntity(result, HttpStatus.OK); + + } + +// } } catch (Exception e) { return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } } - - private void checkVariableValuesForJSONONput(Object o) throws Exception{ - List emptyVariables = new ArrayList(); - + + private void checkVariableValuesForJSONONput(Object o) throws Exception { + List emptyVariables = new ArrayList(); + for (Field field : o.getClass().getDeclaredFields()) { - + try { - if (field.get(o) == null){ + if (field.get(o) == null) { emptyVariables.add(field.getName()); } } catch (IllegalArgumentException e) { @@ -796,16 +919,16 @@ private void checkVariableValuesForJSONONput(Object o) throws Exception{ e.printStackTrace(); } } - - if (emptyVariables.size() > 0){ + + if (emptyVariables.size() > 0) { String message = "Missing input for JSON Attributes: "; - for (String str: emptyVariables){ + for (String str : emptyVariables) { message += str + ";"; } Exception e = new Exception(message); throw e; } - + } /** @@ -820,37 +943,16 @@ private void checkVariableValuesForJSONONput(Object o) throws Exception{ */ @CrossOrigin @RequestMapping(value = "/getPropertyValuesFromGreenGroup", method = RequestMethod.GET) - HttpEntity getPropertyValuesFromGreenGroup(@RequestParam("inputAsJson") String inputAsJson) { + HttpEntity getPropertyValuesFromGreenGroup(@RequestParam("inputAsJson") String inputAsJson,@RequestHeader(value = "Authorization") String bearerToken) { try { Gson gson = new Gson(); InputParameterForPropertyValuesFromGreenGroup inputParameterForPropertyValuesFromGreenGroup = gson .fromJson(inputAsJson, InputParameterForPropertyValuesFromGreenGroup.class); - - if (!useSOLRIndex || hConfiguration.getGetPropertyValuesFromGreenGroup()!=TypeOfDataSource.SOLR){ - String concept = sparqlDerivation - .getURIOfConcept(inputParameterForPropertyValuesFromGreenGroup.getConceptURL()); - String property = sparqlDerivation - .getURIOfProperty(inputParameterForPropertyValuesFromGreenGroup.getPropertyURL()); - - checkVariableValuesForJSONONput(inputParameterForPropertyValuesFromGreenGroup); - - List allValues = sparqlDerivation.getAllValuesForAGivenProperty(concept, property, inputParameterForPropertyValuesFromGreenGroup.getPropertySource()); - - OutputForPropertyValuesFromGreenGroup outputForPropertyValuesFromGreenGroup = new OutputForPropertyValuesFromGreenGroup(); - outputForPropertyValuesFromGreenGroup.getAllValues().addAll(allValues); - String result = ""; - result = gson.toJson(outputForPropertyValuesFromGreenGroup); - - return new ResponseEntity(result, HttpStatus.OK); - } - - else{ - - String concept = inputParameterForPropertyValuesFromGreenGroup.getConceptURL(); - String property = inputParameterForPropertyValuesFromGreenGroup.getPropertyURL(); - - List allValues = solrReader.getAllValuesForAGivenProperty(concept, property, inputParameterForPropertyValuesFromGreenGroup.getPropertySource()); + if (useIndexingService) { + List allValues = indexingServiceReader.getAllDifferentValuesForAProperty( + inputParameterForPropertyValuesFromGreenGroup.getConceptURL(), + inputParameterForPropertyValuesFromGreenGroup.getPropertyURL(), bearerToken); OutputForPropertyValuesFromGreenGroup outputForPropertyValuesFromGreenGroup = new OutputForPropertyValuesFromGreenGroup(); outputForPropertyValuesFromGreenGroup.getAllValues().addAll(allValues); @@ -858,7 +960,45 @@ HttpEntity getPropertyValuesFromGreenGroup(@RequestParam("inputAsJson") result = gson.toJson(outputForPropertyValuesFromGreenGroup); return new ResponseEntity(result, HttpStatus.OK); - + + } else { + +// if (!useSOLRIndex || hConfiguration.getGetPropertyValuesFromGreenGroup() != TypeOfDataSource.SOLR) { +// String concept = sparqlDerivation +// .getURIOfConcept(inputParameterForPropertyValuesFromGreenGroup.getConceptURL()); +// String property = sparqlDerivation +// .getURIOfProperty(inputParameterForPropertyValuesFromGreenGroup.getPropertyURL()); +// +// checkVariableValuesForJSONONput(inputParameterForPropertyValuesFromGreenGroup); +// +// List allValues = sparqlDerivation.getAllValuesForAGivenProperty(concept, property, +// inputParameterForPropertyValuesFromGreenGroup.getPropertySource()); +// +// OutputForPropertyValuesFromGreenGroup outputForPropertyValuesFromGreenGroup = new OutputForPropertyValuesFromGreenGroup(); +// outputForPropertyValuesFromGreenGroup.getAllValues().addAll(allValues); +// +// String result = ""; +// result = gson.toJson(outputForPropertyValuesFromGreenGroup); +// +// return new ResponseEntity(result, HttpStatus.OK); +// } +// +// else { + + String concept = inputParameterForPropertyValuesFromGreenGroup.getConceptURL(); + String property = inputParameterForPropertyValuesFromGreenGroup.getPropertyURL(); + + List allValues = solrReader.getAllValuesForAGivenProperty(concept, property, + inputParameterForPropertyValuesFromGreenGroup.getPropertySource()); + OutputForPropertyValuesFromGreenGroup outputForPropertyValuesFromGreenGroup = new OutputForPropertyValuesFromGreenGroup(); + outputForPropertyValuesFromGreenGroup.getAllValues().addAll(allValues); + + String result = ""; + result = gson.toJson(outputForPropertyValuesFromGreenGroup); + + return new ResponseEntity(result, HttpStatus.OK); + + // } } } catch (Exception e) { @@ -876,20 +1016,19 @@ HttpEntity getPropertyValuesFromGreenGroup(@RequestParam("inputAsJson") */ @CrossOrigin @RequestMapping(value = "/getReferencesFromAConcept", method = RequestMethod.GET) - HttpEntity getReferencesFromAConcept(@RequestParam("inputAsJson") String inputAsJson) { + HttpEntity getReferencesFromAConcept(@RequestParam("inputAsJson") String inputAsJson, @RequestHeader(value = "Authorization") String bearerToken) { try { Gson gson = new Gson(); InputParameterForGetReferencesFromAConcept inputParameterForGetReferencesFromAConcept = gson .fromJson(inputAsJson, InputParameterForGetReferencesFromAConcept.class); checkVariableValuesForJSONONput(inputParameterForGetReferencesFromAConcept); - + List allReferences = null; - if (!useSOLRIndex || hConfiguration.getGetReferencesFromAConcept()!=TypeOfDataSource.SOLR){ - allReferences = sparqlDerivation.getAllObjectPropertiesIncludingEverythingAndReturnItsRange( - inputParameterForGetReferencesFromAConcept); - } - else{ + if (!useSOLRIndex || hConfiguration.getGetReferencesFromAConcept() != TypeOfDataSource.SOLR) { + allReferences = indexingServiceReader.getAllObjectPropertiesIncludingEverythingAndReturnItsRange( + inputParameterForGetReferencesFromAConcept, bearerToken); + } else { allReferences = solrReader.getAllObjectPropertiesIncludingEverythingAndReturnItsRange( inputParameterForGetReferencesFromAConcept); } @@ -904,20 +1043,18 @@ HttpEntity getReferencesFromAConcept(@RequestParam("inputAsJson") String Language language = Language .fromString(inputParameterForGetReferencesFromAConcept.getLanguage()); TranslationResult result = null; - if (!useSOLRIndex){ - result= sparqlDerivation.translateProperty(value, language, languageLabel); - } - else{ - result= solrReader.translateProperty(value, language, languageLabel); - } + if (!useSOLRIndex) { + result = indexingServiceReader.translateProperty(value, language, languageLabel); + } else { + result = solrReader.translateProperty(value, language, languageLabel); + } if (index == -1) { Reference reference = new Reference(); - if (!useSOLRIndex){ - reference.setTranslatedProperty(sparqlDerivation - .translateProperty(propertyURL, language, languageLabel).getTranslation()); - } - else{ + if (!useSOLRIndex) { + reference.setTranslatedProperty(indexingServiceReader + .translateProperty(propertyURL, language, languageLabel).getTranslation()); + } else { reference.setTranslatedProperty(solrReader .translateProperty(propertyURL, language, languageLabel).getTranslation()); } @@ -955,31 +1092,32 @@ HttpEntity getReferencesFromAConcept(@RequestParam("inputAsJson") String * @return JSON including for each property the url and the type (datatype * or object) */ - @CrossOrigin - @RequestMapping(value = "/getPropertyValuesFromOrangeGroup", method = RequestMethod.GET) - HttpEntity getPropertyValuesFromOrangeGroup(@RequestParam("inputAsJson") String inputAsJson) { - - try { - Gson gson = new Gson(); - InputParameterForPropertyValuesFromOrangeGroup inputParameterForPropertyValuesFromOrangeGroup = gson.fromJson(inputAsJson, InputParameterForPropertyValuesFromOrangeGroup.class); - String result = ""; - - checkVariableValuesForJSONONput(inputParameterForPropertyValuesFromOrangeGroup); - if (!useSOLRIndex || hConfiguration.getGetPropertyValuesFromOrangeGroup()!=TypeOfDataSource.SOLR){ - result = gson.toJson(sparqlDerivation.getPropertyValuesFromOrangeGroup(inputParameterForPropertyValuesFromOrangeGroup)); - return new ResponseEntity(result, HttpStatus.OK); - } - else{ - result = gson.toJson(solrReader.getPropertyValuesFromOrangeGroup(inputParameterForPropertyValuesFromOrangeGroup)); - return new ResponseEntity(result, HttpStatus.OK); - } - - }catch (Exception e) { - return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); - } - - } - +// @CrossOrigin +// @RequestMapping(value = "/getPropertyValuesFromOrangeGroup", method = RequestMethod.GET) +// HttpEntity getPropertyValuesFromOrangeGroup(@RequestParam("inputAsJson") String inputAsJson) { +// +// try { +// Gson gson = new Gson(); +// InputParameterForPropertyValuesFromOrangeGroup inputParameterForPropertyValuesFromOrangeGroup = gson +// .fromJson(inputAsJson, InputParameterForPropertyValuesFromOrangeGroup.class); +// String result = ""; +// +// checkVariableValuesForJSONONput(inputParameterForPropertyValuesFromOrangeGroup); +// if (!useSOLRIndex || hConfiguration.getGetPropertyValuesFromOrangeGroup() != TypeOfDataSource.SOLR) { +// result = gson.toJson(sparqlDerivation +// .getPropertyValuesFromOrangeGroup(inputParameterForPropertyValuesFromOrangeGroup)); +// return new ResponseEntity(result, HttpStatus.OK); +// } else { +// result = gson.toJson( +// solrReader.getPropertyValuesFromOrangeGroup(inputParameterForPropertyValuesFromOrangeGroup)); +// return new ResponseEntity(result, HttpStatus.OK); +// } +// +// } catch (Exception e) { +// return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); +// } +// +// } /** * Returns from a given concept the data properties and obejctproperties and @@ -993,32 +1131,43 @@ HttpEntity getPropertyValuesFromOrangeGroup(@RequestParam("inputAsJson") */ @CrossOrigin @RequestMapping(value = "/getPropertyValuesDiscretised", method = RequestMethod.GET) - HttpEntity getPropertyValuesDiscretised(@RequestParam("inputAsJson") String inputAsJson) { + HttpEntity getPropertyValuesDiscretised(@RequestParam("inputAsJson") String inputAsJson,@RequestHeader(value = "Authorization") String bearerToken) { try { Logger.getAnonymousLogger().log(Level.INFO, "Invoke: getPropertyValuesDiscretised: " + inputAsJson); Gson gson = new Gson(); InputParameterForgetPropertyValuesDiscretised paramterForGetLogicalView = gson.fromJson(inputAsJson, InputParameterForgetPropertyValuesDiscretised.class); - - if (!useSOLRIndex || hConfiguration.getGetPropertyValuesDiscretised()!=TypeOfDataSource.SOLR){ - Map> mapOfPropertyGroups = sparqlDerivation.generateGroup( - paramterForGetLogicalView.getAmountOfGroups(), paramterForGetLogicalView.getConcept(), - paramterForGetLogicalView.getProperty(), paramterForGetLogicalView.getPropertySource()); - String result = ""; - result = gson.toJson(mapOfPropertyGroups); - return new ResponseEntity(result, HttpStatus.OK); - } - else{ - Map> mapOfPropertyGroups = solrReader.generateGroup( + + if (useIndexingService) { + Language language = Language.fromString(paramterForGetLogicalView.getLanguage()); + Map> mapOfPropertyGroups = indexingServiceReader.generateGroup( paramterForGetLogicalView.getAmountOfGroups(), paramterForGetLogicalView.getConcept(), - paramterForGetLogicalView.getProperty()); + paramterForGetLogicalView.getProperty(), language, bearerToken); String result = ""; result = gson.toJson(mapOfPropertyGroups); return new ResponseEntity(result, HttpStatus.OK); + } else { + +// if (!useSOLRIndex || hConfiguration.getGetPropertyValuesDiscretised() != TypeOfDataSource.SOLR) { +// Map> mapOfPropertyGroups = sparqlDerivation.generateGroup( +// paramterForGetLogicalView.getAmountOfGroups(), paramterForGetLogicalView.getConcept(), +// paramterForGetLogicalView.getProperty(), paramterForGetLogicalView.getPropertySource()); +// String result = ""; +// result = gson.toJson(mapOfPropertyGroups); +// return new ResponseEntity(result, HttpStatus.OK); +// } else { +// Map> mapOfPropertyGroups = solrReader.generateGroup( +// paramterForGetLogicalView.getAmountOfGroups(), paramterForGetLogicalView.getConcept(), +// paramterForGetLogicalView.getProperty()); +// String result = ""; +// result = gson.toJson(mapOfPropertyGroups); +// return new ResponseEntity(result, HttpStatus.OK); +// } } } catch (Exception e) { return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } + return null; } @@ -1034,26 +1183,26 @@ HttpEntity getPropertyValuesDiscretised(@RequestParam("inputAsJson") Str */ @CrossOrigin @RequestMapping(value = "/executeSPARQLSelect", method = RequestMethod.GET) - HttpEntity executeSPARQLSelect(@RequestParam("inputAsJson") String inputAsJson) { + HttpEntity executeSPARQLSelect(@RequestParam("inputAsJson") String inputAsJson, @RequestHeader(value = "Authorization") String bearerToken) { Logger.getAnonymousLogger().log(Level.INFO, "Invoke: executeSPARQLSelect: " + inputAsJson); OutputForExecuteSelect outputForExecuteSelect = new OutputForExecuteSelect(); - - + try { Gson gson = new Gson(); InputParamaterForExecuteSelect inputParamaterForExecuteSelect = gson.fromJson(inputAsJson, InputParamaterForExecuteSelect.class); - //checkVariableValuesForJSONONput(inputParamaterForExecuteSelect); - - if (!useSOLRIndex || hConfiguration.getExecuteSPARQLSelect()!=TypeOfDataSource.SOLR){ - outputForExecuteSelect = sparqlDerivation.createSPARQLAndExecuteIT(inputParamaterForExecuteSelect); - - } - else{ - outputForExecuteSelect = solrReader.createSPARQLAndExecuteIT(inputParamaterForExecuteSelect); - } + if (useIndexingService) { + outputForExecuteSelect = indexingServiceReader.createSPARQLAndExecuteIT(inputParamaterForExecuteSelect, bearerToken); + } else { +// if (!useSOLRIndex || hConfiguration.getExecuteSPARQLSelect() != TypeOfDataSource.SOLR) { +// outputForExecuteSelect = sparqlDerivation.createSPARQLAndExecuteIT(inputParamaterForExecuteSelect); +// +// } else { +// outputForExecuteSelect = solrReader.createSPARQLAndExecuteIT(inputParamaterForExecuteSelect); +// } + } String result = ""; result = gson.toJson(outputForExecuteSelect); @@ -1076,7 +1225,7 @@ HttpEntity executeSPARQLSelect(@RequestParam("inputAsJson") String input */ @CrossOrigin @RequestMapping(value = "/executeSPARQLOptionalSelect", method = RequestMethod.GET) - HttpEntity executeSPARQLWithOptionalSelect(@RequestParam("inputAsJson") String inputAsJson) { + HttpEntity executeSPARQLWithOptionalSelect(@RequestParam("inputAsJson") String inputAsJson, @RequestHeader(value = "Authorization") String bearerToken) { Logger.getAnonymousLogger().log(Level.INFO, "Invoke: executeSPARQLWithOptionalSelect: " + inputAsJson); OutputForExecuteSelect outputForExecuteSelect = new OutputForExecuteSelect(); if (inputAsJson == null) { @@ -1088,93 +1237,119 @@ HttpEntity executeSPARQLWithOptionalSelect(@RequestParam("inputAsJson") InputParamaterForExecuteOptionalSelect inputParamaterForExecuteSelect = gson.fromJson(inputAsJson, InputParamaterForExecuteOptionalSelect.class); - - if (!useSOLRIndex || hConfiguration.getExecuteSPARQLWithOptionalSelect()!=TypeOfDataSource.SOLR){ - - outputForExecuteSelect = sparqlDerivation - .createOPtionalSPARQLAndExecuteIT(inputParamaterForExecuteSelect); - + if (useIndexingService) { + outputForExecuteSelect = indexingServiceReader + .createOPtionalSPARQLAndExecuteIT(inputParamaterForExecuteSelect, bearerToken); + } + //else { +// +// if (!useSOLRIndex || hConfiguration.getExecuteSPARQLWithOptionalSelect() != TypeOfDataSource.SOLR) { +// +// outputForExecuteSelect = sparqlDerivation +// .createOPtionalSPARQLAndExecuteIT(inputParamaterForExecuteSelect); +// +// } else { +// outputForExecuteSelect = solrReader +// .createOPtionalSPARQLAndExecuteIT(inputParamaterForExecuteSelect); +// +// String result = ""; +// result = gson.toJson(outputForExecuteSelect); +// +// return new ResponseEntity(result, HttpStatus.OK); +// } +// } deleteIncompleteResponse(outputForExecuteSelect); - + String result = ""; result = gson.toJson(outputForExecuteSelect); return new ResponseEntity(result, HttpStatus.OK); - - } - else{ - outputForExecuteSelect = solrReader - .createOPtionalSPARQLAndExecuteIT(inputParamaterForExecuteSelect); - String result = ""; - result = gson.toJson(outputForExecuteSelect); - - return new ResponseEntity(result, HttpStatus.OK); - } - } catch (Exception e) { return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } } } - - private void deleteIncompleteResponse(OutputForExecuteSelect outputForExecuteSelect) { - List indexesToBeDeleted = new ArrayList(); - for (int i =0; i < outputForExecuteSelect.getColumns().size(); i++){ + List indexesToBeDeleted = new ArrayList(); + for (int i = 0; i < outputForExecuteSelect.getColumns().size(); i++) { String column = outputForExecuteSelect.getColumns().get(i); - if (column.contains("Dimension")){ + if (column.contains("Dimension")) { indexesToBeDeleted.add(i); } - if (column.contains("ProductImage")){ + if (column.contains("ProductImage")) { indexesToBeDeleted.add(i); } - if (column.contains("AdditionalItemProperty")){ + if (column.contains("AdditionalItemProperty")) { indexesToBeDeleted.add(i); } } - - for (int i =0; i < indexesToBeDeleted.size(); i++){ - outputForExecuteSelect.getColumns().remove(indexesToBeDeleted.get(i)-i); - for (int a =0; a < outputForExecuteSelect.getRows().size(); a++){ - outputForExecuteSelect.getRows().get(a).remove(indexesToBeDeleted.get(i)-i); + + for (int i = 0; i < indexesToBeDeleted.size(); i++) { + outputForExecuteSelect.getColumns().remove(indexesToBeDeleted.get(i) - i); + for (int a = 0; a < outputForExecuteSelect.getRows().size(); a++) { + outputForExecuteSelect.getRows().get(a).remove(indexesToBeDeleted.get(i) - i); } } + + } + + + @CrossOrigin + @RequestMapping(value = "/getIndexingServiceUri", method = RequestMethod.GET) + public HttpEntity getIndexingserviceuri() { + + Logger.getAnonymousLogger().log(Level.INFO, "Call service for seeing url of indexing service: "+indexingserviceuri); + + return new ResponseEntity("orginial: " + orginial + "; New one: " +indexingserviceuri, HttpStatus.OK); + //return indexingserviceuri; } + + @CrossOrigin @RequestMapping(value = "/getSupportedLanguages", method = RequestMethod.GET) - public HttpEntity getSupportedLanguages() { + public HttpEntity getSupportedLanguages(@RequestHeader(value = "Authorization") String bearerToken) { try { - - if (!useSOLRIndex){ - - List languages = sparqlDerivation.getSupportedLanguages(); - Gson output = new Gson(); - String result = ""; - OutoutForGetSupportedLanguages supportedLanguages = new OutoutForGetSupportedLanguages(); - supportedLanguages.getLanguages().addAll(languages); - result = output.toJson(supportedLanguages); + if (useIndexingService){ + List languages =indexingServiceReader.getSupportedLanguages(bearerToken); + OutoutForGetSupportedLanguages supportedLanguages = new OutoutForGetSupportedLanguages(); + supportedLanguages.getLanguages().addAll(languages); + Gson output = new Gson(); + String result = output.toJson(supportedLanguages); - return new ResponseEntity(result, HttpStatus.OK); - + return new ResponseEntity(result, HttpStatus.OK); } - else{ +// else{ +// if (!useSOLRIndex) { +// +// List languages = sparqlDerivation.getSupportedLanguages(); +// +// Gson output = new Gson(); +// String result = ""; +// OutoutForGetSupportedLanguages supportedLanguages = new OutoutForGetSupportedLanguages(); +// supportedLanguages.getLanguages().addAll(languages); +// result = output.toJson(supportedLanguages); +// +// return new ResponseEntity(result, HttpStatus.OK); +// +// } else { List languages = solrReader.getNativeSupportedLangauges(); OutoutForGetSupportedLanguages supportedLanguages = new OutoutForGetSupportedLanguages(); - - languages.forEach( language -> supportedLanguages.getLanguages().add(language.toString())); - + + languages.forEach(language -> supportedLanguages.getLanguages().add(language.toString())); + Gson output = new Gson(); String result = ""; result = output.toJson(supportedLanguages); return new ResponseEntity(result, HttpStatus.OK); - - } - + + //} + // } + } catch (Exception e) { return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } @@ -1186,17 +1361,17 @@ public HttpEntity getSupportedLanguages() { * * @return true if Marmotta is set as main data source of the search */ - public boolean needANimbleSpecificAdapation() { - return (marmottaUri != null && marmottaUri.contains("http")) ? true : false; - } - - public String getMarmottaUri() { - return marmottaUri; - } - - public void setMarmottaUri(String marmottaUri) { - this.marmottaUri = marmottaUri; - } +// public boolean needANimbleSpecificAdapation() { +// return (marmottaUri != null && marmottaUri.contains("http")) ? true : false; +// } +// +// public String getMarmottaUri() { +// return marmottaUri; +// } +// +// public void setMarmottaUri(String marmottaUri) { +// this.marmottaUri = marmottaUri; +// } public String getLanguageLabel() { return languageLabel; diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/ClassType.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/ClassType.java new file mode 100644 index 0000000..6958b6b --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/ClassType.java @@ -0,0 +1,95 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.Collection; +import java.util.HashSet; + + + +public class ClassType extends Named implements IClassType { + + private String type = TYPE_VALUE; + + private Collection properties; + + private Collection parents; + private Collection children; + + private Collection allParents; + private Collection allChildren; + + private Integer level; + + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public Collection getProperties() { + return properties; + } + public void addProperty(String property) { + if (this.properties == null ) { + this.properties = new HashSet<>(); + } + this.properties.add(property); + } + public void setProperties(Collection properties) { + this.properties = properties; + } + public void addParent(String superClass) { + if (this.parents == null ) { + this.parents = new HashSet<>(); + } + this.parents.add(superClass); + } + public Collection getParents() { + return parents; + } + public void setParents(Collection parent) { + this.parents = parent; + } + public void addChild(String childClass) { + if (this.children == null ) { + this.children = new HashSet<>(); + } + this.children.add(childClass); + } + public Collection getChildren() { + return children; + } + public void setChildren(Collection child) { + this.children = child; + } + public void addAllParent(String superClass) { + if (this.allParents == null ) { + this.allParents = new HashSet<>(); + } + this.allParents.add(superClass); + } + public Collection getAllParents() { + return allParents; + } + public void setAllParents(Collection parent) { + this.allParents = parent; + } + public void addAllChild(String childClass) { + if (this.allChildren == null ) { + this.allChildren = new HashSet<>(); + } + this.allChildren.add(childClass); + } + public Collection getAllChildren() { + return allChildren; + } + public void setAllChildren(Collection child) { + this.allChildren = child; + } + public Integer getLevel() { + return level; + } + public void setLevel(Integer level) { + this.level = level; + } + +} \ No newline at end of file diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/ClassTypes.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/ClassTypes.java new file mode 100644 index 0000000..308541d --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/ClassTypes.java @@ -0,0 +1,56 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.List; + +public class ClassTypes { + +private int totalElements; +private int totalPages; +private int pageSize; +private int currentPage; +private List result; +private String facets; +public int getTotalElements() { + return totalElements; +} +public void setTotalElements(int totalElements) { + this.totalElements = totalElements; +} +public int getTotalPages() { + return totalPages; +} +public void setTotalPages(int totalPages) { + this.totalPages = totalPages; +} +public int getPageSize() { + return pageSize; +} +public void setPageSize(int pageSize) { + this.pageSize = pageSize; +} +public int getCurrentPage() { + return currentPage; +} +public void setCurrentPage(int currentPage) { + this.currentPage = currentPage; +} +public List getResult() { + return result; +} +public void setResult(List result) { + this.result = result; +} +public String getFacets() { + return facets; +} +public void setFacets(String facets) { + this.facets = facets; +} +@Override +public String toString() { + return "ClassTypes [totalElements=" + totalElements + ", totalPages=" + totalPages + ", pageSize=" + pageSize + + ", currentPage=" + currentPage + ", result=" + result + ", facets=" + facets + "]"; +} + + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/Concept.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/Concept.java new file mode 100644 index 0000000..b407a28 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/Concept.java @@ -0,0 +1,322 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +public class Concept implements IConcept { + /** + * The uri of the property including namespace + */ + + + protected String uri; + + + protected String code; + + + protected String localName; + + + protected String nameSpace; + + + protected Collection languages; + + protected Map label; + + protected Map> alternateLabel; + + protected Map> hiddenLabel; + + protected Map description; + + protected Map comment; + + public Concept() { + super(); + } + static class SimpleConcept extends Concept { + + } + public static Concept buildNew() { + SimpleConcept c = new Concept.SimpleConcept(); + return c; + } + public static Concept buildFrom(IConcept other) { + SimpleConcept c = new Concept.SimpleConcept(); + c.setUri(other.getUri()); + c.setCode(other.getCode()); + c.setLabel(other.getLabel()); + c.setDescription(other.getDescription()); + c.setComment(other.getComment()); + c.setLanguages(other.getLanguages()); + c.setNameSpace(other.getNameSpace()); + c.setLocalName(other.getLocalName()); + return c; + } + /** + * Getter for the languages in use, the list is maintained by the add... methods + */ + public Collection getLanguages() { + return languages; + } + + /** + * Setter for the languages in use,
do not use directly
the distinct methods for adding labels + * are maintaining this collection. + * @param languages + */ + public void setLanguages(Collection languages) { + this.languages = languages; + } + /** + * Getter for the multilingual labels + */ + public Map getLabel() { + return label; + } + public void setLabel(Map labelMap) { + if ( labelMap != null ) { + for ( String key : labelMap.keySet() ) { + addLabel(key, labelMap.get(key)); + } + } + else { + this.label = null; + } + } + /** + * Helper method for adding a multilingual label to the concept. Only one label per language is stored. + * This method maintains the list of languages in use, see {@link #getLanguages()} + * @param language The language code such as en, es + * @param label The respective label + */ + public void addLabel(String language, String label) { + if ( this.label == null) { + this.label = new HashMap<>(); + } + this.label.put(language, label); + // + addLanguage(language); + } + /** + * Helper method for adding alternate multilingual label to the concept. Multiple labels per language are stored. + * This method maintains the list of languages in use, see {@link #getLanguages()} + * @param language The language code such as en, es + * @param label The respective label + */ + public void addAlternateLabel(String language, String alternate) { + if (this.alternateLabel ==null) { + this.alternateLabel = new HashMap<>(); + } + if ( !this.alternateLabel.containsKey(language)) { + this.alternateLabel.put(language, new HashSet<>()); + } + this.alternateLabel.get(language).add(alternate); + // + addLanguage(language); + } + /** + * Helper method for adding hidden multilingual label to the concept. Multiple labels per language are stored. + * This method maintains the list of languages in use, see {@link #getLanguages()} + * @param language The language code such as en, es + * @param label The respective label + */ + public void addHiddenLabel(String language, String alternate) { + if (this.hiddenLabel ==null) { + this.hiddenLabel = new HashMap<>(); + } + if ( !this.hiddenLabel.containsKey(language)) { + this.hiddenLabel.put(language, new HashSet<>()); + } + this.hiddenLabel.get(language).add(alternate); + // + addLanguage(language); + } + /** + * Helper method maintaining the list of languages in use + * @param language + */ + protected void addLanguage(String language) { + if ( this.languages == null) { + this.languages = new HashSet(); + } + if ( ! languages.contains(language)) + this.languages.add(language); + } + + /** + * Retrieve all comment entries + * @return + */ + public Map getComment() { + return comment; + } + /** + * Method adding a multilingual comment. Only one comment per langauge is stored + * @param language The language code such as en, es + * @param comment + */ + public void addComment(String language, String comment) { + if ( this.comment == null) { + this.comment = new HashMap<>(); + } + this.comment.put(language, comment); + // be sure to have all stored languages in the language list + addLanguage(language); + } + /** + * Setter for the multilingual comments + * @param commentMap + */ + public void setComment(Map commentMap) { + if ( commentMap != null ) { + for ( String key : commentMap.keySet() ) { + addComment(key, commentMap.get(key)); + } + } + else { + this.comment = null; + } + } + /** + * Method adding a multilingual description. Only one description per langauge is stored + * @param language The language code such as en, es + * @param desc The description + */ + public void addDescription(String language, String desc) { + if ( this.description == null) { + this.description = new HashMap<>(); + } + this.description.put(language, desc); + // be sure to have all stored languages in the language list + addLanguage(language); + } + /** + * Getter for the multilingual descriptions + */ + public Map getDescription() { + return description; + } + /** + * Setter for the multilingual descriptions + * @param descMap + */ + public void setDescription(Map descMap) { + if ( descMap != null ) { + for ( String key : descMap.keySet() ) { + addDescription(key, descMap.get(key)); + } + } + else { + this.description = null; + } + } + /** + * Getter for the identifier (URI) + */ + public String getUri() { + return uri; + } + /** + * Setter for the identifier (URI) + * @param uri + */ + public void setUri(String uri) { + this.uri = uri; + } + /** + * Getter for the {@link #localName} + */ + public String getLocalName() { + return localName; + } + /** + * Setter for the localName + * @param localName + */ + public void setLocalName(String localName) { + this.localName = localName; + } + /** + * Getter for the namespace + */ + public String getNameSpace() { + return nameSpace; + } + /** + * Getter for the namespace + * @param nameSpace + */ + public void setNameSpace(String nameSpace) { + this.nameSpace = nameSpace; + } + /** + * Getter for the alternate labels + * @return + */ + public Map> getAlternateLabel() { + return alternateLabel; + } + /** + * Setter for the alternate labels + * @param alternateLabel + */ + public void setAlternateLabel(Map> alternateLabel) { + if ( alternateLabel != null ) { + for ( String lang : alternateLabel.keySet() ) { + for (String label : alternateLabel.get(lang)) { + addAlternateLabel(lang, label); + + } + } + } + else { + this.alternateLabel = null; + } + } + /** + * Getter for the hidden labels + * @return + */ + public Map> getHiddenLabel() { + return hiddenLabel; + } + /** + * Setter for the hidden labels + * @param alternateLabel + */ + public void setHiddenLabel(Map> hiddenLabel) { + if ( hiddenLabel != null ) { + for ( String lang : hiddenLabel.keySet() ) { + for (String label : hiddenLabel.get(lang)) { + addHiddenLabel(lang, label); + + } + } + } + else { + this.hiddenLabel = null; + } + } + /** + * Getter for the code + */ + public String getCode() { + return code; + } + /** + * Setter for the code + * @param code + */ + public void setCode(String code) { + this.code = code; + } + + + + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/Contact.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/Contact.java new file mode 100644 index 0000000..f3f33e6 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/Contact.java @@ -0,0 +1,21 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.ArrayList; + +public class Contact { + ArrayList < Object > otherCommunication = new ArrayList < Object > (); + private float hjid; + + + // Getter Methods + + public float getHjid() { + return hjid; + } + + // Setter Methods + + public void setHjid(float hjid) { + this.hjid = hjid; + } +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/Country.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/Country.java new file mode 100644 index 0000000..53f3a47 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/Country.java @@ -0,0 +1,27 @@ +package eu.nimble.service.catalog.search.impl.dao; + +public class Country { + private String name; + private float hjid; + + + // Getter Methods + + public String getName() { + return name; + } + + public float getHjid() { + return hjid; + } + + // Setter Methods + + public void setName(String name) { + this.name = name; + } + + public void setHjid(float hjid) { + this.hjid = hjid; + } +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/ICatalogueItem.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/ICatalogueItem.java new file mode 100644 index 0000000..9626e0b --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/ICatalogueItem.java @@ -0,0 +1,168 @@ +package eu.nimble.service.catalog.search.impl.dao; + +public interface ICatalogueItem extends IConcept { + String COLLECTION = "item"; + String ID_FIELD = "id"; + String TYPE_FIELD ="doctype"; + /** + * the item entries must have a type value assigned + */ + public static final String TYPE_VALUE = "item"; + /** + * The id of the catalogue the item is contained in + */ + String CATALOGUE_ID_FIELD = "catalogueId"; + /** + * The curreny label, the dynamic part is the encoded label string such as eUR for EUR + */ + String CURRENCY_FIELD = "*_currency"; + /** + * The currency based price field, e.g. price_eur, price_usd + */ + String PRICE_FIELD = "*_price"; + /** + * The image field with qualifier (thumbnail, midsize) + */ + String IMAGE_URI_FIELD ="image"; + /** + * Free of charge indicator + */ + String FREE_OF_CHARGE_FIELD = "freeOfCharge"; + /** + * Certificate types + */ + String CERTIFICATE_TYPE_FIELD = "certificateType"; + /** + * List of applicable countries the item is available + */ + String APPLICABLE_COUNTRIES_FIELD = "applicableCountries"; + /** + * The delivery time, numeric + */ + String ESTIMATED_DELIVERY_TIME_FIELD = "*_deliveryTime"; + /** + * The delivery time unit (weeks, days) + */ + String ESTIMATED_DELIVERY_TIME_UNIT_FIELD = "*_deliveryTimeUnit"; + /** + * The id of the manufacturer's party type + */ + String MANUFACTURER_ID_FIELD = "manufacturerId"; + /** + * The item's id in the manufacturer's context or system + */ + String MANUFACTURER_ITEM_ID_FIELD = "manufacturerItemId"; + /** + * Service type, such as Port to Port, Door to door + */ + String SERVICE_TYPE_FIELD = "serviceType"; + /** + * The supported product nature (when delivering), such as Euro Pallet + */ + String SUPPORTED_PRODUCT_NATURE_FIELD = "supportedProductNature"; + /** + * Supported cargo type + */ + String SUPPORTED_CARGO_TYPE_FIELD = "supportedCargoType"; + // DYNAMIC + /** + * Dynamic! The packaging unit, e.g. the field name package_unit_box for the package type Box + */ + String PACKAGE_UNIT_FIELD = "*_packageUnit"; + // DYNAMIC + /** + * Dynamic The packaging amount per unit, e.g. the field name package_amount_box for the package type Box + */ + String PACKAGE_AMOUNT_FILED = "*_package"; + /** + * The package type, such as + */ + /** + * The label for any item classification + */ + String COMMODITY_CLASSIFICATION_LABEL_FIELD ="commodityClassificationLabel"; + /** + * The URI for any item classification + */ + String COMMODITY_CLASSIFICATION_URI_FIELD = "commodityClassficationUri"; + /** + * A combination of uri and label + */ + String COMMODITY_CLASSIFICATION_MIX_FIELD = "commodityClassficationMix"; + /** + * The total capacity + */ + String TOTAL_CAPACITY_FIELD = "totalCapacity"; + /** + * The total capacity's unit + */ + String Total_CAPACITY_UNIT_FIELD ="totalCapacityUnit"; + /** + * The transport mode + */ + String TRANSPORT_MODE = "transportMode"; + /** + * Emission type + */ + String EMISSION_TYPE_FIELD = "emissionType"; + /** + * Emission standard + */ + String EMISSION_STANDARD_FIELD = "emissionStandard"; + /** + * Estimated delivery duration + */ + String ESTIMATED_DURATION_FIELD = "estimatedDuration"; + /** + * Duration of the warranty period + */ + String WARRANTY_VALIDITY_PERIOD_FIELD = "warrantyValidityPeriod"; + /** + * Minimum Order Quantity + */ + String MINIMUM_ORDER_QUANTITY_FIELD = "minimumOrderQuantity"; + /** + * Applicable INCOTERMS + * + */ + String INCOTERMS_FIELD = "incoterm"; + // additional property attributes + String VALUE_QUALIFIER_FIELD = "valueQualifier"; + /** + * Additional Properties + */ + String QUALIFIED_KEY_FIELD = "*_key"; + String QUALIFIED_STRING_FIELD = "*_svalues"; + String QUALIFIED_DOUBLE_FIELD = "*_dvalues"; + String QUALIFIED_BOOLEAN_FIELD = "*_bvalue"; + // + static boolean isQualifiedDynamic(String string) { + switch (string) { + case QUALIFIED_BOOLEAN_FIELD: + case QUALIFIED_DOUBLE_FIELD: + case QUALIFIED_STRING_FIELD: + case QUALIFIED_KEY_FIELD: + return true; + default: + return false; + } + } + static boolean isFixedDynamic(String string) { + switch (string) { + case PACKAGE_AMOUNT_FILED: + case PACKAGE_UNIT_FIELD: + case CURRENCY_FIELD: + case PRICE_FIELD: + case ESTIMATED_DELIVERY_TIME_FIELD: + case LABEL_FIELD: + case DESCRIPTION_FIELD: + case ALTERNATE_LABEL_FIELD: + case HIDDEN_LABEL_FIELD: + case LANGUAGE_TXT_FIELD: + return true; + default: + return false; + } + } + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/IClassType.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IClassType.java new file mode 100644 index 0000000..85e58a0 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IClassType.java @@ -0,0 +1,14 @@ +package eu.nimble.service.catalog.search.impl.dao; + +public interface IClassType extends INamed { + String TYPE_FIELD = "doctype"; + String TYPE_VALUE = "class"; + String PROPERTIES_FIELD = "properties"; + String PARENTS_FIELD = "parents"; + String ALL_PARENTS_FIELD = "allParents"; + String CHILDREN_FIELD ="children"; + String ALL_CHILDREN_FIELD ="allChildren"; + + String LEVEL_FIELD = "level"; + +} \ No newline at end of file diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/IConcept.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IConcept.java new file mode 100644 index 0000000..ce7e081 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IConcept.java @@ -0,0 +1,52 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.Collection; +import java.util.Map; + +public interface IConcept { + String ID_FIELD = "id"; + String CODE_FIELD = "code"; + /** + * Collection of languages + */ + String LANGUAGES_FIELD = "languages"; + /** + * The language based label, e.g. en_label for english label + */ + String LABEL_FIELD = "*_label"; + String ALL_LABEL_FIELD = "all_label"; + /** + * The language based label, e.g. en_alternate for english alternate label + */ + String ALTERNATE_LABEL_FIELD = "*_alternate"; + /** + * The language based label, e.g. en_label for english label + */ + String HIDDEN_LABEL_FIELD = "*_hidden"; + /** + * Copy Field, language based. The language based label and description are stored in this field + * Final used index name is en_txt for english text (label, description) + */ + String LANGUAGE_TXT_FIELD = "*_txt"; + /** + * Copy Field. All labels, descriptions are stored in this field + */ + String TEXT_FIELD = "_text_"; + /** + * The language based comment field, e.g. en_comment for english comments + */ + String COMMENT_FIELD = "*_comment"; + String NAME_SPACE_FIELD = "nameSpace"; + String LOCAL_NAME_FIELD = "localName"; + String DESCRIPTION_FIELD = "*_desc"; + + public Collection getLanguages(); + + public Map getLabel(); + public Map getComment(); + public Map getDescription(); + public String getUri(); + public String getCode(); + public String getNameSpace(); + public String getLocalName(); +} \ No newline at end of file diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/INamed.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/INamed.java new file mode 100644 index 0000000..98f3066 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/INamed.java @@ -0,0 +1,38 @@ +package eu.nimble.service.catalog.search.impl.dao; + +public interface INamed { + String ID_FIELD = "id"; + /** + * Collection of languages + */ + String LANGUAGES_FIELD = "languages"; + /** + * The language based label, e.g. en_label for english label + */ + String LABEL_FIELD = "*_label"; + /** + * The language based label, e.g. en_alternate for english alternate label + */ + String ALTERNATE_LABEL_FIELD = "*_alternate"; + /** + * The language based label, e.g. en_label for english label + */ + String HIDDEN_LABEL_FIELD = "*_hidden"; + /** + * Copy Field, language based. The language based label and description are stored in this field + * Final used index name is en_txt for english text (label, description) + */ + String LANGUAGE_TXT_FIELD = "*_txt"; + /** + * Copy Field. All labels, descriptions are stored in this field + */ + String TEXT_FIELD = "_text_"; + /** + * The language based comment field, e.g. en_comment for english comments + */ + String COMMENT_FIELD = "*_comment"; + String NAME_SPACE_FIELD = "nameSpace"; + String LOCAL_NAME_FIELD = "localName"; + String DESCRIPTION_FIELD = "*_desc"; + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/IParty.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IParty.java new file mode 100644 index 0000000..09f0c79 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IParty.java @@ -0,0 +1,21 @@ +package eu.nimble.service.catalog.search.impl.dao; + +public interface IParty { + public String COLLECTION = "party"; + public String ID_FIELD = "id"; + public String BRAND_NAME_FIELD = "*_brandName"; + public String LEGAL_NAME_FIELD = "legalName"; + public String NAME_FIELD = "name"; + public String NAME_ML_FIELD = "*_name"; + public String ORIGIN_FIELD = "*_origin"; + public String CERTIFICATE_TYPE_FIELD = "*_certificateType"; + public String PPAP_COMPLIANCE_LEVEL_FIELD = "ppapComplianceLevel"; + public String PPAP_DOCUMENT_TYPE_FIELD = "*_ppapDocumentType"; + public String TRUST_SCORE_FIELD = "trustScore"; + public String TRUST_RATING_FIELD = "trustRating"; + public String TRUST_TRADING_VOLUME_FIELD = "trustTradingVolume"; + public String TRUST_SELLLER_COMMUNICATION_FIELD = "trustSellerCommunication"; + public String TRUST_FULFILLMENT_OF_TERMS_FIELD = "trustFullfillmentOfTerms"; + public String TRUST_DELIVERY_PACKAGING_FIELD = "trustDeliveryPackaging"; + public String TRUST_NUMBER_OF_TRANSACTIONS_FIELD = "trustNumberOfTransactions"; +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/IPropertyType.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IPropertyType.java new file mode 100644 index 0000000..183d114 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IPropertyType.java @@ -0,0 +1,14 @@ +package eu.nimble.service.catalog.search.impl.dao; + +public interface IPropertyType extends INamed { + String COLLECTION = "props"; + String TYPE_FIELD = "doctype"; + String TYPE_VALUE = "property"; + String IS_FACET_FIELD = "isFacet"; + String BOOST_FIELD = "boost"; + String RANGE_FIELD = "range"; + String VALUE_QUALIFIER_FIELD = "valueQualifier"; + String USED_WITH_FIELD = "used_in"; + String IDX_FIELD_NAME_FIELD = "idxField"; +} + diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/IndexFields.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IndexFields.java new file mode 100644 index 0000000..994de67 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IndexFields.java @@ -0,0 +1,73 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.ArrayList; +import java.util.List; + +public class IndexFields { + + private String fieldName; + private List differentFieldNames = new ArrayList(); + private String dataType; + private String dynamicBase; + private String uri; + private String mappedName; + private String dynamicPart; + public String getFieldName() { + return fieldName; + } + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + public String getDataType() { + return dataType; + } + public void setDataType(String dataType) { + this.dataType = dataType; + } + public String getDynamicBase() { + return dynamicBase; + } + public void setDynamicBase(String dynamicBase) { + this.dynamicBase = dynamicBase; + } + public String getUri() { + return uri; + } + public void setUri(String uri) { + this.uri = uri; + } + public String getMappedName() { + return mappedName; + } + public void setMappedName(String mappedName) { + this.mappedName = mappedName; + } + public String getDynamicPart() { + return dynamicPart; + } + public void setDynamicPart(String dynamicPart) { + this.dynamicPart = dynamicPart; + } + + public boolean isASingleFieldNameToBeConsidered(){ + return differentFieldNames.isEmpty()?true:false; + } + + public boolean isNultipleFieldNameToBeConsidered(){ + return differentFieldNames.isEmpty()?false:true; + } + + + + public List getDifferentFieldNames() { + return differentFieldNames; + } + @Override + public String toString() { + return "IndexFields [fieldName=" + fieldName + ", dataType=" + dataType + ", dynamicBase=" + dynamicBase + + ", uri=" + uri + ", mappedName=" + mappedName + ", dynamicPart=" + dynamicPart + "]"; + } + + + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/IndustryClassificationCode.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IndustryClassificationCode.java new file mode 100644 index 0000000..4240ca9 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/IndustryClassificationCode.java @@ -0,0 +1,27 @@ +package eu.nimble.service.catalog.search.impl.dao; + +public class IndustryClassificationCode { + private String name; + private float hjid; + + + // Getter Methods + + public String getName() { + return name; + } + + public float getHjid() { + return hjid; + } + + // Setter Methods + + public void setName(String name) { + this.name = name; + } + + public void setHjid(float hjid) { + this.hjid = hjid; + } +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/ItemMappingFieldInformation.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/ItemMappingFieldInformation.java new file mode 100644 index 0000000..89d0590 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/ItemMappingFieldInformation.java @@ -0,0 +1,108 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +public class ItemMappingFieldInformation { + + private String fieldName; + private String dataType; + private String dynamicBase; + private String dynamicPart; + private String mappedName; + private int docCount; + private String uri; + protected Map label; + + + + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + public String getDynamicBase() { + return dynamicBase; + } + + public void setDynamicBase(String dynamicBase) { + this.dynamicBase = dynamicBase; + } + + public String getDynamicPart() { + return dynamicPart; + } + + public void setDynamicPart(String dynamicPart) { + this.dynamicPart = dynamicPart; + } + + public String getMappedName() { + return mappedName; + } + + public void setMappedName(String mappedName) { + this.mappedName = mappedName; + } + + public int getDocCount() { + return docCount; + } + + public void setDocCount(int docCount) { + this.docCount = docCount; + } + + public String getUri() { + return uri; + } + + public void setUri(String uri) { + this.uri = uri; + } + + public Map getLabel() { + return label; + } + + public void addLabel(String language, String label) { + if ( this.label == null) { + this.label = new HashMap<>(); + } + this.label.put(language, label); + // + + } + + public void setLabel(Map labelMap) { + if ( labelMap != null ) { + for ( String key : labelMap.keySet() ) { + addLabel(key, labelMap.get(key)); + } + } + else { + this.label = null; + } + } + + @Override + public String toString() { + return "ItemMappingFieldInformation [fieldName=" + fieldName + ", dataType=" + dataType + ", dynamicBase=" + + dynamicBase + ", dynamicPart=" + dynamicPart + ", mappedName=" + mappedName + ", docCount=" + docCount + + ", uri=" + uri + ", label=" + label + "]"; + } + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/Named.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/Named.java new file mode 100644 index 0000000..e80691c --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/Named.java @@ -0,0 +1,148 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + + + +public abstract class Named { + /** + * The uri of the property including namespace + */ + + + protected String uri; + + + protected String localName; + + + protected String nameSpace; + + + protected Collection languages; + + protected Map label; + + protected Map> alternateLabel; + + protected Map> hiddenLabel; + + protected Map description; + + protected Map comment; + + public Named() { + super(); + } + + public Collection getLanguages() { + return languages; + } + + public void setLanguages(Collection languages) { + this.languages = languages; + } + + public Map getLabel() { + return label; + } + public void addLabel(String language, String label) { + if ( this.label == null) { + this.label = new HashMap<>(); + } + this.label.put(language, label); + // + addLanguage(language); + } + private void addLanguage(String language) { + if ( this.languages == null) { + this.languages = new HashSet(); + } + this.languages.add(language); + } + + public void setLabel(Map labelMap) { + if ( labelMap != null ) { + for ( String key : labelMap.keySet() ) { + addLabel(key, labelMap.get(key)); + } + } + else { + this.label = null; + } + } + + public Map getComment() { + return comment; + } + public void addComment(String language, String comment) { + if ( this.comment == null) { + this.comment = new HashMap<>(); + } + this.comment.put(language, comment); + // be sure to have all stored languages in the language list + addLanguage(language); + } + + public void setComment(Map commentMap) { + if ( commentMap != null ) { + for ( String key : commentMap.keySet() ) { + addComment(key, commentMap.get(key)); + } + } + else { + this.comment = null; + } + } + public void addDescription(String language, String desc) { + if ( this.description == null) { + this.description = new HashMap<>(); + } + this.description.put(language, desc); + // be sure to have all stored languages in the language list + addLanguage(language); + } + public Map getDescription() { + return description; + } + + public void setDescription(Map descMap) { + if ( descMap != null ) { + for ( String key : descMap.keySet() ) { + addComment(key, descMap.get(key)); + } + } + else { + this.comment = null; + } + } + public String getUri() { + return uri; + } + + public void setUri(String uri) { + this.uri = uri; + } + + public String getLocalName() { + return localName; + } + + public void setLocalName(String localName) { + this.localName = localName; + } + + public String getNameSpace() { + return nameSpace; + } + + public void setNameSpace(String nameSpace) { + this.nameSpace = nameSpace; + } + + + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/PartType.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PartType.java new file mode 100644 index 0000000..b498862 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PartType.java @@ -0,0 +1,108 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.ArrayList; + +public class PartType { + private String id; + ArrayList < Object > nace = new ArrayList < Object > (); + private String name; + private String websiteURI; + IndustryClassificationCode IndustryClassificationCodeObject; + private float ppapCompatibilityLevel; + ArrayList < Object > preferredItemClassificationCode = new ArrayList < Object > (); + ArrayList < Object > mostRecentItemsClassificationCode = new ArrayList < Object > (); + PostalAddress PostalAddressObject; + ArrayList < Object > partyTaxScheme = new ArrayList < Object > (); + Contact ContactObject; + ArrayList < Object > person = new ArrayList < Object > (); + ArrayList < Object > certificate = new ArrayList < Object > (); + ArrayList < Object > qualityIndicator = new ArrayList < Object > (); + ArrayList < Object > ppapDocumentReference = new ArrayList < Object > (); + ArrayList < Object > documentReference = new ArrayList < Object > (); + ArrayList < Object > industrySector = new ArrayList < Object > (); + PurchaseTerms PurchaseTermsObject; + private float hjid; + + + // Getter Methods + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getWebsiteURI() { + return websiteURI; + } + + public IndustryClassificationCode getIndustryClassificationCode() { + return IndustryClassificationCodeObject; + } + + public float getPpapCompatibilityLevel() { + return ppapCompatibilityLevel; + } + + public PostalAddress getPostalAddress() { + return PostalAddressObject; + } + + public Contact getContact() { + return ContactObject; + } + + public PurchaseTerms getPurchaseTerms() { + return PurchaseTermsObject; + } + + public float getHjid() { + return hjid; + } + + // Setter Methods + + public void setId(String id) { + this.id = id; + } + + public void setName(String name) { + this.name = name; + } + + public void setWebsiteURI(String websiteURI) { + this.websiteURI = websiteURI; + } + + public void setIndustryClassificationCode(IndustryClassificationCode industryClassificationCodeObject) { + this.IndustryClassificationCodeObject = industryClassificationCodeObject; + } + + public void setPpapCompatibilityLevel(float ppapCompatibilityLevel) { + this.ppapCompatibilityLevel = ppapCompatibilityLevel; + } + + public void setPostalAddress(PostalAddress postalAddressObject) { + this.PostalAddressObject = postalAddressObject; + } + + public void setContact(Contact contactObject) { + this.ContactObject = contactObject; + } + + public void setPurchaseTerms(PurchaseTerms purchaseTermsObject) { + this.PurchaseTermsObject = purchaseTermsObject; + } + + public void setHjid(float hjid) { + this.hjid = hjid; + } + } + + + + + + diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/PartyType.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PartyType.java new file mode 100644 index 0000000..f270254 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PartyType.java @@ -0,0 +1,225 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +public class PartyType extends Concept implements IParty { + +// @Indexed(name=NAME_FIELD) +// private String name; + private String legalName; + private Map brandName; + private Map origin; + private Map> certificateType; + private Integer ppapComplianceLevel; + private Map ppapDocumentType; + private Double trustScore; + private Double trustRating; + private Double trustTradingVolume; + private Double trustSellerCommunication; + private Double trustFullfillmentOfTerms; + private Double trustDeliveryPackaging; + private Double trustNumberOfTransactions; + public String getId() { + return getUri(); + } + public void setId(String id) { + setUri(id); + } +// public String getName() { +// return name; +// } +// public void setName(String name) { +// this.name = name; +// } + + /** + * Getter for the multilingual origin labels + */ + public Map getOrigin() { + return origin; + } + public void setOrigin(Map originMap) { + if ( originMap != null ) { + for ( String key : originMap.keySet() ) { + addOrigin(key, originMap.get(key)); + } + } + else { + this.origin = null; + } + } + /** + * Helper method for adding a multilingual origin to the concept. Only one origin per language is stored. + * This method maintains the list of languages in use, see {@link #getLanguages()} + * @param language The language code such as en, es + * @param label The respective label for the origin + */ + public void addOrigin(String language, String label) { + if ( this.origin == null) { + this.origin = new HashMap<>(); + } + this.origin.put(language, label); + // + addLanguage(language); + } + /** + * Getter for the multilingual origin labels + */ + public Map getBrandName() { + return brandName; + } + public void setBrandName(Map brandNameMap) { + if ( brandNameMap != null ) { + for ( String key : brandNameMap.keySet() ) { + addBrandName(key, brandNameMap.get(key)); + } + } + else { + this.brandName = null; + } + } + /** + * Helper method for adding a multilingual origin to the concept. Only one origin per language is stored. + * This method maintains the list of languages in use, see {@link #getLanguages()} + * @param language The language code such as en, es + * @param label The respective label for the brandName + */ + public void addBrandName(String language, String label) { + if ( this.brandName == null) { + this.brandName = new HashMap<>(); + } + this.brandName.put(language, label); + // + addLanguage(language); + } + + + public Map> getCertificateType() { + return certificateType; + } + + /** + * Setter for the certificateType labels + * @param certificateTypeMap + */ + public void setCertificateType(Map> certificateTypeMap) { + if ( certificateTypeMap != null ) { + for ( String lang : certificateTypeMap.keySet() ) { + for (String label : certificateTypeMap.get(lang)) { + addCertificateType(lang, label); + + } + } + } + else { + this.certificateType = null; + } + } + /** + * Helper method for adding a (multilingual) label to the list of certificat types + * @param language + * @param certificatTypeLabel + */ + public void addCertificateType(String language, String certificatTypeLabel) { + if (this.certificateType ==null) { + this.certificateType = new HashMap<>(); + } + if ( !this.certificateType.containsKey(language)) { + this.certificateType.put(language, new HashSet<>()); + } + this.certificateType.get(language).add(certificatTypeLabel); + // + addLanguage(language); + } + + public Integer getPpapComplianceLevel() { + return ppapComplianceLevel; + } + public void setPpapComplianceLevel(Integer ppapComplianceLevel) { + this.ppapComplianceLevel = ppapComplianceLevel; + } + + public Double getTrustScore() { + return trustScore; + } + public void setTrustScore(Double trustScore) { + this.trustScore = trustScore; + } + public Double getTrustRating() { + return trustRating; + } + public void setTrustRating(Double trustRating) { + this.trustRating = trustRating; + } + public Double getTrustTradingVolume() { + return trustTradingVolume; + } + public void setTrustTradingVolume(Double trustTradingVolume) { + this.trustTradingVolume = trustTradingVolume; + } + public Double getTrustSellerCommunication() { + return trustSellerCommunication; + } + public void setTrustSellerCommunication(Double trustSellerCommunication) { + this.trustSellerCommunication = trustSellerCommunication; + } + public Double getTrustFullfillmentOfTerms() { + return trustFullfillmentOfTerms; + } + public void setTrustFullfillmentOfTerms(Double trustFullfillmentOfTerms) { + this.trustFullfillmentOfTerms = trustFullfillmentOfTerms; + } + public Double getTrustDeliveryPackaging() { + return trustDeliveryPackaging; + } + public void setTrustDeliveryPackaging(Double trustDeliveryPackaging) { + this.trustDeliveryPackaging = trustDeliveryPackaging; + } + public Double getTrustNumberOfTransactions() { + return trustNumberOfTransactions; + } + public void setTrustNumberOfTransactions(Double trustNumberOfTransactions) { + this.trustNumberOfTransactions = trustNumberOfTransactions; + } + public String getLegalName() { + return legalName; + } + public void setLegalName(String legalName) { + this.legalName = legalName; + } + /** + * Getter for the multilingual origin labels + */ + public Map getPpapDocumentType() { + return ppapDocumentType; + } + public void setPpapDocumentType(Map originMap) { + if ( originMap != null ) { + for ( String key : originMap.keySet() ) { + addLabel(key, originMap.get(key)); + } + } + else { + this.ppapDocumentType = null; + } + } + /** + * Helper method for adding a multilingual PPAP Document Type labels to the concept. Only one label per language is stored. + * This method maintains the list of languages in use, see {@link #getLanguages()} + * @param language The language code such as en, es + * @param label The respective label for the PPAP Document Type + */ + public void addPpapDocumentType(String language, String label) { + if ( this.ppapDocumentType == null) { + this.ppapDocumentType = new HashMap<>(); + } + this.ppapDocumentType.put(language, label); + // + addLanguage(language); + } + + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/PostalAddress.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PostalAddress.java new file mode 100644 index 0000000..f2d393f --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PostalAddress.java @@ -0,0 +1,63 @@ +package eu.nimble.service.catalog.search.impl.dao; + +public class PostalAddress { + private String streetName; + private String buildingNumber; + private String cityName; + private String postalZone; + Country CountryObject; + private float hjid; + + + // Getter Methods + + public String getStreetName() { + return streetName; + } + + public String getBuildingNumber() { + return buildingNumber; + } + + public String getCityName() { + return cityName; + } + + public String getPostalZone() { + return postalZone; + } + + public Country getCountry() { + return CountryObject; + } + + public float getHjid() { + return hjid; + } + + // Setter Methods + + public void setStreetName(String streetName) { + this.streetName = streetName; + } + + public void setBuildingNumber(String buildingNumber) { + this.buildingNumber = buildingNumber; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public void setPostalZone(String postalZone) { + this.postalZone = postalZone; + } + + public void setCountry(Country countryObject) { + this.CountryObject = countryObject; + } + + public void setHjid(float hjid) { + this.hjid = hjid; + } +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/PropertyRelevance.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PropertyRelevance.java new file mode 100644 index 0000000..769b13f --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PropertyRelevance.java @@ -0,0 +1,48 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.Date; + +public class PropertyRelevance { + + private boolean isItRelevant = true; + private boolean hasItBeenChecked = false; + private Date lastCheck = null; + + public PropertyRelevance(){ + lastCheck = new Date(); + } + + public boolean isItRelevant() { + return isItRelevant; + } + + public void setItRelevant(boolean isItRelevant) { + this.isItRelevant = isItRelevant; + } + + public boolean isHasItBeenChecked() { + return hasItBeenChecked; + } + + public void setHasItBeenChecked(boolean hasItBeenChecked) { + this.hasItBeenChecked = hasItBeenChecked; + } + + public Date getLastCheck() { + return lastCheck; + } + + public void setLastCheck(Date lastCheck) { + this.lastCheck = lastCheck; + } + + @Override + public String toString() { + return "PropertyRelevance [isItRelevant=" + isItRelevant + ", hasItBeenChecked=" + hasItBeenChecked + + ", lastCheck=" + lastCheck + "]"; + } + + + + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/PropertyType.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PropertyType.java new file mode 100644 index 0000000..8ca1550 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PropertyType.java @@ -0,0 +1,156 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.Collection; +import java.util.HashSet; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import de.biba.triple.store.access.enums.ConceptSource; + +/** + * SOLR Document holding the properties out of any ontologies including label, + * range and the usage in distinct classes + * + * @author dglachs + * + */ +public class PropertyType extends Named implements IPropertyType { + /** + * The uri of the property including namespace + */ + private String type = TYPE_VALUE; + + private String range; + + private String valueQualifier; + + private Collection product; + + private Collection itemFieldNames; + + private boolean facet = true; + + private Double boost; + + private boolean visible; + + private ConceptSource conceptSource; + + public String getRange() { + return range; + } + + public void setRange(String range) { + this.range = range; + } + + public Collection getProduct() { + if (product == null) { + product = new HashSet(); + } + return product; + } + + public void addProduct(String className) { + if (this.product == null) { + this.product = new HashSet<>(); + } + } + + public void setProduct(Collection className) { + this.product = className; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Collection getItemFieldNames() { + return itemFieldNames; + } + + public void setItemFieldNames(Collection idxFieldNames) { + this.itemFieldNames = idxFieldNames; + } + + public String getValueQualifier() { + return valueQualifier; + } + + public void setValueQualifier(String valueQualifier) { + this.valueQualifier = valueQualifier; + } + + @JsonIgnore + public boolean isFacet() { + return facet; + } + + public void setFacet(boolean facet) { + this.facet = facet; + } + + @JsonIgnore + public Double getBoost() { + return boost; + } + + public void setBoost(Double boost) { + this.boost = boost; + } + + public boolean isVisible() { + return visible; + } + + public void setVisible(boolean visible) { + this.visible = visible; + } + + public ConceptSource getConceptSource() { + return conceptSource; + } + + public void setConceptSource(ConceptSource conceptSource) { + this.conceptSource = conceptSource; + } + + @Override + public String toString() { + return "PropertyType [type=" + type + ", range=" + range + ", valueQualifier=" + valueQualifier + ", product=" + + product + ", itemFieldNames=" + itemFieldNames + ", facet=" + facet + ", boost=" + boost + + ", visible=" + visible + ", conceptSource=" + conceptSource + "]"; + } + + @Override + public boolean equals(Object o) { + + // If the object is compared with itself then return true + if (o == this) { + return true; + } + + /* + * Check if o is an instance of Complex or not "null instanceof [type]" + * also returns false + */ + if (!(o instanceof PropertyType)) { + return false; + } + + // typecast o to Complex so that we can compare data members + PropertyType c = (PropertyType) o; + + // Compare the data members and return accordingly + return c.getItemFieldNames().equals(this.getItemFieldNames() ); + } + + @Override + public int hashCode() { + return 1; + } +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/PurchaseTerms.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PurchaseTerms.java new file mode 100644 index 0000000..7060ace --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/PurchaseTerms.java @@ -0,0 +1,23 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.ArrayList; + +public class PurchaseTerms { + ArrayList < Object > tradingTerms = new ArrayList < Object > (); + ArrayList < Object > deliveryTerms = new ArrayList < Object > (); + ArrayList < Object > paymentMeans = new ArrayList < Object > (); + private float hjid; + + + // Getter Methods + + public float getHjid() { + return hjid; + } + + // Setter Methods + + public void setHjid(float hjid) { + this.hjid = hjid; + } +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/SearchConfig.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/SearchConfig.java new file mode 100644 index 0000000..061ecaa --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/SearchConfig.java @@ -0,0 +1,48 @@ +package eu.nimble.service.catalog.search.impl.dao; + +public class SearchConfig { + + private boolean IndexingActive = false; + private String urlOfIOndexingService = ""; + private boolean useSOLRIndex = false; + private String hybridConfiguration = ""; + private String marmottaUri =""; + + + + + + public String getMarmottaUri() { + return marmottaUri; + } + public void setMarmottaUri(String marmottaUri) { + this.marmottaUri = marmottaUri; + } + public String getHybridConfiguration() { + return hybridConfiguration; + } + public void setHybridConfiguration(String hybridConfiguration) { + this.hybridConfiguration = hybridConfiguration; + } + public boolean isIndexingActive() { + return IndexingActive; + } + public void setIndexingActive(boolean indexingActive) { + IndexingActive = indexingActive; + } + public String getUrlOfIOndexingService() { + return urlOfIOndexingService; + } + public void setUrlOfIOndexingService(String urlOfIOndexingService) { + this.urlOfIOndexingService = urlOfIOndexingService; + } + public boolean isUseSOLRIndex() { + return useSOLRIndex; + } + public void setUseSOLRIndex(boolean useSOLRIndex) { + this.useSOLRIndex = useSOLRIndex; + } + + + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/UBLResult.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/UBLResult.java new file mode 100644 index 0000000..3029909 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/UBLResult.java @@ -0,0 +1,48 @@ +package eu.nimble.service.catalog.search.impl.dao; + +import java.util.ArrayList; +import java.util.List; + + +public class UBLResult { +private int totalElements; +private int totalPages; +private int pageSize; + +private int currentPage; +private List result = new ArrayList<>(); +public int getTotalElements() { + return totalElements; +} +public void setTotalElements(int totalElements) { + this.totalElements = totalElements; +} +public int getTotalPages() { + return totalPages; +} +public void setTotalPages(int totalPages) { + this.totalPages = totalPages; +} +public int getPageSize() { + return pageSize; +} +public void setPageSize(int pageSize) { + this.pageSize = pageSize; +} +public int getCurrentPage() { + return currentPage; +} +public void setCurrentPage(int currentPage) { + this.currentPage = currentPage; +} +public List getResult() { + return result; +} +public void setResult(List result) { + this.result = result; +} + + + + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/ValueQualifier.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/ValueQualifier.java new file mode 100644 index 0000000..2730417 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/ValueQualifier.java @@ -0,0 +1,10 @@ +package eu.nimble.service.catalog.search.impl.dao; + +public enum ValueQualifier { + NUMBER, + QUANTITY, + BOOLEAN, + STRING, + TEXT, + ; +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/enums/TypeOfDataSource.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/enums/TypeOfDataSource.java index 54a13d8..e642ca9 100644 --- a/src/main/java/eu/nimble/service/catalog/search/impl/dao/enums/TypeOfDataSource.java +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/enums/TypeOfDataSource.java @@ -2,7 +2,7 @@ public enum TypeOfDataSource { - LOCAL_ONTOLOGY, MARMOTTA, SOLR, UNKOWN; + LOCAL_ONTOLOGY, MARMOTTA, SOLR, INDEXING_SERVICE,UNKOWN; public static TypeOfDataSource fromString(String str){ if (str.equals(LOCAL_ONTOLOGY.toString())){ diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParamaterForExecuteSelect.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParamaterForExecuteSelect.java index 2bd7225..7d7169f 100644 --- a/src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParamaterForExecuteSelect.java +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParamaterForExecuteSelect.java @@ -91,4 +91,12 @@ public void setParametersURL(List parametersURL) { this.parametersURL = parametersURL; } + @Override + public String toString() { + return "InputParamaterForExecuteSelect [concept=" + concept + ", language=" + language + ", parameters=" + + parameters + ", parametersURL=" + parametersURL + ", parametersIncludingPath=" + + parametersIncludingPath + ", filters=" + filters + ", orangeCommandSelected=" + orangeCommandSelected + + ", propertySources=" + propertySources + "]"; + } + } diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParameterdetectMeaningLanguageSpecific.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParameterdetectMeaningLanguageSpecific.java index 0505364..2ca5026 100644 --- a/src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParameterdetectMeaningLanguageSpecific.java +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParameterdetectMeaningLanguageSpecific.java @@ -6,6 +6,7 @@ public class InputParameterdetectMeaningLanguageSpecific { String keyword; String language; + long userID =0; public Language getLanguage(){ return Language.fromString(language); @@ -22,5 +23,20 @@ public void setKeyword(String keyword) { public void setLanguage(String language) { this.language = language; } + + public long getUserID() { + return userID; + } + + public void setUserID(long userID) { + this.userID = userID; + } + + @Override + public String toString() { + return "InputParameterdetectMeaningLanguageSpecific [keyword=" + keyword + ", language=" + language + + ", userID=" + userID + "]"; + } + } diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/item/ItemType.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/item/ItemType.java new file mode 100644 index 0000000..0f6fac2 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/item/ItemType.java @@ -0,0 +1,1079 @@ +package eu.nimble.service.catalog.search.impl.dao.item; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import org.springframework.util.StringUtils; + +import com.google.common.base.CaseFormat; + +import eu.nimble.service.catalog.search.impl.dao.Concept; +import eu.nimble.service.catalog.search.impl.dao.ICatalogueItem; +import eu.nimble.service.catalog.search.impl.dao.PartyType; +import eu.nimble.service.catalog.search.impl.dao.ValueQualifier; + +public class ItemType extends Concept implements ICatalogueItem, Serializable { + public static String QUALIFIED_DELIMITER = "@"; + private static final long serialVersionUID = -3631731059281154372L; + + /** + * The indexed item must have a type value assigned for proper handling of + * nested documents + */ + + private String type = TYPE_VALUE; + /** + * The ID of the catalogue the item belongs to + */ + + private String catalogueId; + + // PRICE & Currency + + private Map currencyMap = new HashMap<>(); + + private Map currencyValue = new HashMap<>(); + + private Set applicableCountries; + // FREE of charge indicator + + private Boolean freeOfCharge; + // certification types + + private Set certificateType; + + // delivery time(s) + + private Map deliveryTimeUnit = new HashMap<>(); + + private Map deliveryTime = new HashMap<>(); + /** + * Map holding a list of used Unit's for packaging The + */ + + private Map packageUnit = new HashMap<>(); + /** + * Map holding the amounts per package unit + */ + + private Map> packageAmounts = new HashMap<>(); + /** + * Id of the corresponding manufacturer + */ + + private String manufacturerId; + + private String manufactuerItemId; + // Transportation Service Details + + private Set serviceType; + + private String supportedProductNature; + + private String supportedCargoType; + + private String emissionStandard; + + /** + * Possibility for joining to product class index + */ + + private List classificationUri; + // + + private Map propertyMap = new HashMap<>(); + // + + private Map> stringValue = new HashMap<>(); + + private Map booleanValue = new HashMap<>(); + + private Map> doubleValue = new HashMap<>(); + + private Collection imgageUri; + + private Collection incoterms; + + private Double minimumOrderQuantity; + + private Double warrantyValidityPeriod; + /** + * List containing multilingual labels for product classification + * + */ + + private List classification; + /** + * Read only field - used to provide the manufacturer's details in a search + * result + */ + + private PartyType manufacturer; + + private Map customProperties; + + /** + * Setter for the dynamic string properties. + * + * Method is for deserializing from JSON, do not use directly + * + * @param qualifier + * @param values + */ + public void setStringProperty(String qualifier, Collection values) { + this.stringValue.put(dynamicKey(qualifier, propertyMap), values); + } + + /** + * Add a new string based property + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param value + * The value of the property + */ + public void addProperty(String qualifier, String value) { + String key = dynamicKey(qualifier, propertyMap); + Collection values = stringValue.get(key); + if (values == null) { + values = new HashSet(); + this.stringValue.put(key, values); + } + // + values.add(value); + } + + /** + * Add a new string based property + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param value + * The value of the property + * @param meta + * A detailed property description holding multi lingual labels + */ + public void addProperty(String qualifier, String value, PropertyType meta) { + addProperty(qualifier, value); + if (meta != null) { + // ensure the proper valueQualifier + addCustomProperty(qualifier, meta, ValueQualifier.STRING); + } + } + + /** + * Add a new numeric (double) property + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param unit + * Additional qualifier + * @param value + * The value of the property + */ + public void addProperty(String qualifier, String unit, Double value) { + String key = dynamicKey(propertyMap, qualifier, unit); + Collection values = doubleValue.get(key); + if (values == null) { + values = new HashSet(); + this.doubleValue.put(key, values); + } + // + values.add(value); + } + + /** + * Add a new numeric (double) property + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param unit + * Additional qualifier + * @param value + * The value of the property + * @param meta + * A detailed property description holding multi lingual labels + */ + public void addProperty(String qualifier, String unit, Double value, PropertyType meta) { + addProperty(qualifier, unit, value); + if (meta != null) { + // ensure the proper valueQualifier + addCustomProperty(qualifier, unit, meta, ValueQualifier.QUANTITY); + } + } + + /** + * Add a new string property + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param unit + * Additional qualifier, such as the language + * @param value + * The value of the property + * @param meta + * A detailed property description holding multi lingual labels + * @deprecated Use + * {@link #addMultiLingualProperty(String, String, String, PropertyType)} + */ + @Deprecated + public void addProperty(String qualifier, String unit, String value, PropertyType meta) { + addMultiLingualProperty(qualifier, unit, value, meta); + } + + /** + * Setter for the double properties, used for deserializing from JSON. Do + * not use directly + * + * @param qualifier + * @param values + */ + private void setDoubleProperty(String qualifier, Collection values) { + if (qualifier.contains("@")) { + String qualifiedValue = qualifiedValue(qualifier); + String qualifierUnit = qualifiedUnit(qualifier); + for (Double d : values) { + addProperty(qualifiedValue, qualifierUnit, d); + } + } else { + for (Double d : values) { + addProperty(qualifier, d); + } + } + } + + /** + * Add a new numeric double property + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param value + * The value of the property + */ + public void addProperty(String qualifier, Double value) { + String key = dynamicKey(qualifier, propertyMap); + Collection values = doubleValue.get(key); + if (values == null) { + values = new HashSet(); + this.doubleValue.put(key, values); + } + // + values.add(value); + } + + /** + * Add a new numeric double property + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param value + * The value of the property + * @param meta + * A detailed property description holding multi lingual labels + */ + public void addProperty(String qualifier, Double value, PropertyType meta) { + addProperty(qualifier, value); + if (meta != null) { + // + addCustomProperty(qualifier, meta, ValueQualifier.NUMBER); + } + } + + /** + * Helper method maintaining the list of custom property descriptions + * + * @param qualifier + * The qualifier to use for the index name and for the mapping to + * the custom property + * @param unit + * The unit of the actual usage - full qualifier including unit + * is used for mapping as well + * @param meta + * The detailed property description holding multilingual labels + * @param valueQualfier + * The basic type of the property, see {@link ValueQualifier} for + * complete list + */ + private void addCustomProperty(String qualifier, String unit, PropertyType meta, ValueQualifier valueQualfier) { + String key = dynamicFieldPart(qualifier); + String full = dynamicFieldPart(qualifier, unit); + if (customProperties == null) { + customProperties = new HashMap<>(); + } + // String idxField = dynamicFieldPart(qualifier, unit); + // meta.addItemFieldName(idxField); + // + if (!customProperties.containsKey(key)) { + customProperties.put(key, meta); + } + // add the qualifier "including" the unit + PropertyType pt = customProperties.get(key); + pt.setValueQualifier(valueQualfier); + pt.addItemFieldName(key); + pt.addItemFieldName(full); + + } + + /** + * Helper method maintaining the list of custom property descriptions + * + * @param qualifier + * The qualifier to use for the index name and for the mapping to + * the custom property + * @param meta + * The detailed property description holding multilingual labels + * @param valueQualfier + * The basic type of the property, see {@link ValueQualifier} for + * complete list + */ + private void addCustomProperty(String qualifier, PropertyType meta, ValueQualifier valueQualifier) { + String part = dynamicFieldPart(qualifier); + if (customProperties == null) { + customProperties = new HashMap<>(); + } + if (!customProperties.containsKey(part)) { + customProperties.put(part, meta); + } + // add the qualifier "including" the unit + PropertyType pt = customProperties.get(part); + pt.setValueQualifier(valueQualifier); + pt.addItemFieldName(part); + } + + /** + * Add a new string property + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param unit + * Additional qualifier, such as the language + * @param value + * The value of the property + * @deprecated Use {@link #addMultiLingualProperty(String, String, String)} + */ + @Deprecated + public void addProperty(String qualifier, String unit, String value) { + addMultiLingualProperty(qualifier, unit, value); + } + + /** + * Add a new string property, the text and the language are are combined to + * text@language. + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param unit + * Additional qualifier, such as the language + * @param value + * The value of the property + */ + public void addMultiLingualProperty(String qualifier, String language, String text) { + String key = dynamicKey(propertyMap, qualifier); + Collection values = this.stringValue.get(key); + if (values == null) { + values = new HashSet(); + this.stringValue.put(key, values); + } + // + values.add(String.format("%s@%s", text, language)); + + } + + /** + * Add a new string property, the text and the language are are combined to + * text@language. + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param unit + * Additional qualifier, such as the language + * @param value + * The value of the property + * @param meta + * A detailed description of the property including multi lingual + * labels + */ + public void addMultiLingualProperty(String qualifier, String language, String text, PropertyType meta) { + addMultiLingualProperty(qualifier, language, text); + if (meta != null) { + // ensure the proper valueQualifier + addCustomProperty(qualifier, meta, ValueQualifier.STRING); + } + } + + /** + * Obtain a multi-lingual property for the given qualifier and the desired + * language, null if no value can be found. + * + * @param qualifier + * The qualifier used when storing the multi lingual property + * value + * @param language + * The language code, such as en, es + * @return The multi lingual property or null + */ + public String getMultiLingualProperty(String qualifier, String language) { + String key = dynamicFieldPart(qualifier); + if (this.stringValue.get(key) != null && !this.stringValue.get(key).isEmpty()) { + Optional prop = this.stringValue.get(key).stream().filter(new Predicate() { + + @Override + public boolean test(String t) { + if (language.equalsIgnoreCase(qualifiedUnit(t))) { + return true; + } + return false; + } + + }).map(new Function() { + + @Override + public String apply(String t) { + return qualifiedValue(t); + } + }).findFirst(); + return prop.orElse(null); + } + return null; + + } + + /** + * Obtain a list of multilingual property values + * + * @param qualifier + * The qualifier used when storing the multi lingual property + * value + * @param language + * The language code, such as en, es + * @return A list of multi lingual property values for the desired languag, + * empty list when no value present + */ + public List getMultiLingualProperties(String qualifier, String language) { + String key = dynamicFieldPart(qualifier); + if (this.stringValue.get(key) != null && !this.stringValue.get(key).isEmpty()) { + List prop = this.stringValue.get(key).stream().filter(new Predicate() { + + @Override + public boolean test(String t) { + if (language.equalsIgnoreCase(qualifiedUnit(t))) { + return true; + } + return false; + } + + }).map(new Function() { + + @Override + public String apply(String t) { + return qualifiedValue(t); + } + }).collect(Collectors.toList()); + return prop; + } + return new ArrayList<>(); + } + + /** + * Helper method to extract the value portion of the multilingual label + * + * @param t + * @return + */ + public static String qualifiedValue(String t) { + int delim = t.lastIndexOf("@"); + if (delim > 0) { + return t.substring(0, delim); + } + return t; + + } + + /** + * Helper method to extract the language portion of the multilingual label + * + * @param t + * @return + */ + public static String qualifiedUnit(String t) { + int delim = t.lastIndexOf("@"); + if (delim > 0 && t.length() > delim + 1) { + return t.substring(delim + 1); + } + return null; + + } + + /** + * Obtain the collection of numeric properties stored with the provided + * qualifier + * + * @param qualifier + * The qualifier used when storing the numeric values + * @param unit + * The unit extension used when storing the numeric values + * @return The list of stored values, may return null when not found! + */ + public Collection getProperty(String qualifier, String unit) { + String key = dynamicFieldPart(qualifier, unit); + return this.doubleValue.get(key); + } + + /** + * Getter for the boolean properties, used for serializing. The qualifiers + * originally used when storing are restored and used as keys. + * + * @return + */ + public Map getBooleanValue() { + Map result = new HashMap<>(); + for (String dynUnitKey : this.propertyMap.keySet()) { + if (booleanValue.containsKey(dynUnitKey)) { + result.put(propertyMap.get(dynUnitKey), booleanValue.get(dynUnitKey)); + } + } + return result; + } + + /** + * Setter for boolean properties, used for deserializing JSON, not intended + * to be used directly + * + * @param booleanValue + */ + public void setBooleanValue(Map booleanValue) { + if (booleanValue != null) { + for (String key : booleanValue.keySet()) { + this.booleanValue.put(dynamicKey(key, propertyMap), booleanValue.get(key)); + } + } else { + this.booleanValue = booleanValue; + } + } + + public Map getBooleanValueDirect() { + + return booleanValue; + } + + /** + * Getter for the string properties, used for serializing. The qualifiers + * originally used when storing are restored and used as keys. + * + * @return + */ + public Map> getStringValue() { + Map> result = new HashMap<>(); + for (String dynUnitKey : this.propertyMap.keySet()) { + if (stringValue.containsKey(dynUnitKey)) { + result.put(propertyMap.get(dynUnitKey), stringValue.get(dynUnitKey)); + } + } + return result; + } + + public Map> getStringValueDirect() { + + return stringValue; + } + + /** + * Getter for the double values, used for serializing. The qualifiers + * originally used when storing are restored and used as key. + * + * @return + */ + public Map> getDoubleValue() { + Map> result = new HashMap<>(); + for (String dynUnitKey : this.propertyMap.keySet()) { + if (doubleValue.containsKey(dynUnitKey)) { + result.put(propertyMap.get(dynUnitKey), doubleValue.get(dynUnitKey)); + } + } + return result; + } + + public Map> getDoubleValueDirect() { + + return doubleValue; + } + + /** + * Setter for the string values, used for deserializing, do not use directly + * + * @param stringValue + */ + public void setStringValue(Map> stringValue) { + if (stringValue != null) { + for (String key : stringValue.keySet()) { + setStringProperty(key, stringValue.get(key)); + } + } else { + this.stringValue = stringValue; + } + } + + /** + * Setter for the double values, used for deserializing, do not use directly + * + * @param doubleValue + */ + public void setDoubleValue(Map> doubleValue) { + if (doubleValue != null) { + for (String key : doubleValue.keySet()) { + setDoubleProperty(key, doubleValue.get(key)); + } + } else { + this.doubleValue = doubleValue; + } + } + + /** + * Setter for a boolean property + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param value + * The boolean value to store + */ + public void setProperty(String qualifier, Boolean value) { + this.booleanValue.put(dynamicKey(qualifier, propertyMap), value); + } + + /** + * Setter for a boolean property + * + * @param qualifier + * To be used as dynamic field name in index, see + * {@link #dynamicFieldPart(String)} + * @param value + * The boolean value to store + * @param meta + * A detailed description of the property holding multilingual + * labels + */ + public void setProperty(String qualifier, Boolean value, PropertyType meta) { + setProperty(qualifier, value); + if (meta != null) { + // + addCustomProperty(qualifier, meta, ValueQualifier.BOOLEAN); + } + } + + /** + * For proper distinction of catalogue items and nested documents, the item + * must hava a type field + * + * @see #TYPE_VALUE + * @return + */ + + public String getTypeValue() { + return type; + } + + /** + * Setter for the type value + * + * @param type + */ + public void setTypeValue(String type) { + this.type = type; + } + + /** + * Getter for the catalog id + * + * @return + */ + public String getCatalogueId() { + return catalogueId; + } + + /** + * Setter for the catalog id + * + * @param catalogueId + */ + public void setCatalogueId(String catalogueId) { + this.catalogueId = catalogueId; + } + + // this.languages = language; + public Boolean getFreeOfCharge() { + return freeOfCharge; + } + + public void setFreeOfCharge(Boolean freeOfCharge) { + this.freeOfCharge = freeOfCharge; + } + + public Set getCertificateType() { + return certificateType; + } + + public void setCertificateType(Set certificateType) { + this.certificateType = certificateType; + } + + public Set getApplicableCountries() { + return applicableCountries; + } + + public void setApplicableCountries(Set applicableCountries) { + this.applicableCountries = applicableCountries; + } + + public String getManufacturerId() { + if (manufacturer != null && manufacturer.getId() != null) { + return manufacturer.getId(); + } + return manufacturerId; + } + + public void setManufacturerId(String manufacturerId) { + this.manufacturerId = manufacturerId; + } + + public Set getServiceType() { + return serviceType; + } + + public void setServiceType(Set serviceType) { + this.serviceType = serviceType; + } + + public String getSupportedProductNature() { + return supportedProductNature; + } + + public void setSupportedProductNature(String supportedProductNature) { + this.supportedProductNature = supportedProductNature; + } + + public String getSupportedCargoType() { + return supportedCargoType; + } + + public void setSupportedCargoType(String supportedCargoType) { + this.supportedCargoType = supportedCargoType; + } + + public String getEmissionStandard() { + return emissionStandard; + } + + public void setEmissionStandard(String emissionStandard) { + this.emissionStandard = emissionStandard; + } + + public void addPrice(String currency, Double price) { + this.currencyValue.put(dynamicKey(currency, this.currencyMap), price); + } + + public Collection getCurrency() { + return this.currencyMap.values(); + } + + public void setCurrency(Collection currency) { + this.currencyMap.clear(); + for (String c : currency) { + dynamicKey(c, this.currencyMap); + } + } + + public Map getPrice() { + Map ret = new HashMap<>(); + for (String key : currencyMap.keySet()) { + ret.put(currencyMap.get(key), currencyValue.get(key)); + } + return ret; + } + + public void setPrice(Map price) { + this.currencyValue.clear(); + for (String c : price.keySet()) { + addPrice(c, price.get(c)); + } + } + + public Map getDeliveryTimeUnit() { + return deliveryTimeUnit; + } + + public Collection getDeliveryTimeUnits() { + return this.deliveryTimeUnit.values(); + } + + public void setDeliveryTimeUnits(Collection units) { + this.deliveryTimeUnit.clear(); + for (String unit : units) { + // update the packageUnit + dynamicKey(unit, this.deliveryTimeUnit); + } + } + + /** + * Add a new delivery time to the item. + * + * @param unit + * The unit such as Week(s), Day(s) + * @param time + * The amount of the delivery time unit + */ + public void addDeliveryTime(String unit, Double time) { + this.deliveryTime.put(dynamicKey(unit, this.deliveryTimeUnit), time); + } + + /** + * Getter for the delivery times per unit + * + * @return + */ + public Map getDeliveryTime() { + Map result = new HashMap<>(); + for (String dynUnitKey : this.deliveryTimeUnit.keySet()) { + result.put(deliveryTimeUnit.get(dynUnitKey), deliveryTime.get(dynUnitKey)); + } + return result; + } + + public void setDeliveryTime(Map deliveryTime) { + this.deliveryTime.clear(); + for (String c : deliveryTime.keySet()) { + addDeliveryTime(c, deliveryTime.get(c)); + } + } + + /** + * Internally the package units hold + * + * @return + */ + public Map getPackageUnit() { + return packageUnit; + } + + public Collection getPackageUnits() { + return this.packageUnit.values(); + } + + public void setPackageUnits(Collection units) { + this.packageUnit.clear(); + for (String unit : units) { + // update the packageUnit + dynamicKey(unit, this.packageUnit); + } + } + + public void addPackageAmounts(String unit, List amounts) { + this.packageAmounts.put(dynamicKey(unit, this.packageUnit), amounts); + ; + } + + /** + * Getter for the package amounts per unit + * + * @return + */ + public Map> getPackageAmounts() { + Map> result = new HashMap<>(); + for (String dynUnitKey : this.packageUnit.keySet()) { + result.put(packageUnit.get(dynUnitKey), packageAmounts.get(dynUnitKey)); + } + return result; + } + + public void setPackageAmounts(Map> packageAmountPerUnit) { + this.packageAmounts.clear(); + for (String key : packageAmountPerUnit.keySet()) { + addPackageAmounts(key, packageAmountPerUnit.get(key)); + } + } + + public PartyType getManufacturer() { + return manufacturer; + } + + public void setManufacturer(PartyType manufacturer) { + this.manufacturer = manufacturer; + } + + public List getClassification() { + if (classification == null) { + classification = new ArrayList<>(); + } + return classification; + } + + public void addClassification(Concept c) { + getClassification().add(c); + } + + public void setClassification(List classification) { + this.classification = classification; + } + + public List getClassificationUri() { + return classificationUri; + } + + public void setClassificationUri(List classificationUri) { + this.classificationUri = classificationUri; + } + + public Collection getImgageUri() { + return imgageUri; + } + + public void setImgageUri(Collection imgageUri) { + this.imgageUri = imgageUri; + } + + /** + * Getter for custom properties, used for serializing to JSON + * + * @return + */ + public Map getCustomProperties() { + return customProperties; + } + + /** + * Setter for custom properties, used for deserializing from JSON. Do not + * use directly - instead use the addProperty ... methods + *
    + *
  • {@link #addProperty(String, Double, PropertyType)} + *
  • {@link #addProperty(String, String, PropertyType)} + *
  • {@link #addProperty(String, String, Double, PropertyType)} + *
  • {@link #addMultiLingualProperty(String, String, String, PropertyType)} + *
  • + * + * @param customProperties + */ + public void setCustomProperties(Map customProperties) { + this.customProperties = customProperties; + } + + /** + * Helper method to create the index field's name part and to maintain the + * label for the corresponding name map + * + * @param keyVal + * @param keyMap + * @return + */ + private String dynamicKey(String keyVal, Map keyMap) { + String key = dynamicFieldPart(keyVal); + keyMap.put(key, keyVal); + return key; + } + + /** + * Helper method combining multiple key parts, e.q. qualifier and unit + * + * @param keyMap + * @param keyPart + * @return + */ + private String dynamicKey(Map keyMap, String... keyPart) { + String key = dynamicFieldPart(keyPart); + // use @ as delimiter + keyMap.put(key, String.join("@", keyPart)); + return key; + } + + /** + * Static helper method transforming a qualifier into a valid dynamic field + * part + * + * @param qualifier + * The qualifier used when adding dynamic properties + */ + public static String dynamicFieldPart(String qualifier) { + if (!StringUtils.hasText(qualifier)) { + // when no unit code specified - use "undefined"; + return "undefined"; + } + String dynamicFieldPart = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, qualifier); + dynamicFieldPart = dynamicFieldPart.replaceAll("[^a-zA-Z0-9_ ]", ""); + dynamicFieldPart = dynamicFieldPart.trim().replaceAll(" ", "_").toUpperCase(); + dynamicFieldPart = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, dynamicFieldPart); + return dynamicFieldPart; + + } + + /** + * Static helper method transforming multiple qualifier into a valid dynamic + * field part + * + * @param strings + * The qualifiers used when adding dynamic properties + * @return + */ + public static String dynamicFieldPart(String... strings) { + List parts = new ArrayList<>(); + for (String part : strings) { + parts.add(dynamicFieldPart(part)); + } + return dynamicFieldPart(String.join("_", parts)); + } + + public Map getPropertyMap() { + return propertyMap; + } + + public Collection getIncoterms() { + return incoterms; + } + + public void setIncoterms(Collection incoterms) { + this.incoterms = incoterms; + } + + public Double getMinimumOrderQuantity() { + return minimumOrderQuantity; + } + + public void setMinimumOrderQuantity(Double minimumOrderQuantity) { + this.minimumOrderQuantity = minimumOrderQuantity; + } + + public Double getWarrantyValidityPeriod() { + return warrantyValidityPeriod; + } + + public void setWarrantyValidityPeriod(Double warrantyValidityPeriod) { + this.warrantyValidityPeriod = warrantyValidityPeriod; + } + + public String getManufactuerItemId() { + return manufactuerItemId; + } + + public void setManufactuerItemId(String manufactuerItemId) { + this.manufactuerItemId = manufactuerItemId; + } + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/item/PropertyType.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/item/PropertyType.java new file mode 100644 index 0000000..7ea394a --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/item/PropertyType.java @@ -0,0 +1,135 @@ +package eu.nimble.service.catalog.search.impl.dao.item; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; + +import eu.nimble.service.catalog.search.impl.dao.Concept; +import eu.nimble.service.catalog.search.impl.dao.IPropertyType; +import eu.nimble.service.catalog.search.impl.dao.ValueQualifier; + +public class PropertyType extends Concept implements IPropertyType { + /** + * The uri of the property including namespace + */ + private String type = TYPE_VALUE; + + private String range; + + private ValueQualifier valueQualifier; + + private Collection product; + + private Collection items; + + private Collection itemFieldNames; + + private boolean facet = true; + + private Double boost; + + private String propertyType; + + public String getPropertyType() { + return propertyType; + } + + public void setPropertyType(String propertyType) { + this.propertyType = propertyType; + } + + public String getRange() { + return range; + } + + public void setRange(String range) { + this.range = range; + } + + public Collection getProduct() { + if (product == null ) { + product = new HashSet(); + } + return product; + } + public void addProduct(String className) { + if ( this.product == null ) { + this.product = new HashSet<>(); + } + } + public void setProduct(Collection className) { + this.product = className; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Collection getItemFieldNames() { + return itemFieldNames; + } + + public void setItemFieldNames(Collection idxFieldNames) { + this.itemFieldNames = idxFieldNames; + } + public void addItemFieldName(String idxField) { + if (itemFieldNames==null) { + itemFieldNames=new HashSet<>(); + } + else if (! (itemFieldNames instanceof Set)) { + // ensure to have a new set (to avoid duplicates) + itemFieldNames = itemFieldNames.stream().collect(Collectors.toSet()); + } + this.itemFieldNames.add(idxField); + } + + public ValueQualifier getValueQualifier() { + return valueQualifier; + } + + public void setValueQualifier(ValueQualifier valueQualifier) { + this.valueQualifier = valueQualifier; + } + public boolean isFacet() { + return facet; + } + + public void setFacet(boolean facet) { + this.facet = facet; + } + public Double getBoost() { + return boost; + } + + public void setBoost(Double boost) { + this.boost = boost; + } + + + public Collection getItems() { + return items; + } + + public void setItems(Collection items) { + this.items = items; + } + public void addItem(String uri) { + if ( items == null ) { + items = new HashSet<>(); + } + items.add(uri); + } + public boolean removeItem(String item) { + if ( items == null ) { + return false; + } + return items.remove(item); + + } + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/impl/dao/item/SOLRResult.java b/src/main/java/eu/nimble/service/catalog/search/impl/dao/item/SOLRResult.java new file mode 100644 index 0000000..93755b9 --- /dev/null +++ b/src/main/java/eu/nimble/service/catalog/search/impl/dao/item/SOLRResult.java @@ -0,0 +1,46 @@ +package eu.nimble.service.catalog.search.impl.dao.item; + +import java.util.ArrayList; +import java.util.List; + +public class SOLRResult { +private int totalElements; +private int totalPages; +private int pageSize; +private int currentPage; +private List result = new ArrayList<>(); +public int getTotalElements() { + return totalElements; +} +public void setTotalElements(int totalElements) { + this.totalElements = totalElements; +} +public int getTotalPages() { + return totalPages; +} +public void setTotalPages(int totalPages) { + this.totalPages = totalPages; +} +public int getPageSize() { + return pageSize; +} +public void setPageSize(int pageSize) { + this.pageSize = pageSize; +} +public int getCurrentPage() { + return currentPage; +} +public void setCurrentPage(int currentPage) { + this.currentPage = currentPage; +} +public List getResult() { + return result; +} +public void setResult(List result) { + this.result = result; +} + + + + +} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorEntryPoint.java b/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorEntryPoint.java deleted file mode 100644 index e7cb93c..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorEntryPoint.java +++ /dev/null @@ -1,30 +0,0 @@ -package eu.nimble.service.catalog.search.mediator; - -import com.google.gson.Gson; - -import eu.nimble.service.catalog.search.impl.dao.input.InputParameter; -import eu.nimble.service.catalog.search.mediator.datatypes.MediatorResult; - -public class MediatorEntryPoint { - - private String configPath; -private InputParameter parameter; - - public MediatorEntryPoint(String configPath, InputParameter parameter) { - // TODO Auto-generated constructor stub - this.configPath = configPath; - this.parameter = parameter; - } - - public MediatorResult query() { - MediatorWebservice mediatorWebservice = new MediatorWebservice(configPath); - String query = parameter.getUserData()[0]; - String namespace = parameter.getUserData()[1]; - String query2 = "{\"namespace\":\"http://www.semanticweb.org/dqu/ontologies/2016/1/untitled-ontology-43\",\"query\":\"select ?Customer ?CustomerID where { ?Customer a \u003cCustomer\u003e. ?Customer \u003cCustomerID\u003e ?CustomerID.}\"}"; - query = "{\"namespace\":\""+namespace + "\",\"query\":\"" + query + "\"}"; - System.out.println(query); - System.out.println(query2); - return mediatorWebservice.query(query, false); - } - -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorResult.java b/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorResult.java deleted file mode 100644 index 2e28858..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorResult.java +++ /dev/null @@ -1,12 +0,0 @@ -package eu.nimble.service.catalog.search.mediator; - -import org.springframework.util.MultiValueMap; - -public class MediatorResult { - - public MultiValueMap toOutput(String typeOfOutput) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorSPARQLDerivationAndExecution.java b/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorSPARQLDerivationAndExecution.java deleted file mode 100644 index df4e507..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorSPARQLDerivationAndExecution.java +++ /dev/null @@ -1,1164 +0,0 @@ -package eu.nimble.service.catalog.search.mediator; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.apache.jena.sparql.function.library.uuid; - -import de.biba.triple.store.access.IPropertyValuesCrawler; -import de.biba.triple.store.access.IReader; -import de.biba.triple.store.access.dmo.Entity; -import de.biba.triple.store.access.enums.Language; -import de.biba.triple.store.access.enums.PropertyType; -import de.biba.triple.store.access.jena.PropertyValuesCrawler; -import de.biba.triple.store.access.jena.Reader; -import de.biba.triple.store.access.marmotta.MarmottaPropertyValuesCrawler; -import de.biba.triple.store.access.marmotta.MarmottaReader; -import eu.nimble.service.catalog.search.factories.ValueGroupingFactory; -import eu.nimble.service.catalog.search.impl.dao.DataPoint; -import eu.nimble.service.catalog.search.impl.dao.Filter; -import eu.nimble.service.catalog.search.impl.dao.Group; -import eu.nimble.service.catalog.search.impl.dao.LocalOntologyView; -import eu.nimble.service.catalog.search.impl.dao.enums.PropertySource; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteOptionalSelect; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteSelect; -import eu.nimble.service.catalog.search.impl.dao.input.InputParameterForGetReferencesFromAConcept; -import eu.nimble.service.catalog.search.impl.dao.input.InputParameterForPropertyValuesFromOrangeGroup; -import eu.nimble.service.catalog.search.impl.dao.input.InputParameterdetectMeaningLanguageSpecific; -import eu.nimble.service.catalog.search.impl.dao.input.Parameter; -import eu.nimble.service.catalog.search.impl.dao.input.Tuple; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForExecuteSelect; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertiesFromConcept; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertyFromConcept; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertyValuesFromOrangeGroup; -import eu.nimble.service.catalog.search.impl.dao.output.TranslationResult; -import eu.nimble.service.catalog.search.impl.dao.sqp.SQPConfiguration; -import eu.nimble.service.catalog.search.services.SQPDerivationService; - -public class MediatorSPARQLDerivationAndExecution { - - public static final String FURNITURE2_OWL = "furniture2.owl"; - private IReader reader = null; - private IPropertyValuesCrawler propertyValuesCrawler = null; - private String languagelabel = null; - private NimbleSpecificSPARQLDeriviationAndExecution nimbleSpecificSPARQLDeriviation = null; - private SQPDerivationService sqpDerivationService = null; - - public MediatorSPARQLDerivationAndExecution() { - File f = new File(FURNITURE2_OWL); - if (f.exists()) { - initForSpecificOntology(FURNITURE2_OWL); - } else { - Logger.getAnonymousLogger().log(Level.WARNING, "Cannot load default ontology: " + FURNITURE2_OWL); - } - } - - public MediatorSPARQLDerivationAndExecution(String pntologyFile) { - initForSpecificOntology(pntologyFile); - - } - - public void updatesqpDerivationService(SQPDerivationService sqpDerivationService) { - this.nimbleSpecificSPARQLDeriviation = new NimbleSpecificSPARQLDeriviationAndExecution(reader, - sqpDerivationService, this); - this.sqpDerivationService = sqpDerivationService; - } - - public MediatorSPARQLDerivationAndExecution(String uri, boolean remote, SQPDerivationService sqpDerivationService) { - if (!remote) { - initForSpecificOntology(uri); - updatesqpDerivationService(sqpDerivationService); - - } else { - reader = new MarmottaReader(uri); - propertyValuesCrawler = new MarmottaPropertyValuesCrawler(uri); - reader.setLanguageLabel(languagelabel); - this.nimbleSpecificSPARQLDeriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - (MarmottaReader) reader, sqpDerivationService, this); - this.sqpDerivationService = sqpDerivationService; - } - - } - - public void initForMarmotta(String url, SQPDerivationService sqpDerivationService) { - reader = new MarmottaReader(url); - reader.setModeToRemote(); - reader.setLanguageLabel(languagelabel); - this.nimbleSpecificSPARQLDeriviation = new NimbleSpecificSPARQLDeriviationAndExecution((MarmottaReader) reader, - sqpDerivationService, this); - this.sqpDerivationService = sqpDerivationService; - } - - public void initForSpecificOntology(String pntologyFile) { - - reader = new Reader(); - reader.setModeToLocal(); - reader.loadOntologyModel(pntologyFile); - reader.setLanguageLabel(languagelabel); - - propertyValuesCrawler = new PropertyValuesCrawler(); - propertyValuesCrawler.setModeToLocal(); - propertyValuesCrawler.loadOntologyModel(pntologyFile); - - this.nimbleSpecificSPARQLDeriviation = new NimbleSpecificSPARQLDeriviationAndExecution(reader, - sqpDerivationService, this); - this.sqpDerivationService = sqpDerivationService; - } - - public OutputForExecuteSelect createSPARQLAndExecuteIT( - InputParamaterForExecuteSelect inputParamaterForExecuteSelect) { - - extendRequestedPropertiesWithRespectToOrangeCommands(inputParamaterForExecuteSelect); - - if (!(reader instanceof MarmottaReader)) { - - String sparql = createSparql(inputParamaterForExecuteSelect); - Logger.getAnonymousLogger().log(Level.INFO, sparql); - - Object ouObject = reader.query(sparql); - // This is necessary to get the uuid for each instance - inputParamaterForExecuteSelect.getParameters().add(0, "instance"); - String[] params = new String[inputParamaterForExecuteSelect.getParameters().size()]; - inputParamaterForExecuteSelect.getParameters().toArray(params); - reduceEachParamToItsName(params); - - for (int i = 0; i < params.length; i++) { - if (params[i].contains("#")) { - params[i] = params[i].substring(params[i].indexOf("#") + 1); - } - } - - List resultList = reader.createResultListArray(ouObject, params); - OutputForExecuteSelect outputForExecuteSelect = new OutputForExecuteSelect(); - outputForExecuteSelect.setInput(inputParamaterForExecuteSelect); - - inputParamaterForExecuteSelect.getParameters().remove(0); // Must be - // removed - // the - // uuid - // is - // not - // part - // of - // the - // result - createLanguageSpecificHeader(inputParamaterForExecuteSelect, outputForExecuteSelect); - - // add uuid to result data structures - for (String[] row : resultList) { - outputForExecuteSelect.getUuids().add(row[0]); - } - - addRowsToOutputForExecuteSelect(resultList, outputForExecuteSelect, 1); // NO - // uuid - // should - // be - // inserted - - return outputForExecuteSelect; - } else { - if (reader instanceof MarmottaReader) { - NimbleSpecificSPARQLFactory sparqlFactory = new NimbleSpecificSPARQLFactory(this, sqpDerivationService); - List queries = sparqlFactory.createSparql(inputParamaterForExecuteSelect, reader, true, true); - Map> intermediateResult = new HashMap>(); - String[] params = new String[] { "instance", "property", "hasValue" }; - //List columns = new ArrayList(); - - for (String sparql : queries) { - Object ouObject = reader.query(sparql); - List resultList = reader.createResultListArray(ouObject, params); - for (String[] instance : resultList) { - String uuid = instance[0]; - String property = instance[1]; -// if (!columns.contains(property)) { -// columns.add(property); -// } - String value = instance[2]; - if (inputParamaterForExecuteSelect.getParametersURL().contains(property)){ - DataPoint dataPoint = new DataPoint(); - dataPoint.setPropertyURL(property); - dataPoint.setValue(value); - if (intermediateResult.containsKey(uuid)) { - intermediateResult.get(uuid).add(dataPoint); - } else { - List datapoints = new ArrayList(); - datapoints.add(dataPoint); - intermediateResult.put(uuid, datapoints); - } - } - - } - - } - OutputForExecuteSelect outputForExecuteSelect = new OutputForExecuteSelect(); - outputForExecuteSelect.setInput(inputParamaterForExecuteSelect); -// for (int i = 0; i < columns.size(); i++) { -// String c = columns.get(i); -// c = c.substring(c.indexOf("#") + 1); -// columns.set(i, c); -// } - //outputForExecuteSelect.setColumns(columns); - for (String key : intermediateResult.keySet()) { - outputForExecuteSelect.getUuids().add(key); - List dataPoints = intermediateResult.get(key); - ArrayList data = new ArrayList(); - Map propertyValues = new HashMap(); - for (DataPoint dataPoint : dataPoints) { - String type = dataPoint.getPropertyURL(); - String value = dataPoint.getValue(); - value = value.substring(value.lastIndexOf("^") + 1); - if (propertyValues.containsKey(type)) { - String finalValue = propertyValues.get(type); - finalValue = finalValue + ";" + value; - propertyValues.put(type, finalValue); - } else { - propertyValues.put(type, value); - } - - } - - for (String keyMap : propertyValues.keySet()) { - data.add(propertyValues.get(keyMap)); - } - - if (propertyValues.keySet().size()== inputParamaterForExecuteSelect.getParametersURL().size()){ - if (outputForExecuteSelect.getColumns().size()==0){ - List columns = new ArrayList(); - for (String keyMap : propertyValues.keySet()) { - String c = keyMap; - c = c.substring(c.indexOf("#") + 1); - columns.add(c); - } - outputForExecuteSelect.getColumns().addAll(columns); - } - - - } - outputForExecuteSelect.getRows().add(data); - - - } - // cleanUP - int index = 0; - List rowsToBeDeleted = new ArrayList(); - for (List oneRow : outputForExecuteSelect.getRows()){ - if (oneRow.size() < inputParamaterForExecuteSelect.getParametersURL().size()){ - rowsToBeDeleted.add(index); - } - index++; - } - int deletedCount =0; - for (int indexToBeDelted : rowsToBeDeleted){ - int updatedIndexToBeDeleted = indexToBeDelted-deletedCount; - outputForExecuteSelect.getRows().remove(updatedIndexToBeDeleted); - outputForExecuteSelect.getUuids().remove(updatedIndexToBeDeleted); - deletedCount++; - } - - - return outputForExecuteSelect; - } - return new OutputForExecuteSelect(); - } - } - - private void extendRequestedPropertiesWithRespectToOrangeCommands( - InputParamaterForExecuteSelect inputParamaterForExecuteSelect) { - int index = 0; - for (String parameter : inputParamaterForExecuteSelect.getParameters()) { - if (sqpDerivationService.isITSAQPCommand(parameter)) { - SQPConfiguration sqpConfiguration = sqpDerivationService.getSpecificSQPConfiguration(parameter); - String[] pathTokens = sqpConfiguration.getSQPMapping().getTarget().getTargetPathFromSource().split(";"); - String targetProperty = sqpConfiguration.getSQPMapping().getTarget().getTargetProperty(); - Parameter parameter2 = inputParamaterForExecuteSelect.getParametersIncludingPath().get(index); - inputParamaterForExecuteSelect.getParameters().set(index, targetProperty); - parameter2.setUrlOfProperty(targetProperty); - parameter2.getPath().clear(); - - Tuple t1 = new Tuple(); - t1.setConcept(inputParamaterForExecuteSelect.getConcept()); - t1.setUrlOfProperty(null); - parameter2.getPath().add(t1); - - for (String token : pathTokens) { - Tuple tuple = new Tuple(); - parameter2.getPath().add(tuple); - tuple.setUrlOfProperty(token); - } - - } else { - Logger.getAnonymousLogger().log(Level.WARNING, "Cannot find orange command: " + parameter); - } - index++; - } - - // Adapt to speciifc orange commands - for (String name : inputParamaterForExecuteSelect.getOrangeCommandSelected().getNames()) { - if (sqpDerivationService.isITSAQPCommand(name)) { - SQPConfiguration sqpConfiguration = sqpDerivationService.getSpecificSQPConfiguration(name); - String[] pathTokens = sqpConfiguration.getSQPMapping().getTarget().getTargetPathFromSource().split(";"); - String targetProperty = sqpConfiguration.getSQPMapping().getTarget().getTargetProperty(); - Parameter parameter2 = new Parameter(); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter2); - inputParamaterForExecuteSelect.getParameters().add(targetProperty); - parameter2.setUrlOfProperty(targetProperty); - parameter2.getPath().clear(); - - Tuple t1 = new Tuple(); - t1.setConcept(inputParamaterForExecuteSelect.getConcept()); - t1.setUrlOfProperty(null); - parameter2.getPath().add(t1); - - for (String token : pathTokens) { - Tuple tuple = new Tuple(); - parameter2.getPath().add(tuple); - tuple.setUrlOfProperty(token); - } - } else { - Logger.getAnonymousLogger().log(Level.WARNING, "Cannot find orange command: " + name); - } - } - - } - - public void reduceEachParamToItsName(String[] params) { - for (int i = 0; i < params.length; i++) { - String param = params[i]; - param = extractNameOfURL(param); - params[i] = param; - } - } - - public void createLanguageSpecificHeader(InputParamaterForExecuteSelect inputParamaterForExecuteSelect, - OutputForExecuteSelect outputForExecuteSelect) { - for (String prop : inputParamaterForExecuteSelect.getParameters()) { - if (!prop.contains("#")) { - prop = getURIOfProperty(prop); - } - if (inputParamaterForExecuteSelect.getLanguage() != null) { - String label = translateConcept(prop, inputParamaterForExecuteSelect.getLanguage(), this.languagelabel) - .getTranslation(); - outputForExecuteSelect.getColumns().add(label); - } else { - Logger.getAnonymousLogger().log(Level.WARNING, - "No language set for input: " + inputParamaterForExecuteSelect); - String label = extractNameOfURL(prop); - outputForExecuteSelect.getColumns().add(label); - } - - } - // outputForExecuteSelect.getColumns().addAll(inputParamaterForExecuteSelect.getParameters()); - } - - public OutputForExecuteSelect createOPtionalSPARQLAndExecuteIT( - InputParamaterForExecuteOptionalSelect inputParamaterForExecuteOptionalSelect) { - - // This is/ necessary to get the uuid for each instance - Map result = reader - .getPropertyValuesOfAIndividium(inputParamaterForExecuteOptionalSelect.getUuid()); - - OutputForExecuteSelect outputForExecuteSelect = new OutputForExecuteSelect(); - - // If the NImble specific Marmotta structure is applied, a additional - // postprocessing is required - if (needANimbleSpecificAdapation()) { - result = nimbleSpecificSPARQLDeriviation.resolveOPtionalSPARQLAndExecuteITToFinalPropertyValues(result, - inputParamaterForExecuteOptionalSelect.getUuid()); - } - - ArrayList row = new ArrayList(); - for (String key : result.keySet()) { - Language language = inputParamaterForExecuteOptionalSelect.getLanguage(); - String column = translateProperty(key, language, this.languagelabel).getTranslation(); - outputForExecuteSelect.getColumns().add(column); - - String value = result.get(key); - if (value != null && value.length() > 0) { - int index = -1; - index = value.indexOf("^^"); - if (index > -1) { - value = value.substring(0, index); - } - - row.add(value); - } else { - row.add(" "); - } - - } - - // Have to extend the result with the orange stuff - if (inputParamaterForExecuteOptionalSelect.getOrangeCommandSelected().getNames().size() > 0) { - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct "; - String[] columns = new String[inputParamaterForExecuteOptionalSelect.getOrangeCommandSelected().getNames() - .size()]; - int index = 0; - for (String name : inputParamaterForExecuteOptionalSelect.getOrangeCommandSelected().getNames()) { - sparql += " ?" + name + " "; - columns[index] = name; - outputForExecuteSelect.getColumns().add(name); - index++; - } - sparql += " where {"; - for (String name : inputParamaterForExecuteOptionalSelect.getOrangeCommandSelected().getNames()) { - String lastSubject = "<" + inputParamaterForExecuteOptionalSelect.getUuid() + ">"; - - SQPConfiguration configuration = sqpDerivationService.getSpecificSQPConfiguration(name); - String[] tokens = sqpDerivationService.splitTargetConfiguration(configuration); - for (String token : tokens) { - String shortToken = token.substring(token.indexOf("#") + 1); - sparql += lastSubject + "<" + token + "> ?" + shortToken + " ."; - lastSubject = "?" + shortToken; - } - sparql += lastSubject + "<" + configuration.getSQPMapping().getTarget().getTargetProperty() + ">" + "?" - + name + "."; - } - sparql += "}"; - Object resultSet = reader.query(sparql); - List data = reader.createResultListArray(resultSet, columns); - if (data != null && data.size() > 0) { - String[] firstrow = data.get(0); - for (String str : firstrow) { - row.add(str); - } - } - } - outputForExecuteSelect.getRows().add(row); - return outputForExecuteSelect; - } - - public void addRowsToOutputForExecuteSelect(List resultList, - OutputForExecuteSelect outputForExecuteSelect, int startIndex) { - for (int i = 0; i < resultList.size(); i++) { - ArrayList row = new ArrayList(); - for (int a = startIndex; a < resultList.get(i).length; a++) { - String value = resultList.get(i)[a]; - if (value != null && value.length() > 0) { - int index = -1; - index = value.indexOf("^^"); - if (index > -1) { - value = value.substring(0, index); - } - } - row.add(value); - } - outputForExecuteSelect.getRows().add(row); - } - } - - /** - * The query creates a sparql select for the given concept and properties. - * The method should work in two cases, if the name of the property or the - * overall url is given. - * - * @param inputParamaterForExecuteSelect - * includes the URL of cocnept and set of properties (name from - * the url or url) - * @return working sparql query - */ - // protected String createSparql(InputParamaterForExecuteSelect - // inputParamaterForExecuteSelect) { - // // TODO Auto-generated method stub - // String concept = - // getURIOfConcept(inputParamaterForExecuteSelect.getConcept()); - // - // Map resolvedProperties = new HashMap(); - // for (String param : inputParamaterForExecuteSelect.getParameters()) { - // String parameter = getURIOfProperty(param); - // - // param = extractNameOfURL(param); - // - // resolvedProperties.put(param, parameter); - // } - // - // String sparql = "PREFIX rdf: - // PREFIX owl: - // PREFIX rdfs: - // PREFIX xsd: - // select distinct ?instance "; - // for (String param : inputParamaterForExecuteSelect.getParameters()) { - // - // param = extractNameOfURL(param); - // sparql += " ?" + param; - // } - // - // sparql += " where{"; - // - // // add cocnept mapping: - // sparql += "?x rdfs:subClassOf* <" + concept + ">. "; - // sparql += "?instance a ?x."; - // sparql = addProperties(inputParamaterForExecuteSelect, - // resolvedProperties, sparql); - // sparql = addFilters(inputParamaterForExecuteSelect, resolvedProperties, - // sparql); - // sparql += "}"; - // return sparql; - // } - - /** - * just for test purpose - * - */ - protected String createSparql(InputParamaterForExecuteSelect inputParamaterForExecuteSelect, Reader reader) { - this.reader = reader; - return createSparql(inputParamaterForExecuteSelect); - } - - protected String createSparql(InputParamaterForExecuteSelect inputParamaterForExecuteSelect) { - // TODO Auto-generated method stub - String concept = getURIOfConcept(inputParamaterForExecuteSelect.getConcept()); - - Map resolvedProperties = new HashMap(); - int counter = 0; - for (String param : inputParamaterForExecuteSelect.getParameters()) { - String parameter = ""; - if (inputParamaterForExecuteSelect.getParametersURL().size() > counter) { - parameter = inputParamaterForExecuteSelect.getParametersURL().get(counter); - } else { - parameter = getURIOfProperty(param); - } - - param = extractNameOfURL(param); - - resolvedProperties.put(param, parameter); - counter++; - } - - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?instance "; - for (String param : inputParamaterForExecuteSelect.getParameters()) { - - param = extractNameOfURL(param); - sparql += " ?" + param; - } - - sparql += " where{"; - - if (!(reader instanceof MarmottaReader)) { - // add cocnept mapping: - sparql += "?x rdfs:subClassOf* <" + concept + ">. "; - sparql += "?instance a ?x."; - sparql = addProperties(inputParamaterForExecuteSelect, resolvedProperties, sparql); - sparql = addFilters(inputParamaterForExecuteSelect, resolvedProperties, sparql); - sparql += "}"; - } - - if (reader instanceof MarmottaReader) { - // sparql += "?instance (rdf:type | rdfs:subClassOf*/rdfs:subClassOf - // )" + "<" + concept + ">."; - // sparql += "?instance a" + "<" + concept + ">."; - - List allRelfexivAndSubClasses = reader.getAllTransitiveSubConcepts(concept); - if (!allRelfexivAndSubClasses.contains(concept)) { - allRelfexivAndSubClasses.add(concept); - } - // apply the query provided by Ditmar - String preQuiery = " VALUES ?classes {"; - String classes = ""; - for (String myClass : allRelfexivAndSubClasses) { - classes += "<" + myClass + "> "; - } - sparql += preQuiery + classes + "}"; - - sparql = addProperties(inputParamaterForExecuteSelect, resolvedProperties, sparql); - sparql = addFilters(inputParamaterForExecuteSelect, resolvedProperties, sparql); - sparql += "}"; - } - - return sparql; - } - - public String extractNameOfURL(String param) { - if (param.contains("#")) { - param = param.substring(param.indexOf("#") + 1); - } - return param; - } - - /** - * Generate a filter which is useable for decimal values - * - * @param inputParamaterForExecuteSelect - * @param resolvedProperties - * @param sparql - * @return - */ - private String addFilters(InputParamaterForExecuteSelect inputParamaterForExecuteSelect, - Map resolvedProperties, String sparql) { - String filter = ""; - for (Filter fil : inputParamaterForExecuteSelect.getFilters()) { - String filterText = ""; - String shortName = fil.getProperty(); - if (shortName == null) { - Logger.getAnonymousLogger().log(Level.WARNING, - "Filter cannot be applied without property name: " + fil); - continue; - } - - shortName = extractNameOfURL(shortName); - if (fil.isHasMaxBeenSet() && fil.isHasMinBeenSet()) { - filterText += "FILTER ( xsd:decimal(?" + shortName + ") <= xsd:decimal(" + fil.getMax() + "))."; - filterText += "FILTER ( xsd:decimal(?" + shortName + ") >= xsd:decimal(" + fil.getMin() + "))."; - } else { - // FILTER (?name="South"^^xsd:string) - if (fil.getExactValue().matches("[0-9]+\\.*[0-9]*")) { - filterText += "FILTER(?" + shortName + "= " + fil.getExactValue() + ")"; - } else { - - filterText += "FILTER(str(?" + shortName + ")= \"" + fil.getExactValue() + "\" ^^xsd:string)"; - } - } - filter += filterText; - } - - return sparql + filter; - } - - public String addProperties(InputParamaterForExecuteSelect inputParamaterForExecuteSelect, - Map resolvedProperties, String sparql) { - for (int i = 0; i < inputParamaterForExecuteSelect.getParameters().size(); i++) { - - String param = inputParamaterForExecuteSelect.getParameters().get(i); - - param = extractNameOfURL(param); - - String property = resolvedProperties.get(param); - - if (isJustADirectDatatypePropertyOfRoot( - inputParamaterForExecuteSelect.getParametersIncludingPath().get(i))) { - - sparql += "?instance " + "<" + property + "> " + "?" + param + "."; - } else { - String lastVariable = null; - for (Tuple tuple : inputParamaterForExecuteSelect.getParametersIncludingPath().get(i).getPath()) { - - if (tuple.getUrlOfProperty() != null) { - String prop = tuple.getUrlOfProperty(); - String shortProp = prop.substring(prop.lastIndexOf("#") + 1); - shortProp = "?" + shortProp; - String toBeUsed = "?instance"; - if (lastVariable != null) { - toBeUsed = lastVariable; - } - sparql += toBeUsed + "<" + tuple.getUrlOfProperty() + "> " + shortProp + "."; - lastVariable = shortProp; - } - } - // Have to add it for the dataproperty - sparql += lastVariable + "<" + property + "> " + "?" + param + "."; - } - } - return sparql; - } - - public boolean isJustADirectDatatypePropertyOfRoot(Parameter parameter) { - return (parameter.getPath().size() == 1) ? true : false; - - } - - // InputParameterdetectMeaningLanguageSpecific - // inputParameterdetectMeaningLanguageSpecific - public List detectPossibleConcepts( - InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific) { - Logger.getAnonymousLogger().log(Level.INFO, "Apply reader: " + reader.getClass().toString()); - return reader.getAllConcepts(inputParameterdetectMeaningLanguageSpecific.getKeyword()); - } - - /** - * Translation Concept: Returns the translation if available as String. - * Otherwise it delivers NA - * - * @param uri - * @param language - * @param languagelabel - * The label in which the translations are codified. if no label - * property available, please set to null - * @return Returns the translation if available as String. Otherwise it - * delivers uri - */ - public TranslationResult translateConcept(String uri, Language language, String languageLabel) { - return translateEntity(uri, language, languageLabel); - - } - - /** - * Translation Property: Returns the translation if available as String. - * Otherwise it delivers uri - * - * @param uri - * @param language - * @param languagelabel - * The label in which the translations are codified. if no label - * property available, please set to null - * @return Returns the translation if available as String. Otherwise it - * delivers NA - */ - public TranslationResult translateProperty(String uri, Language language, String languageLabel) { - return translateEntity(uri, language, languageLabel); - } - - private TranslationResult translateEntity(String uri, Language language, String languageLabel) { - TranslationResult translationResult = new TranslationResult(); - translationResult.setSuccess(false); - translationResult.setOriginal(uri); - // String namespace = uri.substring(0, uri.indexOf("#")); - String query = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: SELECT ?subject ?object WHERE { <" - + uri + "> <" + languageLabel + "> ?object.}"; - if (reader == null) { - Logger.getAnonymousLogger().log(Level.WARNING, "Ontology Reader is null. The init fails"); - } else { - - if (uri.contains("http") || (uri.contains("https"))) { - - Object result = reader.query(query); - List translations = reader.createResultList(result, "object"); - if (translations.size() > 0) { - String postfix = Language.toOntologyPostfix(language); - if (postfix != null) { - for (String lang : translations) { - if (lang.contains(postfix)) { - - translationResult.setTranslation(lang.substring(0, lang.indexOf(postfix))); - translationResult.setSuccess(true); - return translationResult; - } - } - } - } - } - translationResult.setTranslation(uri.substring(uri.indexOf("#") + 1)); - } - return translationResult; - - } - - public List detectPossibleConcepts(String regex) { - Logger.getAnonymousLogger().log(Level.INFO, "Apply reader: " + reader.getClass().toString()); - if (reader == null) { - Logger.getAnonymousLogger().log(Level.WARNING, "Ontology Reader is null. The init fails"); - } else { - return reader.getAllConcepts(regex); - } - return Collections.emptyList(); - } - - - - public List detectPossibleConceptsLanguageSpecific(String regex, Language language, String translationLabel, - boolean useSimplifiedSPARQL) { - Logger.getAnonymousLogger().log(Level.INFO, "Apply reader: " + reader.getClass().toString()); - Logger.getAnonymousLogger().log(Level.INFO, "Language specific serach for: " + language.toString()); - reader.setLanguageLabel(translationLabel); - List langaues = reader.getNativeSupportedLangauges(); - - if (reader == null) { - Logger.getAnonymousLogger().log(Level.WARNING, "Ontology Reader is null. The init failed"); - } else { - - List concepts = new ArrayList(); - - if (needANimbleSpecificAdapation()) { - - concepts.clear(); - concepts.addAll(nimbleSpecificSPARQLDeriviation - .detectNimbleSpecificMeaningFromAKeywordReferringToInstances(regex, - - translationLabel, language, useSimplifiedSPARQL)); - nimbleSpecificSPARQLDeriviation.removeInternalConceptsToHideItForTheUser(concepts); - } else { - if (langaues.contains(language)) { - Logger.getAnonymousLogger().log(Level.INFO, "Apply language specific serach: " + language); - concepts = reader.getAllConceptsLanguageSpecific(regex, language); - } else { - Logger.getAnonymousLogger().log(Level.INFO, - "Apply language UNspecific serach: " + Language.UNKNOWN); - concepts = reader.getAllConceptsFocusOnlyOnURI(regex); - } - } - return concepts; - } - return Collections.emptyList(); - } - - public List detectPossibleProperties(String regex) { - - return reader.getAllDirectProperties(regex); - // return reader.getAllProperties(regex); - } - - /* - * public LocalOntologyView getViewForOneStepRange(String concept, - * LocalOntologyView instance, Language language) { LocalOntologyView - * localOntologyView = null; - * - * if (instance == null) { localOntologyView = new LocalOntologyView(); } - * else { localOntologyView = instance; } - * - * String conceptAsUri = getURIOfConcept(concept); - * Logger.getAnonymousLogger().log(Level.INFO, "Request properties from: " + - * conceptAsUri); List properties = - * reader.getAllPropertiesIncludingEverything(conceptAsUri); for (String - * proeprty : properties) { PropertyType pType = - * reader.getPropertyType(proeprty); if (pType == - * PropertyType.DATATYPEPROPERTY) { String translatedName = - * reduceURIJustToName(proeprty, language); Entity entity = new Entity(); - * entity.setUrl(proeprty); entity.setTranslatedURL(translatedName); - * - * localOntologyView.addDataproperties(entity); } else { // It is a object - * property which means I must return the name of // the concept - * List ranges = reader.getRangeOfProperty(proeprty); for (int i = - * 0; i < ranges.size(); i++) { String range = ranges.get(i); String - * rangeReduced = reduceURIJustToName(range, language); LocalOntologyView - * localOntologyView2 = new LocalOntologyView(); - * - * Entity conceptRange = new Entity(); conceptRange.setUrl(range); String - * label = translateConcept(range, language, - * this.languagelabel).getTranslation(); - * conceptRange.setTranslatedURL(rangeReduced); - * - * localOntologyView2.setConcept(conceptRange); - * localOntologyView.getObjectproperties().put(range, localOntologyView2); } - * } } - * - * return localOntologyView; - * - * } - */ - - public LocalOntologyView getViewForOneStepRange(String concept, LocalOntologyView instance, - LocalOntologyView parentInstance, Language language) { - LocalOntologyView localOntologyView = null; - - if (instance == null) { - localOntologyView = new LocalOntologyView(); - } else { - localOntologyView = instance; - } - - if (reader == null) { - Logger.getAnonymousLogger().log(Level.WARNING, "Ontology Reader is null. The init failed"); - } else { - - String conceptAsUri = getURIOfConcept(concept); - Logger.getAnonymousLogger().log(Level.INFO, "Request properties from: " + conceptAsUri); - List properties = new ArrayList<>(); - - if (needANimbleSpecificAdapation()) { - OutputForPropertiesFromConcept outputForPropertiesFromConcept = nimbleSpecificSPARQLDeriviation - .getAllPropertiesIncludingEverything(concept); - List props = outputForPropertiesFromConcept - .getOutputForPropertiesFromConcept(); - for (OutputForPropertyFromConcept property : props) { - PropertyType pType = reader.getPropertyType(property.getPropertyURL()); - if (pType == PropertyType.DATATYPEPROPERTY || pType == PropertyType.UNKNOWN) { - String translatedName = reduceURIJustToName(property.getPropertyURL(), language); - eu.nimble.service.catalog.search.impl.dao.Entity entity = new eu.nimble.service.catalog.search.impl.dao.Entity(); - entity.setUrl(property.getPropertyURL()); - entity.setTranslatedURL(translatedName); - entity.setPropertySource(property.getPropertySource()); - localOntologyView.addDataproperties(entity); - } else { - addObjectPropertyToLogicalView(instance, language, localOntologyView, - property.getPropertyURL()); - } - } - - } else { - properties = reader.getAllPropertiesIncludingEverything(conceptAsUri); - for (String proeprty : properties) { - PropertyType pType = reader.getPropertyType(proeprty); - if (pType == PropertyType.DATATYPEPROPERTY) { - String translatedName = reduceURIJustToName(proeprty, language); - eu.nimble.service.catalog.search.impl.dao.Entity entity = new eu.nimble.service.catalog.search.impl.dao.Entity(); - entity.setUrl(proeprty); - entity.setTranslatedURL(translatedName); - entity.setPropertySource(PropertySource.DOMAIN_SPECIFIC_PROPERTY); - - localOntologyView.addDataproperties(entity); - } else { - // It is a object property which means I must return the - // name of - // the concept - addObjectPropertyToLogicalView(instance, language, localOntologyView, proeprty); - } - - } - } - - // Hidden the parent concepts as well as the other elements of the - // parent concepts when the distance to frozen concept is larger - // than 1 - if (!properties.isEmpty() && localOntologyView.getDistanceToFrozenConcept() > 1 && parentInstance != null) { - localOntologyView.hiddenElementsOfParentView(parentInstance); - } - - } - return localOntologyView; - - } - - public void addObjectPropertyToLogicalView(LocalOntologyView instance, Language language, - LocalOntologyView localOntologyView, String proeprty) { - List ranges = reader.getRangeOfProperty(proeprty); - for (int i = 0; i < ranges.size(); i++) { - String range = ranges.get(i); - String rangeReduced = reduceURIJustToName(range, language); - LocalOntologyView localOntologyView2 = new LocalOntologyView(); - - eu.nimble.service.catalog.search.impl.dao.Entity conceptRange = new eu.nimble.service.catalog.search.impl.dao.Entity(); - conceptRange.setUrl(range); - String label = translateConcept(range, language, this.languagelabel).getTranslation(); - conceptRange.setTranslatedURL(rangeReduced); - // conceptRan - - localOntologyView2.setConcept(conceptRange); - localOntologyView2.setObjectPropertySource(proeprty); - localOntologyView2.setFrozenConcept(instance.getFrozenConcept()); - localOntologyView2.setDistanceToFrozenConcept(instance.getDistanceToFrozenConcept() + 1); - List newPaht = new ArrayList(localOntologyView.getConceptURIPath()); - newPaht.add(range); - localOntologyView2.setConceptURIPath(newPaht); - localOntologyView.getObjectproperties().put(range, localOntologyView2); - } - } - - private String reduceURIJustToName(String uri, Language language) { - TranslationResult range = translateConcept(uri, language, languagelabel); - // range = range.substring(range.indexOf("#") + 1); - return range.getTranslation(); - } - - public String getURIOfConcept(String concept) { - - if (concept.contains("#") || (concept.contains("http://www.nimble-project.org/resource/eclass"))) { - return concept; - } - - if (reader == null) { - Logger.getAnonymousLogger().log(Level.WARNING, "Ontology Reader is null. The init fails"); - } else { - List allPossibleConcepts = reader.getAllConcepts(concept); - for (String conceptURI : allPossibleConcepts) { - String conceptURIShortened = conceptURI.substring(conceptURI.indexOf("#") + 1); - if (conceptURIShortened.equals(concept)) { - return conceptURI; - } - } - Logger.getAnonymousLogger().log(Level.WARNING, "Couldn't find right concept in ontology: " + concept); - return concept; - } - return null; - } - - public String getURIOfProperty(String property) { - if (reader == null) { - Logger.getAnonymousLogger().log(Level.WARNING, "Ontology Reader is null. The init fails"); - } else { - List allPossibleProperties = reader.getAllProperties(property); - for (String propertyURI : allPossibleProperties) { - String propertyURIShortened = propertyURI.substring(propertyURI.indexOf("#") + 1); - if (propertyURIShortened.equals(property)) { - return propertyURI; - } - } - Logger.getAnonymousLogger().log(Level.WARNING, "Couldn't find right concept in ontology: " + property); - return property; - } - return null; - } - - /** - * Die Methode nimmt den REader/Search um das zu machen - * - * @param amountOfGroups - * @param concept - * @param property - * @return - */ - public Map> generateGroup(int amountOfGroups, String concept, String property, - PropertySource propertySource) { - concept = getURIOfConcept(concept); - String shortPropertyName = property; - property = getURIOfProperty(property); - List values = getAllValuesForAGivenProperty(concept, property, propertySource); - for (int i = 0; i < values.size(); i++) { - String str = values.get(i); - int index = str.lastIndexOf("^"); - if (index > -1) { - str = str.substring(0, index - 1); - } - str = str.replace(",", "."); - values.set(i, str); - } - if (values != null && values.size() > 0) { - try { - ValueGroupingFactory valueGroupingFactory = new ValueGroupingFactory(); - return valueGroupingFactory.generateGrouping(amountOfGroups, values, shortPropertyName); - // Map> result = new HashMap>(); - // float min = getMinOfData(values); - // float max = getMaxOfData(values); - // float stepRate = (max - min) / (float) amountOfGroups; - // List discreditedGroups = new ArrayList(); - // for (int i = 0; i < amountOfGroups; i++) { - // Group group = new Group(); - // float newMin = min + (stepRate * i); - // float newMax = min + (stepRate * (i + 1)); - // if (newMin > 2) { - // newMin = round(newMin); - // newMax = round(newMax); - // } - // group.setDescription("From: " + newMin + " to " + newMax); - // group.setMin(newMin); - // group.setMax(newMax); - // group.setProperty(shortPropertyName); - // discreditedGroups.add(group); - // } - // result.put(shortPropertyName, discreditedGroups); - // return result; - } catch (Exception e) { - Logger.getAnonymousLogger().log(Level.WARNING, - "Cannot transform data from " + property + " into floats"); - } - } else { - return new HashMap>(); - } - return new HashMap>(); - } - - // private float round(float value) { - // int n = (int) value * 100; - // return n / 100f; - // } - - public List getAllValuesForAGivenProperty(String concept, String property, PropertySource propertySource) { - List values = null; - if (!needANimbleSpecificAdapation()) { - values = propertyValuesCrawler.getAllDifferentValuesForAProperty(concept, property); - } else { - values = nimbleSpecificSPARQLDeriviation.getAllDifferentValuesForAProperty(concept, property, - propertySource); - } - return values; - } - - /** - * The NIMBLE platform uses a specific ontology which requires manual - * inclusion or exclusion of properties and other stuff - * - * @return true if Marmotta is set as main data source of the search - */ - private boolean needANimbleSpecificAdapation() { - return (reader instanceof MarmottaReader) ? true : false; - } - - // private float getMinOfData(List values) { - // float min = 999999; - // for (String value : values) { - // float number = Float.valueOf(value); - // if (number < min) { - // min = number; - // } - // } - // - // return min; - // } - - // private float getMaxOfData(List values) { - // float max = -999999; - // for (String value : values) { - // float number = Float.valueOf(value); - // if (number > max) { - // max = number; - // } - // } - // - // return max; - // } - - public String getLanguagelabel() { - return languagelabel; - } - - public void setLanguagelabel(String languagelabel) { - this.languagelabel = languagelabel; - if (reader != null) { - reader.setLanguageLabel(languagelabel); - } - } - - public List getSupportedLanguages() { - if (reader == null) { - Logger.getAnonymousLogger().log(Level.WARNING, "Ontology Reader is null. The init fails"); - } else { - List languages = reader.getNativeSupportedLangauges(); - List result = new ArrayList(); - for (Language l : languages) { - String label = Language.toOntologyPostfix(l).substring(1); - result.add(label); - } - return result; - } - return Collections.emptyList(); - } - - /** - * This method shall derive all parent classes for a concept.- That means - * that a highchair would be also a product a furniture etc. - * - * @param concept - * @return a list of parent concepts - */ - public List getAllDerivedConcepts(String concept) { - - List result = new ArrayList(); - result.add(concept); - - return result; - } - - public List getAllObjectPropertiesIncludingEverythingAndReturnItsRange( - InputParameterForGetReferencesFromAConcept input) { - return reader.getAllObjectPropertiesIncludingEverythingAndReturnItsRange(input.getConceptURL()); - } - - public OutputForPropertiesFromConcept getAllTransitiveProperties(String concept) { - concept = getURIOfConcept(concept); - if (needANimbleSpecificAdapation()) { - return nimbleSpecificSPARQLDeriviation.getAllPropertiesIncludingEverything(concept); - } else { - OutputForPropertiesFromConcept result = new OutputForPropertiesFromConcept(); - - List properties = reader.getAllPropertiesIncludingEverything(concept); - for (String urlOfProperty : properties) { - PropertyType propertyType = reader.getPropertyType(urlOfProperty); - OutputForPropertyFromConcept outputForPropertyFromConcept = new OutputForPropertyFromConcept(); - outputForPropertyFromConcept.setPropertyURL(urlOfProperty); - outputForPropertyFromConcept.setPropertySource(PropertySource.DOMAIN_SPECIFIC_PROPERTY); - if (propertyType == PropertyType.DATATYPEPROPERTY) { - outputForPropertyFromConcept.setDatatypeProperty(true); - outputForPropertyFromConcept.setObjectProperty(false); - } else { - outputForPropertyFromConcept.setDatatypeProperty(false); - outputForPropertyFromConcept.setObjectProperty(true); - } - result.getOutputForPropertiesFromConcept().add(outputForPropertyFromConcept); - } - - return result; - } - } - - public OutputForPropertyValuesFromOrangeGroup getPropertyValuesFromOrangeGroup( - InputParameterForPropertyValuesFromOrangeGroup valuesFromOrangeGroup) { - String command = valuesFromOrangeGroup.getOrangeCommand(); - String concept = valuesFromOrangeGroup.getConceptURL(); - return nimbleSpecificSPARQLDeriviation.getPropertyValuesForOrangeGroup(command, concept, - needANimbleSpecificAdapation()); - } -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorWebservice.java b/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorWebservice.java deleted file mode 100644 index 676d5a7..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/MediatorWebservice.java +++ /dev/null @@ -1,909 +0,0 @@ -package eu.nimble.service.catalog.search.mediator; - -import java.io.BufferedInputStream; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map.Entry; -import java.util.Properties; -import java.util.logging.Logger; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPathExpressionException; - -import org.apache.log4j.Level; -import org.apache.tomcat.util.http.fileupload.IOUtils; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.xml.sax.SAXException; - -import com.google.common.base.Charsets; -import com.google.common.io.CharStreams; -import com.google.common.io.Closeables; -import com.google.gson.Gson; - -import de.biba.mediator.IMediator; -import de.biba.mediator.IQuery; -import de.biba.mediator.IQuerySolution; -import de.biba.mediator.OutputQuery; -import de.biba.mediator.constraints.SimpleConstraint; -import de.biba.ontology.ABox; -import de.biba.ontology.ComplexOntClass; -import de.biba.ontology.DatatypeProperty; -import de.biba.ontology.ObjectProperty; -import de.biba.ontology.OntClass; -import de.biba.ontology.TBox; -import de.biba.queryLanguage.ParseException; -import de.biba.queryLanguage.SimpleQueryParser; -import de.biba.wrapper.DataSource; -import de.biba.wrapper.DataSourceV2; -import de.biba.wrapper.IDataSourceDescription; -import de.biba.wrapper.simpleXMLWrapper.XMLWrapper; -import eu.nimble.service.catalog.search.impl.SearchController; -import eu.nimble.service.catalog.search.mediator.datatypes.InformationServices; -import eu.nimble.service.catalog.search.mediator.datatypes.MediatorResult; -import eu.nimble.service.catalog.search.mediator.datatypes.QuerySolutionModel; -import eu.nimble.service.catalog.search.mediator.datatypes.Service; - -@Component -public class MediatorWebservice { - - public IMediator mediator = null; - - final String fSeparator = File.separator; - final String tempDir = "QueriesTEMP" + fSeparator; - final String propertyFile = "config.properties"; - final String mappingFile = "mapping.xml"; - final String mappingSchema = "mappingSchema.xsd"; - final String ontologyFile = "Ontology.owl"; - final String csvFile = "csvFile.csv"; - final String datatypeDefinitionFile = "datatypes.txt"; - final String configFolder = "ConfigFolder"; - private JAXBContext context = null; - private String namespaceOfCurrentQuery = ""; - - private String pathOfConfigFile; - /** Logger object */ - org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SearchController.class); - - public MediatorWebservice() { - - } - - //If the mediator is null, it laod the config from file - public void reload(){ - mediator =null; - initiateStandardConfiguration(); - } - - public MediatorWebservice(String pathOfFile) { - // TODO Auto-generated constructor stub - this.pathOfConfigFile = pathOfFile; - } - - public String getPathOfConfigFile() { - return pathOfConfigFile; - } - - public void setPathOfConfigFile(String pathOfConfigFile) { - this.pathOfConfigFile = pathOfConfigFile; - } - - public String getNamespaceOfCurrentQuery() { - return namespaceOfCurrentQuery; - } - - public String[] getAllConcepts() { - initiateStandardConfiguration(); - ArrayList result = new ArrayList(); - for (Entry element : mediator.getModel().tbox.simpleClasses.entrySet()) { - if (result.contains(element.getValue().getUri()) == false) - result.add(element.getValue().getUri()); - } - for (Entry element : mediator.getModel().tbox.complexClasses.entrySet()) { - if (result.contains(element.getValue().getUri()) == false) - result.add(element.getValue().getUri()); - } - String[] r = new String[result.size()]; - result.toArray(r); - return r; - } - - public String[] getAllDataPropertiesByConceptName(String name) { - initiateStandardConfiguration(); - ArrayList result = new ArrayList(); - for (Entry lala : mediator.getModel().getTbox().datatypeProperties.entrySet()) { - String uri = lala.getValue().getUri(); - uri = uri.substring(0, uri.lastIndexOf("#")); - for (String d : lala.getValue().getDomain()) { - - String toTest = uri + "#" + d; - System.out.println(toTest); - if (toTest.equals(name)) { - result.add(lala.getKey()); - } - } - } - String[] r = new String[result.size()]; - result.toArray(r); - return r; - } - - public String[] getAllObjectPropertiesByConceptName(String name) { - initiateStandardConfiguration(); - ArrayList result = new ArrayList(); - for (Entry lala : mediator.getModel().getTbox().objectProperties.entrySet()) { - String uri = lala.getValue().getUri(); - uri = uri.substring(0, uri.lastIndexOf("#")); - for (String d : lala.getValue().getDomain()) { - - String toTest = uri + "#" + d; - System.out.println(toTest); - if (toTest.equals(name)) { - result.add(lala.getKey()); - } - } - } - String[] r = new String[result.size()]; - result.toArray(r); - return r; - } - - public String[] getAllRangesForAObjectProperties(String name) { - initiateStandardConfiguration(); - ArrayList result = new ArrayList(); - for (Entry lala : mediator.getModel().getTbox().objectProperties.entrySet()) { - String uri = lala.getValue().getUri(); - if (uri.equals(name)) { - int size = lala.getValue().getRange().size(); - if (size > 0) { - String[] ranges = new String[size]; - lala.getValue().getRange().toArray(ranges); - return ranges; - } - } - } - - return null; - } - - - - public String getProvider() { - initiateStandardConfiguration(); - return mediator.getProvider(); - - } - - public String getVersion() { - initiateStandardConfiguration(); - return mediator.getVersion(); - - } - - // private WrapperConfiguration loadConfigFile(){ - // try{ - // context = JAXBContext - // .newInstance("de.biba.mediator.webservice.configuration"); - // Unmarshaller m = context.createUnmarshaller(); - // Object ob = m.unmarshal(Thread.currentThread().getContextClassLoader() - // .getResourceAsStream("./ExampleServices.xml")); - // - // if (ob==null){ - // Logger.getAnonymousLogger().log(java.util.logging.Level.INFO ,"Config - // File doesn't exits " ); - // } - // - // WrapperConfiguration result = (WrapperConfiguration) ob; - // return result; - // } - // catch(Exception e){ - // Logger.getAnonymousLogger().log(java.util.logging.Level.WARNING, - // e.toString()); - // } - // return new WrapperConfiguration(); - // } - - private void initiateStandardConfiguration() { - - if (mediator == null) { - try { - // Das dürfte nie schiefgehen - mediator = (IMediator) Class.forName("de.biba.mediator.ReasoningMediator").newInstance(); - } catch (Exception err) { - System.err.println("????????????????????????????????????????????????????????????????????" + err); - } - if (mediator == null) { - System.err.println("????????????????????????????????????????????????????????????????????SE;ED is null"); - } - } - if (isNotValidFile(pathOfConfigFile)) { - logger.error("No configuration found: " + pathOfConfigFile); - } else { - try { - JAXBContext context = JAXBContext.newInstance("eu.nimble.service.catalog.search.mediator.datatypes"); - Unmarshaller m = context.createUnmarshaller(); - File f = new File(pathOfConfigFile); - if (f.exists()) { - Object ob = m.unmarshal(f); - InformationServices myServices = (InformationServices) ob; - for (Service service : myServices.getService()) { - for (eu.nimble.service.catalog.search.mediator.datatypes.DataSource source : service - .getDataSource()) { - // TODO !!!! Mit Leben füllen - System.out.println(service); - Class c = null; - try { - String className = source.getJavaClassForWrapper(); - c = Class.forName(className); - Object o = c.newInstance(); - de.biba.wrapper.DataSource wrapper = (de.biba.wrapper.DataSource) o; - wrapper.initialize(source.getPathToConfigFile()); - boolean failureFree = true; - if (wrapper instanceof DataSourceV2) { - if (((DataSourceV2) wrapper).validateConfiguration().isConsistent() == false) { - failureFree = false; - System.err.println( - ((DataSourceV2) wrapper).validateConfiguration().getErrorMessage()); - failureFree = true;// TODO ändern - } - if (failureFree) { - mediator.addDataSource(wrapper, 0); - } - } else { - mediator.addDataSource(wrapper, 0); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - } else { - System.err.println("Sorry, your config file was not found: " + f.getAbsolutePath()); - throw (new FileNotFoundException()); - } - - } catch (FileNotFoundException e) { - - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - } - - - - private boolean isNotValidFile(String pathOfConfigFile2) { - if (pathOfConfigFile2 == null) { - logger.info(pathOfConfigFile2 + " doesn't exists. Use old java based configuration"); - return true; - } - File f = new File(pathOfConfigFile2); - if (f.exists()) { - logger.info(pathOfConfigFile2 + " exists. Load config"); - return false; - } else { - - return true; - } - } - - public ABox getLastABox() { - if (mediator != null) { - return mediator.getAboxOfLastResult(); - } else { - System.out.println( - "************************************************Medaitor is null*****************************************************"); - return null; - } - } - - private IQuerySolution makeAQuery(String namespace, String query, Logger barlogger, String tempQueryDir, - int[][] properties) { - - if (query.contains("BASE") == false) { - String base = "BASE <" + namespace + "> "; - query = base + query; - } - - try { - // Das dürfte nie schiefgehen - mediator = (IMediator) Class.forName("de.biba.mediator.ReasoningMediator").newInstance(); - } catch (Exception err) { - System.err.println("sddsd" + err); - } - - if (properties == null || properties.length < 1) { - initiateStandardConfiguration(); - } else { - String tempconfig = ""; - try { - for (int i = 0; i < properties.length; i++) { - switch (properties[i][0]) { - - case 1: - XMLWrapper sqlWrapper = new XMLWrapper(); - tempconfig = tempQueryDir + properties[i][1] + fSeparator + propertyFile; - - if (new File(tempconfig).exists()) { - sqlWrapper.initialize(tempconfig); - barlogger.info("Loading: " + tempconfig + " ###############################!"); - barlogger.info("Check1: " + sqlWrapper.validateConfiguration().isConsistent()); - mediator.addDataSource(sqlWrapper, 0); - } else { - barlogger.severe("The configuration file: " + tempconfig + " doesn't exists"); - } - break; - - case 3: - /* - * XLSWrapper xlsWrapper = new XLSWrapper(); tempconfig - * = tempQueryDir + properties[i][1] + fSeparator + - * propertyFile; - * - * if (new File(tempconfig).exists()){ - * xlsWrapper.initialize(tempconfig); barlogger .info( - * "Loading: "+ tempconfig+ - * " ###############################!"); - * mediator.addDataSource(xlsWrapper, 0); } else{ - * barlogger.severe("The configuration file: " + - * tempconfig + " doesn't exists"); } break; - */ - - default: - break; - } - } - } catch (Exception e) { - System.out.println("###############################????"); - barlogger.severe(e.toString()); - } - } - - try { - - return mediator.query(query, true, false); - - } catch (Exception e) { - - barlogger.severe(e.getMessage()); - } - - return null; - } - - private MediatorResult helperQuery(IQuerySolution solution, Logger barlogger, String query, - boolean removeDuplicates) { - MediatorResult result = null; - if (solution != null) { - QuerySolutionModel tmp = new QuerySolutionModel(solution); - StringReader sr = new StringReader(query); - SimpleQueryParser sqp = new SimpleQueryParser(sr); - OutputQuery out = null; - try { - IQuery q = sqp.parse(true, false); - if (!q.isIntputQuery()) - out = ((OutputQuery) q); - } catch (ParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - result = new MediatorResult(); - String[] columns = new String[tmp.getColumnCount()]; - if (removeDuplicates) { - List allForbidenRows = detectDuplicates(tmp); - String[][] data = new String[tmp.getRowCount() - allForbidenRows.size()][tmp.getColumnCount()]; - barlogger.info("Ergebnis der Anfrage: " + tmp.getRowCount()); - int index = 0; - for (int a = 0; a < tmp.getRowCount(); a++) { - - if (allForbidenRows.contains(a)) { - continue; - } - for (int i = 0; i < tmp.getColumnCount(); i++) { - - columns[i] = tmp.getColumnName(i); - if (out != null) { - for (SimpleConstraint con : out.getConstraint().flatToSimpleConstraints()) { - if (con.getResultVars().contains(tmp.getColumnName(i))) { - columns[i] = tmp.getColumnName(i) + ":" + con.getPredicate(); - - } - } - } - - // System.out.print(tmp.getValueAt(a,i).toString()); - data[index][i] = (String) tmp.getValueAt(a, i).toString(); - - } - index++; - // System.out.println(); - } - result.setColumnNames(columns); - result.setData(data); - - } else { - for (int i = 0; i < tmp.getColumnCount(); i++) { - - columns[i] = tmp.getColumnName(i); - } - String[][] data = new String[tmp.getRowCount()][tmp.getColumnCount()]; - for (int index = 0; index < tmp.getRowCount(); index++) { - for (int i = 0; i < tmp.getColumnCount(); i++) { - data[index][i] = (String) tmp.getValueAt(index, i).toString(); - } - } - result.setColumnNames(columns); - result.setData(data); - } - } - return result; - } - - public String queryAsHTML(String jObject) { - MediatorResult result = query(jObject, true); - String resultHTML = " Beschreibung der Seite

    Result of the Semantic Mediator

    "; - resultHTML += ""; - for (String str : result.getColumnNames()) { - resultHTML += ""; - } - resultHTML += ""; - for (String[] dArray : result.getData()) { - resultHTML += ""; - for (String str : dArray) { - resultHTML += ""; - - } - resultHTML += ""; - } - resultHTML += "
    " + str + "
    " + str + "
    "; - return resultHTML; - } - - private IQuerySolution queryingTask(String jObject) { - Logger barlogger = Logger.getLogger("de.biba.mediator.webservice"); - barlogger.info("Starte jetzt die Anfrage!!!!!"); - JSONObject jO = null; - JSONArray jA = null; - int[][] propsettings = null; - String namespace = ""; - String query = ""; - long timeInMillis = System.currentTimeMillis(); - String tempQueryDir = tempDir + timeInMillis + fSeparator; - - // Hier wird das JSONObjekt aus dem String gebaut, Exception falls - // String kaputt - try { - jO = new JSONObject(jObject); - query = jO.getString("query"); - - namespace = jO.getString("namespace"); - this.namespaceOfCurrentQuery = namespace; - if (jO.has("propList")) { - jA = jO.getJSONArray("propList"); - propsettings = new int[jA.length()][2]; - } - } catch (JSONException e) { - e.printStackTrace(); - } - - // Wenn Properties übergeben wurden dann: - if (jO.has("propList") && jA.length() > 0) { - Properties properties = null; - BufferedInputStream stream = null; - FileOutputStream fOS = null; - - // Umwandlung des Strings ins MyMessage - WrapperMessage wrapMessage = new Gson().fromJson(jObject, WrapperMessage.class); - - List wrapProperties = wrapMessage.getPropList(); - int i = 0; - for (WrapperProperty wrapProperty : wrapProperties) { - propsettings[i][0] = wrapProperty.getWrapperID(); - propsettings[i][1] = i; - switch (wrapProperty.getWrapperID()) { - case 0: // wenn es sich um HTTP Wrapper handelt - WrapperHTTPProperty wrapHTTPProperty = new Gson().fromJson(property2String(jA, i), - WrapperHTTPProperty.class); - mWriter(wrapHTTPProperty.getPropertyFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + propertyFile); - mWriter(wrapHTTPProperty.getMappingFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + mappingFile); - mWriter(wrapHTTPProperty.getMappingSchema(), tempQueryDir + i, - tempQueryDir + i + fSeparator + mappingSchema); - mWriter(wrapHTTPProperty.getOntologyFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + ontologyFile); - - properties = new Properties(); - try { - stream = new BufferedInputStream( - new FileInputStream(tempQueryDir + i + fSeparator + propertyFile)); - properties.load(stream); - stream.close(); - properties.setProperty("MappingFile", tempQueryDir + i + fSeparator + mappingFile); - properties.setProperty("MappingSchema", tempQueryDir + i + fSeparator + mappingSchema); - properties.setProperty("OntologyFile", tempQueryDir + i + fSeparator + ontologyFile); - - fOS = new FileOutputStream(tempQueryDir + i + fSeparator + propertyFile); - properties.store(fOS, null); - fOS.close(); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - i++; - break; - - case 1: // wenn es sich um SQL Wrapper handelt - WrapperSQLProperty wrapSQLProperty = new Gson().fromJson(property2String(jA, i), - WrapperSQLProperty.class); - mWriter(wrapSQLProperty.getPropertyFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + propertyFile); - mWriter(wrapSQLProperty.getMappingFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + mappingFile); - mWriter(wrapSQLProperty.getMappingSchema(), tempQueryDir + i, - tempQueryDir + i + fSeparator + mappingSchema); - mWriter(wrapSQLProperty.getOntologyFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + ontologyFile); - - properties = new Properties(); - try { - stream = new BufferedInputStream( - new FileInputStream(tempQueryDir + i + fSeparator + propertyFile)); - properties.load(stream); - stream.close(); - properties.setProperty("MappingFile", tempQueryDir + i + fSeparator + mappingFile); - properties.setProperty("MappingSchema", tempQueryDir + i + fSeparator + mappingSchema); - properties.setProperty("OntologyFile", tempQueryDir + i + fSeparator + ontologyFile); - - fOS = new FileOutputStream(tempQueryDir + i + fSeparator + propertyFile); - properties.store(fOS, null); - fOS.close(); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - i++; - break; - - case 2: // wenn es sich um CSV Wrapper handelt - WrapperCSVProperty wrapCSVProperty = new Gson().fromJson(property2String(jA, i), - WrapperCSVProperty.class); - mWriter(wrapCSVProperty.getPropertyFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + propertyFile); - mWriter(wrapCSVProperty.getMappingFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + mappingFile); - mWriter(wrapCSVProperty.getMappingSchema(), tempQueryDir + i, - tempQueryDir + i + fSeparator + mappingSchema); - mWriter(wrapCSVProperty.getOntologyFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + ontologyFile); - mWriter(wrapCSVProperty.getDatatypeDefinitionFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + datatypeDefinitionFile); - mWriter(wrapCSVProperty.getCsvFile(), tempQueryDir + i, tempQueryDir + i + fSeparator + csvFile); - - properties = new Properties(); - try { - stream = new BufferedInputStream( - new FileInputStream(tempQueryDir + i + fSeparator + propertyFile)); - properties.load(stream); - stream.close(); - properties.setProperty("Filename", tempQueryDir + i + fSeparator + csvFile); - properties.setProperty("MappingFile", tempQueryDir + i + fSeparator + mappingFile); - properties.setProperty("MappingSchema", tempQueryDir + i + fSeparator + mappingSchema); - properties.setProperty("OntologyFile", tempQueryDir + i + fSeparator + ontologyFile); - properties.setProperty("DatatypeDefinitionFile", - tempQueryDir + i + fSeparator + datatypeDefinitionFile); - - fOS = new FileOutputStream(tempQueryDir + i + fSeparator + propertyFile); - properties.store(fOS, null); - fOS.close(); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - i++; - break; - - case 3: // wenn es sich um XLS Wrapper handelt - WrapperXLSProperty wrapXLSProperty = new Gson().fromJson(property2String(jA, i), - WrapperXLSProperty.class); - mWriter(wrapXLSProperty.getPropertyFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + propertyFile); - mWriter(wrapXLSProperty.getMappingFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + mappingFile); - mWriter(wrapXLSProperty.getMappingSchema(), tempQueryDir + i, - tempQueryDir + i + fSeparator + mappingSchema); - mWriter(wrapXLSProperty.getOntologyFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + ontologyFile); - mWriter(wrapXLSProperty.getDatatypeDefinitionFile(), tempQueryDir + i, - tempQueryDir + i + fSeparator + datatypeDefinitionFile); - - properties = new Properties(); - try { - stream = new BufferedInputStream( - new FileInputStream(tempQueryDir + i + fSeparator + propertyFile)); - properties.load(stream); - stream.close(); - properties.setProperty("MappingFile", tempQueryDir + i + fSeparator + mappingFile); - properties.setProperty("MappingSchema", tempQueryDir + i + fSeparator + mappingSchema); - properties.setProperty("OntologyFile", tempQueryDir + i + fSeparator + ontologyFile); - properties.setProperty("DatatypeDefinitionFile", - tempQueryDir + i + fSeparator + datatypeDefinitionFile); - - fOS = new FileOutputStream(tempQueryDir + i + fSeparator + propertyFile); - properties.store(fOS, null); - fOS.close(); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - i++; - break; - default: - break; - } - } - } - - String base = "BASE <" + namespace + "> "; - query = base + query; - - IQuerySolution solution = null; - // solution = makeAQuery(namespace, query, barlogger, tempDir + 0 + - // fSeparator + conf, tempDir + 1 + fSeparator + conf); - System.out.println("Propsetting sind folgende \n " + Arrays.deepToString(propsettings)); - solution = makeAQuery(namespace, query, barlogger, tempQueryDir, propsettings); - return solution; - } - - public MediatorResult query(String jObject, boolean removeDuplicates) { - - IQuerySolution solution = queryingTask(jObject); - Logger barlogger = Logger.getLogger("de.biba.mediator.webservice"); - String query = ""; - try { - JSONObject jO = new JSONObject(jObject); - query = jO.getString("query"); - } catch (JSONException e) { - e.printStackTrace(); - } - MediatorResult result = helperQuery(solution, barlogger, query, removeDuplicates); - String h = ""; - - return result; - } - - /** - * Diese Methode macht die aus den Properties einen String ist für die - * Umwandlung in die jeweiligen Properties wichtig HTTP, SQL usw. - * - * @param jA - * JSONArray in dem Properties gespeichert liegen - * @param index - * es werden ja gewöhnlich mehrere Properties übergeben. - * @return String der Properties - */ - private String property2String(JSONArray jA, int index) { - String property = ""; - try { - property = jA.get(index).toString(); - } catch (JSONException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return property; - } - - /** - * Diese Methode schreibt den übergebenen String in die Datei - * - * @param content - * Der übergebene String - * @param fileDir - * Verzeichnis für die Datei - * @param fileName - * Dateiname - */ - private void mWriter(String content, String fileDir, String fileName) { - try { - File tempDir = new File(fileDir); - tempDir.mkdirs(); - File tempDatei = new File(fileName); - - BufferedWriter bw = new BufferedWriter(new FileWriter(tempDatei)); - bw.write(content); - bw.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * Diese Methode entfernt den Temp Ordner nach der ausführung von der - * Methode Query - * - * @param dir - * Temp Ordner Verzeichnis - * @return gibt zurück ob es geklappt hat - */ - private boolean mRemover(File dir) { - if (dir.isDirectory()) { - String[] entries = dir.list(); - for (int x = 0; x < entries.length; x++) { - File aktFile = new File(dir.getPath(), entries[x]); - mRemover(aktFile); - } - if (dir.delete()) - return true; - else - return false; - } else { - if (dir.delete()) - return true; - else - return false; - } - } - - private List detectDuplicates(QuerySolutionModel tmp) { - // An dieser Stelle filtere ich die doppelten Einträge raus - ArrayList allForbidenRows = new ArrayList(); - for (int y = 0; y < tmp.getRowCount(); y++) { - - String str1 = ""; - - for (int x = 0; x < tmp.getColumnCount(); x++) { - str1 += tmp.getValueAt(y, x).toString() + ";"; - } - for (int y1 = y + 1; y1 < tmp.getRowCount(); y1++) { - String str2 = ""; - for (int x = 0; x < tmp.getColumnCount(); x++) { - str2 += tmp.getValueAt(y1, x).toString() + ";"; - } - - if (str1.equals(str2)) { - // System.out.println("Gelöschte Zeile: " + y1); - if (allForbidenRows.contains(y1) == false) { - allForbidenRows.add(y1); - - } - } - - } - } - return allForbidenRows; - - } - - private String queryqueryGetResultAsCSVHelper(IQuerySolution solution, Logger barlogger, String query) { - String result = ""; - String zwi = ""; - if (solution != null) { - QuerySolutionModel tmp = new QuerySolutionModel(solution); - StringReader sr = new StringReader(query); - SimpleQueryParser sqp = new SimpleQueryParser(sr); - OutputQuery out = null; - try { - IQuery q = sqp.parse(true, false); - if (!q.isIntputQuery()) - out = ((OutputQuery) q); - } catch (ParseException e) { - // TODO Auto-generated catch block - barlogger.severe(e.toString()); - } - - String[][] data = new String[tmp.getRowCount()][tmp.getColumnCount()]; - String[] columns = new String[tmp.getColumnCount()]; - barlogger.info("Ergebnis der Anfrage: " + tmp.getRowCount()); - // An dieser Stelle filtere ich die doppelten Einträge raus - List allForbidenRows = detectDuplicates(tmp); - for (int a = 0; a < tmp.getRowCount(); a++) { - - if (allForbidenRows.contains(a)) { - continue; - } - for (int i = 0; i < tmp.getColumnCount(); i++) { - columns[i] = tmp.getColumnName(i) + ";"; - if (out != null) { - for (SimpleConstraint con : out.getConstraint().flatToSimpleConstraints()) { - if (con.getResultVars().contains(tmp.getColumnName(i))) { - columns[i] = tmp.getColumnName(i) + ":" + con.getPredicate(); - - } - } - } - - data[a][i] = (String) tmp.getValueAt(a, i).toString(); - if (a > 0) { - zwi += (String) tmp.getValueAt(a, i).toString() + ";"; - } - - } - if (a > 0) { - if (zwi.charAt(zwi.length() - 1) == ';') { - zwi = zwi.substring(0, zwi.length() - 1); - } - - zwi += "\n"; - } - } - for (int i = 0; i < columns.length; i++) { - result += columns[i]; - } - - } - result += "\n" + zwi; - - barlogger.info(result); - return result; - } - - public String queryGetResultAsCSV(String jObject) { - IQuerySolution solution = queryingTask(jObject); - Logger barlogger = Logger.getLogger("de.biba.mediator.webservice"); - String query = ""; - try { - JSONObject jO = new JSONObject(jObject); - query = jO.getString("query"); - } catch (JSONException e) { - e.printStackTrace(); - } - - String result = ""; - String zwi = ""; - // IQuerySolution solution = makeAQuery(namespace, query, barlogger, - // "C:/Resources/WetherExample/config.properties", - // "C:/Resources/WetherExample2/config.properties"); - - return queryqueryGetResultAsCSVHelper(solution, barlogger, query); - - } - - // public String queryGetResultAsCSVWithTwoConfigFiles(String namespace, - // String query, String configFile1, String configFile2) { - // String base = "BASE <" + namespace + "> "; - // query = base + query; - // Logger barlogger = Logger.getLogger("de.biba.mediator.webservice"); - // String result = ""; - // String zwi =""; - // //IQuerySolution solution = makeAQuery(namespace, query, barlogger, - // configFile1, configFile2); - // IQuerySolution solution = makeAQuery(namespace, query, barlogger, null, - // null); - // return queryqueryGetResultAsCSVHelper(solution, barlogger, query); - // - // } -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/NimbleSpecificSPARQLDeriviationAndExecution.java b/src/main/java/eu/nimble/service/catalog/search/mediator/NimbleSpecificSPARQLDeriviationAndExecution.java deleted file mode 100644 index 496321b..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/NimbleSpecificSPARQLDeriviationAndExecution.java +++ /dev/null @@ -1,701 +0,0 @@ -package eu.nimble.service.catalog.search.mediator; - -import java.security.cert.CollectionCertStoreParameters; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import de.biba.triple.store.access.IReader; -import de.biba.triple.store.access.dmo.Entity; -import de.biba.triple.store.access.enums.ConceptSource; -import de.biba.triple.store.access.enums.Language; -import de.biba.triple.store.access.enums.PropertyType; -import de.biba.triple.store.access.jena.Reader; -import de.biba.triple.store.access.marmotta.MarmottaReader; -import eu.nimble.service.catalog.search.impl.dao.CustomPropertyInformation; -import eu.nimble.service.catalog.search.impl.dao.enums.PropertySource; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteSelect; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertiesFromConcept; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertyFromConcept; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertyValuesFromGreenGroup; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertyValuesFromOrangeGroup; -import eu.nimble.service.catalog.search.impl.dao.sqp.SQPConfiguration; -import eu.nimble.service.catalog.search.impl.dao.sqp.SQPMapping; -import eu.nimble.service.catalog.search.services.SQPDerivationService; - -public class NimbleSpecificSPARQLDeriviationAndExecution { - - private static final String URN_OASIS_NAMES_SPECIFICATION_UBL_SCHEMA_XSD_COMMON_BASIC_COMPONENTS_2_PRODUCT_IMAGE = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2#ProductImage"; - private static final String HTTP_WWW_W3_ORG_2004_02_SKOS_CORE_PREF_LABEL = "http://www.w3.org/2004/02/skos/core#prefLabel"; - private static final String URN_OASIS_NAMES_SPECIFICATION_UBL_SCHEMA_XSD_COMMON_AGGREGATE_COMPONENTS_2_DIMENSION = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#Dimension"; - private static final String URN_OASIS_NAMES_SPECIFICATION_UBL_SCHEMA_XSD_COMMON_AGGREGATE_COMPONENTS_2_ADDITIONAL_ITEM_PROPERTY = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#AdditionalItemProperty"; - private static final String URN_OASIS_NAMES_SPECIFICATION_UBL_SCHEMA_XSD_COMMON_AGGREGATE_COMPONENTS_2_COMMODITY_CLASSIFICATION = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#CommodityClassification"; - private static final String HTTP_WWW_W3_ORG_1999_02_22_RDF_SYNTAX_NS_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; - private IReader reader = null; - private SQPDerivationService sqpDerivationService = null; - private MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - - public NimbleSpecificSPARQLDeriviationAndExecution(IReader marmottaReader, - SQPDerivationService sqpDerivationService, - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution) { - super(); - this.reader = marmottaReader; - this.sqpDerivationService = sqpDerivationService; - this.mediatorSPARQLDerivationAndExecution = mediatorSPARQLDerivationAndExecution; - } - - public boolean isItADomainSpecificPropertyWhichHasValues(String propertyURL) { - - String sparql = createSPARQLForAllDomainSpecificProperties(); - if (reader != null) { - Object result = reader.query(sparql); - List allproperties = reader.createResultList(result, "value"); - - return allproperties.contains(propertyURL); - } - if (propertyURL.contains("Varnish")) { - return true; - } - - return false; - } - - public String createSPARQLForAllDomainSpecificProperties() { - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?instance "; - sparql += " ?value"; - // Define it is a ItemType - sparql += " where{"; - sparql += "?instance . ?instance ?aproperty. ?aproperty ?code. ?code ?value"; - sparql += "}"; - return sparql; - } - - private String createSPARQLForAOrangeCommand(String command, String concept) { - - SQPConfiguration sqpConfiguration = sqpDerivationService.getSQPConfiguration(concept, command); - if (sqpConfiguration == null) { - Logger.getAnonymousLogger().log(Level.WARNING, "Found no orangeCommand for: " + command); - return null; - } - if (!concept.contains("<")) { - concept = "<" + concept + ">"; - } - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?instance "; - sparql += " ?value"; - // Define it is a ItemType - sparql += " where{"; - sparql += "?instance " + concept + "."; - SQPMapping sqpMapping = sqpConfiguration.getSQPMapping(); - String path = sqpMapping.getTarget().getTargetPathFromSource(); - String[] pathTokens = path.split(";"); - String lastToken = "?instance"; - String propertyName = ""; - for (String token : pathTokens) { - propertyName = "?" + token.substring(token.indexOf("#") + 1); - sparql += lastToken + " <" + token + "> " + propertyName + ". "; - - lastToken = propertyName; - } - sparql += propertyName + "<" + sqpMapping.getTarget().getTargetProperty() + ">" + "?value. "; - sparql += "}"; - return sparql; - } - - private String createSPARQLForAOrangeCommandWithMamrottaSpecificStructure(String command, String concept) { - - SQPConfiguration sqpConfiguration = sqpDerivationService.getSQPConfiguration(concept, command); - if (sqpConfiguration == null) { - Logger.getAnonymousLogger().log(Level.WARNING, "Found no orangeCommand for: " + command); - return null; - } - if (concept.contains("<")) { - concept = concept.replace("<", ""); - concept = concept.replace(">", ""); - } - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?instance "; - sparql += " ?value"; - // Define it is a ItemType - sparql += " where{"; - sparql += "?instance . ?instance ?type. ?type ?code. ?code ?codeValue."; - SQPMapping sqpMapping = sqpConfiguration.getSQPMapping(); - String path = sqpMapping.getTarget().getTargetPathFromSource(); - String[] pathTokens = path.split(";"); - String lastToken = "?instance"; - String propertyName = ""; - for (String token : pathTokens) { - propertyName = "?" + token.substring(token.indexOf("#") + 1); - sparql += lastToken + " <" + token + "> " + propertyName + ". "; - - lastToken = propertyName; - } - sparql += propertyName + "<" + sqpMapping.getTarget().getTargetProperty() + ">" + "?value. "; - sparql += "Filter regex( ?codeValue , \"" + concept + "\")."; - sparql += "}"; - return sparql; - } - - public OutputForPropertyValuesFromOrangeGroup getPropertyValuesForOrangeGroup(String command, String concept, - boolean nimbleAndMarmottaSpecific) { - OutputForPropertyValuesFromOrangeGroup propertyValuesFromOrangeGroup = new OutputForPropertyValuesFromOrangeGroup(); - String sparql = ""; - if (nimbleAndMarmottaSpecific) { - sparql = createSPARQLForAOrangeCommandWithMamrottaSpecificStructure(command, concept); - - } else { - - sparql = createSPARQLForAOrangeCommand(command, concept); - } - if (sparql != null) { - Logger.getAnonymousLogger().log(Level.INFO, "Request: " + sparql + " by: " + reader.getClass().getName()); - Logger.getAnonymousLogger().log(Level.INFO, sparql); - Object result = reader.query(sparql); - List values = reader.createResultList(result, "value"); - propertyValuesFromOrangeGroup.getAllValues().addAll(values); - String conceptOfTarget = getTypeOfValue(values); - if (conceptOfTarget != null) { - propertyValuesFromOrangeGroup.setBelongsToTheFollowingConcept(concept); - propertyValuesFromOrangeGroup.setItAConcept(true); - propertyValuesFromOrangeGroup.setITASimpleValue(false); - } else { - propertyValuesFromOrangeGroup.setItAConcept(false); - propertyValuesFromOrangeGroup.setITASimpleValue(true); - } - } - return propertyValuesFromOrangeGroup; - } - - /** - * INtersection is not allowed here - * - * @param values - * @return the concept if the input is a individual otherwise null - */ - private String getTypeOfValue(List values) { - if (values != null && values.size() > 0) { - String value = values.get(0); - if (!value.contains("<")) { - value = "<" + value + ">"; - } - // A individual UUID cannot have a space inside - if (value.contains(" ")) { - return null; - } - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: SELECT ?subject ?predicate ?object WHERE { " - + value + " rdf:type ?object.} "; - Logger.getAnonymousLogger().log(Level.INFO, sparql); - Object result = reader.query(sparql); - List allTypes = reader.createResultList(result, "object"); - if (allTypes != null && allTypes.size() > 0) { - - for (String type : allTypes) { - if (!type.contains("NamedIndividual")) { - return type; - } - } - - } - } - return null; - } - - public void removeInternalConceptsToHideItForTheUser(List concepts) { - - List toBeRemoved = new ArrayList(); - for (Entity entity : concepts) { - - if (entity.getUrl().contains("ItemType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("AmountType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("CatalogueType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("CertificateType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("ComodityClassificationType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("DeliveryTermsType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("DimensionType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("DocumentReferenceType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("GoodsItemType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("ItemIdentificationType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("ItemLocationQuantityType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("ItemLPropertyType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("PackageType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("PartyType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("PeriodType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("PriceType")) { - toBeRemoved.add(entity); - } - if (entity.getUrl().contains("QuantityType")) { - toBeRemoved.add(entity); - } - } - - for (Entity entity : toBeRemoved) { - concepts.remove(entity); - } - } - - public List getAdditionalPropertiesWhichAreDerivedFromAbox(String conceptURL) { - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct "; - sparql += " ?property"; - sparql += " where{"; - sparql += "?instance ?property ?propertyValue. ?instance . ?instance ?type. ?type ?code. ?code ?codeValue."; - sparql += "Filter regex( ?codeValue , \"" + conceptURL + "\")."; - sparql += "}"; - Logger.getAnonymousLogger().log(Level.INFO, sparql); - Object result = reader.query(sparql); - List resultAsList = reader.createResultList(result, "property"); - removeNimbleSpecificInternalAndImageRelatedProperties(resultAsList); - return resultAsList; - - } - - public List getAllAvailableDimensionsWhichAreDerivedFromAbox(String conceptURL) { - List resultAsList = null; - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct "; - sparql += " ?value"; - sparql += " where{"; - - sparql += "?instance ?propertyValue. ?propertyValue ?value. ?instance . ?instance ?type. ?type ?code. ?code ?codeValue."; - - sparql += "Filter regex( ?codeValue , \"" + conceptURL + "\")."; - sparql += "}"; - Logger.getAnonymousLogger().log(Level.INFO, sparql); - Object result = reader.query(sparql); - resultAsList = reader.createResultList(result, "value"); - - return resultAsList; - } - - public List getAllAvailableCustomPropertiesWhichAreDerivedFromAbox(String conceptURL) { - List resultAsList = null; - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct "; - sparql += " ?value ?name ?typeDes"; - sparql += " where{"; - - sparql += "?instance ?propertyValue. ?propertyValue ?typeDes.?propertyValue ?name. ?propertyValue ?codeOfProperty. ?codeOfProperty ?value. ?instance . ?instance ?type. ?type ?code. ?code ?codeValue."; - sparql += "Filter (regex( ?codeValue , \"" + conceptURL + "\") && regex (?value, \"Custom\", \", i\"))."; - sparql += "}"; - Logger.getAnonymousLogger().log(Level.INFO, sparql); - Object result = reader.query(sparql); - resultAsList = reader.createResultListArray(result, new String[] { "name", "typeDes" }); - - List customPropertyInformations = new ArrayList(); - resultAsList.forEach(element -> { - String name = element[0]; - String propertyDescription = element[1]; - CustomPropertyInformation customPropertyInformation = new CustomPropertyInformation(); - customPropertyInformation.setPropertyName(name); - customPropertyInformation.setTypeDescription(propertyDescription); - customPropertyInformations.add(customPropertyInformation); - }); - - return customPropertyInformations; - } - - public void removeNimbleSpecificInternalAndImageRelatedProperties(List resultAsList) { - resultAsList.remove(URN_OASIS_NAMES_SPECIFICATION_UBL_SCHEMA_XSD_COMMON_BASIC_COMPONENTS_2_PRODUCT_IMAGE); - resultAsList.remove(HTTP_WWW_W3_ORG_1999_02_22_RDF_SYNTAX_NS_TYPE); - resultAsList.remove( - URN_OASIS_NAMES_SPECIFICATION_UBL_SCHEMA_XSD_COMMON_AGGREGATE_COMPONENTS_2_COMMODITY_CLASSIFICATION); - resultAsList.remove( - URN_OASIS_NAMES_SPECIFICATION_UBL_SCHEMA_XSD_COMMON_AGGREGATE_COMPONENTS_2_ADDITIONAL_ITEM_PROPERTY); - resultAsList.remove(URN_OASIS_NAMES_SPECIFICATION_UBL_SCHEMA_XSD_COMMON_AGGREGATE_COMPONENTS_2_DIMENSION); - } - - public List getAllDifferentValuesForAProperty(String concept, String propertyURL, - PropertySource propertySource) { - - NimbleSpecificSPARQLFactory factory = new NimbleSpecificSPARQLFactory(mediatorSPARQLDerivationAndExecution, - sqpDerivationService); - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept(concept); - String property = propertyURL.substring(propertyURL.indexOf("#") + 1); - inputParamaterForExecuteSelect.getParameters().add(property); - inputParamaterForExecuteSelect.getParametersURL().add(propertyURL); - inputParamaterForExecuteSelect.getPropertySources().add(propertySource); - List sparqls = factory.createSparql(inputParamaterForExecuteSelect, reader, false, false); - if (sparqls != null && sparqls.size() > 0) { - String sparql = sparqls.get(0); - Logger.getAnonymousLogger().log(Level.INFO, sparql); - Object result = reader.query(sparql); - List values = reader.createResultList(result, "hasValue"); - List valuesCleanedUP = new ArrayList(); - for (String str : values) { - if (!valuesCleanedUP.contains(str)) { - valuesCleanedUP.add(str); - } - } - - return valuesCleanedUP; - } else { - Logger.getAnonymousLogger().log(Level.WARNING, - "Couldn't create sparql queries for: " + concept + " & " + propertyURL); - } - return Collections.EMPTY_LIST; - } - - /** - * This method use the e-class to dtermine possible concepts - * - * @param keyword - * @param translationLabel - * @param language - * @return - */ - - public List detectNimbleSpecificMeaningFromAKeyword(String keyword, String translationLabel, - Language language) { - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: SELECT ?subject ?value WHERE { ?subject . ?subject <" - + translationLabel + "> ?value FILTER regex( str(?value),\"" + keyword + "\",\"i\").}"; - Object result = reader.query(sparql); - String[] columns = new String[] { "subject", "value" }; - List allConcepts = reader.createResultListArray(result, columns); - List resultOfSerachTerm = new ArrayList(); - String languagepostfix = language.toOntologyPostfix(language); - for (String[] row : allConcepts) { - String value = row[1]; - if (value != null && value.length() > 1 && value.contains(languagepostfix)) { - value = value.substring(0, value.indexOf(languagepostfix)); - - Entity entity = new Entity(); - entity.setUrl(row[0]); - entity.setTranslatedURL(value); - entity.setConceptSource(ConceptSource.CUSTOM); - entity.setLanguage(language); - resultOfSerachTerm.add(entity); - } else { - if (!value.contains("@")) { - - Entity entity = new Entity(); - entity.setUrl(row[0]); - entity.setTranslatedURL(value); - entity.setConceptSource(ConceptSource.CUSTOM); - entity.setLanguage(Language.UNKNOWN); - resultOfSerachTerm.add(entity); - } - } - } - return resultOfSerachTerm; - } - - /** - * This method use the e-class to dtermine possible concepts - * - * @param keyword - * @param translationLabel - * @param language - * @param useSimplifiedSPARQL - * @return - */ - public List detectNimbleSpecificMeaningFromAKeywordReferringToInstances(String keyword, - String translationLabel, Language language, boolean useSimplifiedSPARQL) { - List resultOfSerachTerm = new ArrayList(); - if (!useSimplifiedSPARQL) { - requestBasedOnConceptsURI(resultOfSerachTerm, keyword); - requestBasedOnTranslationLabel(resultOfSerachTerm, keyword, language); - } else { - requestBasedOnURISimplified(resultOfSerachTerm,keyword); - requestBasedOnItemTypeAndNameAttributWithoutTranslation(resultOfSerachTerm, keyword); - } - return resultOfSerachTerm; - } - - private void requestBasedOnURISimplified(List resultOfSerachTerm, String keyword) { - - - MarmottaReader readerMarmotta = (MarmottaReader) reader; - readerMarmotta.setLanguageLabel(HTTP_WWW_W3_ORG_2004_02_SKOS_CORE_PREF_LABEL); - - String query2 = "PREFIX rdf: PREFIX rdfs: PREFIX xsd: SELECT distinct ?uri WHERE { ?instance ?uri. FILTER regex(str(?uri), \""+keyword+"\", \"i\" ). }"; - Logger.getAnonymousLogger().log(Level.INFO, query2); - - Object result = readerMarmotta.query(query2); - List allProperties = readerMarmotta.createResultListArray(result, - new String[] { "uri" }); - List resultOfSearchTerm = new ArrayList(); - for (String[] element : allProperties) { - - Entity entity = new Entity(); - entity.setUrl(element[0]); - String value = element[0].substring(element[0].indexOf("#")+1); - entity.setTranslatedURL(value); - entity.setLanguage(Language.UNKNOWN); - resultOfSearchTerm.add(entity); - } - - for (Entity entity : resultOfSearchTerm) { - boolean contained = false; - for (Entity e : resultOfSerachTerm) { - if (e.getUrl().equals(entity.getUrl())) { - contained = true; - break; - } - } - if (!contained) { - resultOfSerachTerm.add(entity); - } - } - - } - - private void requestBasedOnItemTypeAndNameAttributWithoutTranslation(List allConcepts, String keyword){ - String query = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: SELECT distinct ?name ?codeValue WHERE { ?instance . ?instance ?type. ?type ?code. ?code ?codeValue. ?code ?name. FILTER regex(?name, \""+ keyword+"\", \"i\" ).}"; - MarmottaReader readerMarmotta = (MarmottaReader) reader; - Object result = readerMarmotta.query(query); - List allConcepts2 = readerMarmotta.createResultListArray(result, - new String[] { "codeValue", "name" }); - List resultOfSearchTerm = new ArrayList(); - for (String[] element : allConcepts2) { - - Entity entity = new Entity(); - entity.setUrl(element[0]); - String value = element[1]; - entity.setTranslatedURL(value); - entity.setLanguage(Language.UNKNOWN); - resultOfSearchTerm.add(entity); - } - - for (Entity entity : resultOfSearchTerm) { - boolean contained = false; - for (Entity e : allConcepts) { - if (e.getUrl().equals(entity.getUrl())) { - contained = true; - break; - } - } - if (!contained) { - allConcepts.add(entity); - } - } - - } - - private void requestBasedOnTranslationLabelSimplfied(List allConcepts, String keyword, Language language) { - MarmottaReader readerMarmotta = (MarmottaReader) reader; - readerMarmotta.setLanguageLabel(HTTP_WWW_W3_ORG_2004_02_SKOS_CORE_PREF_LABEL); - String query2 = "PREFIX skos: PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: PREFIX cbc: PREFIX ecl: SELECT distinct ?uri ?translation WHERE { ?uri a skos:Concept . ?uri a ecl:CodeConcept . ?uri skos:prefLabel ?translation . FILTER regex(?translation, \""+keyword+ "\", \"i\" ). bind (str(?uri) as ?strUri) . ?subject cbc:URI ?strUri . }"; - Logger.getAnonymousLogger().log(Level.INFO, query2); - - Object result = readerMarmotta.query(query2); - List allProperties = readerMarmotta.createResultListArray(result, - new String[] { "uri", "translation" }); - List resultOfSearchTerm = new ArrayList(); - for (String[] element : allProperties) { - - Entity entity = new Entity(); - entity.setUrl(element[0]); - String value = element[1]; - entity.setTranslatedURL(value); - entity.setLanguage(Language.UNKNOWN); - resultOfSearchTerm.add(entity); - } - - for (Entity entity : resultOfSearchTerm) { - boolean contained = false; - for (Entity e : allConcepts) { - if (e.getUrl().equals(entity.getUrl())) { - contained = true; - break; - } - } - if (!contained) { - allConcepts.add(entity); - } - } - - } - - private void requestBasedOnTranslationLabel(List allConcepts, String keyword, Language language) { - MarmottaReader readerMarmotta = (MarmottaReader) reader; - readerMarmotta.setLanguageLabel(HTTP_WWW_W3_ORG_2004_02_SKOS_CORE_PREF_LABEL); - List entities = readerMarmotta.getAllConceptsLanguageSpecific(keyword, language); - for (Entity entity : entities) { - boolean contained = false; - for (Entity e : allConcepts) { - if (e.getUrl().equals(entity.getUrl())) { - contained = true; - break; - } - } - if (!contained) { - allConcepts.add(entity); - } - } - - } - - private void requestBasedOnConceptsURI(List allConcepts, String keyword) { - MarmottaReader readerMarmotta = (MarmottaReader) reader; - List entities = readerMarmotta.getAllConceptsFocusOnlyOnURI(keyword); - for (Entity entity : entities) { - boolean contained = false; - for (Entity e : allConcepts) { - if (e.getUrl().equals(entity.getUrl())) { - contained = true; - break; - } - } - if (!contained) { - allConcepts.add(entity); - } - } - - } - - public List getAllAvailableEClassOrDomainPropertiesFromAbox(String eclassOrconceptURL) { - List resultList = null; - - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?instance "; - sparql += " ?value ?name"; - sparql += " where{"; - sparql += "?instance ?propertyValue. ?propertyValue ?name. ?propertyValue ?value. ?instance . ?instance ?type. ?type ?code. ?code ?codeValue."; - - sparql += "Filter (regex( ?codeValue , \"" + eclassOrconceptURL + "\") )."; - sparql += "}"; - Object result = reader.query(sparql); - resultList = reader.createResultList(result, "value"); - - return resultList; - } - - private OutputForPropertyFromConcept createDefaultOutputForPropertyFromConcept(String urlOfProperty, - OutputForPropertiesFromConcept result) { - - OutputForPropertyFromConcept outputForPropertyFromConcept = new OutputForPropertyFromConcept(); - outputForPropertyFromConcept.setPropertyURL(urlOfProperty); - outputForPropertyFromConcept.setDatatypeProperty(true); - outputForPropertyFromConcept.setObjectProperty(false); - if ((urlOfProperty.contains("http:") || (urlOfProperty.contains("https")))) { - PropertyType propertyType = reader.getPropertyType(urlOfProperty); - - if (propertyType == PropertyType.OBJECTPROPERTY) { - - outputForPropertyFromConcept.setDatatypeProperty(false); - outputForPropertyFromConcept.setObjectProperty(true); - } - } else { - Logger.getAnonymousLogger().log(Level.WARNING, - "Cannot determine type{datatype, object property} of property: " + urlOfProperty); - } - result.getOutputForPropertiesFromConcept().add(outputForPropertyFromConcept); - - return outputForPropertyFromConcept; - } - - public OutputForPropertiesFromConcept getAllPropertiesIncludingEverything(String conceptURL) { - OutputForPropertiesFromConcept result = new OutputForPropertiesFromConcept(); - - List allAdditionalProperties = getAdditionalPropertiesWhichAreDerivedFromAbox(conceptURL); - allAdditionalProperties.forEach(str -> { - OutputForPropertyFromConcept outputForPropertyFromConcept = createDefaultOutputForPropertyFromConcept(str, - result); - outputForPropertyFromConcept.setPropertySource(PropertySource.DIRECT_PROPERTIES); - }); - - allAdditionalProperties = getAllAvailableDimensionsWhichAreDerivedFromAbox(conceptURL); - allAdditionalProperties.forEach(str -> { - OutputForPropertyFromConcept outputForPropertyFromConcept = createDefaultOutputForPropertyFromConcept(str, - result); - outputForPropertyFromConcept.setPropertySource(PropertySource.DIMENSION); - }); - - List customPropertyInformations = getAllAvailableCustomPropertiesWhichAreDerivedFromAbox( - conceptURL); - customPropertyInformations.forEach(element -> { - OutputForPropertyFromConcept outputForPropertyFromConcept = createDefaultOutputForPropertyFromConcept( - element.getPropertyName(), result); - if (element.getTypeDescription().toLowerCase().contains("string")) { - outputForPropertyFromConcept.setPropertySource(PropertySource.CUSTOM_STRING); - } else { - outputForPropertyFromConcept.setPropertySource(PropertySource.CUSTOM_DECIMAL); - } - }); - - allAdditionalProperties = getAllAvailableEClassOrDomainPropertiesFromAbox(conceptURL); - allAdditionalProperties.forEach(str -> { - OutputForPropertyFromConcept outputForPropertyFromConcept = createDefaultOutputForPropertyFromConcept(str, - result); - outputForPropertyFromConcept.setPropertySource(PropertySource.DOMAIN_SPECIFIC_PROPERTY); - }); - - return result; - } - - public Map resolveOPtionalSPARQLAndExecuteITToFinalPropertyValues(Map result, - String uuid) { - // ODO Auto-generated method stub - NimbleSpecificSPARQLFactory factory = new NimbleSpecificSPARQLFactory(mediatorSPARQLDerivationAndExecution, - sqpDerivationService); - Map resultFinal = new HashMap(); - result.keySet().forEach(key -> { - String sparql = factory.createSPARQLForFinalValue(result.get(key), key, reader); - if (sparql != null) { - Object r = reader.query(sparql); - List properties = reader.createResultList(r, "property"); - List values = reader.createResultList(r, "hasValue"); - String name = key; - String value = ""; - if (!properties.isEmpty()) { - name = properties.get(0); - } - if (!values.isEmpty()) { - for (String v : values) { - value += v + ";"; - } - if (value.substring(value.length() - 1).equals(";")) { - value = value.substring(0, value.length() - 1); - } - } - if (resultFinal.containsKey(name)) { - String finalValue = resultFinal.get(name); - if (finalValue != null && finalValue.length() > 0){ - value = finalValue + ";" + value; - } - resultFinal.put(name, value); - } else { - - resultFinal.put(name, value); - } - } else { - if ((!key.contains("CommodityClassification")) && (!key.contains("Dimension"))&& (!key.contains("ProductImage"))) { - resultFinal.put(key, result.get(key)); - } - } - }); - - return resultFinal; - - } - -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/NimbleSpecificSPARQLFactory.java b/src/main/java/eu/nimble/service/catalog/search/mediator/NimbleSpecificSPARQLFactory.java deleted file mode 100644 index e7e0df6..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/NimbleSpecificSPARQLFactory.java +++ /dev/null @@ -1,501 +0,0 @@ -package eu.nimble.service.catalog.search.mediator; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import de.biba.triple.store.access.IReader; -import de.biba.triple.store.access.marmotta.MarmottaReader; -import eu.nimble.service.catalog.search.impl.dao.Filter; -import eu.nimble.service.catalog.search.impl.dao.enums.PropertySource; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteSelect; -import eu.nimble.service.catalog.search.services.NimbleAdaptionServiceOfSearchResults; -import eu.nimble.service.catalog.search.services.SQPDerivationService; - -public class NimbleSpecificSPARQLFactory { - - private MediatorSPARQLDerivationAndExecution sparqlDerivation; - private NimbleSpecificSPARQLDeriviationAndExecution nimbleSpecificSPARQLDeriviation; - private IReader reader; - private SQPDerivationService sqpDerivationService; - - public NimbleSpecificSPARQLFactory(MediatorSPARQLDerivationAndExecution sparqlDerivation, - SQPDerivationService sqpDerivationService) { - super(); - this.sparqlDerivation = sparqlDerivation; - this.sqpDerivationService = sqpDerivationService; - - } - - public List createSparql(InputParamaterForExecuteSelect inputParamaterForExecuteSelect, IReader reader, - boolean instanceNeeded, boolean propertyNeeded) { - this.reader = reader; - - if (!(reader instanceof MarmottaReader)) { - return createJenaSPARQLQuery(inputParamaterForExecuteSelect); - } else { - return createMarmottaSPARQLQuery(inputParamaterForExecuteSelect, instanceNeeded, propertyNeeded); - } - } - - public String createSPARQLForFinalValue(String uuidOfProperty, String propertyname, IReader reader) { - - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?hasValue ?property where {"; - - PropertySource source = detectSourceOnBasisOfName(propertyname); - - switch (source) { - case DIMENSION: - sparql += extendSPARQLForDimensionToGivenInstance(uuidOfProperty); - break; - case CERTIFICATE: - sparql += extendSPARQLForCertificateToGivenInstance(uuidOfProperty); - break; - case ADDITIONAL_ITEM_PROPERTY: - sparql += extendSPARQLForDomainAndCustomPropertiesToGivenInstance(uuidOfProperty, reader); - break; - - case MANUFACTURER_PARTY: - sparql += extendSPARQLForManufacturerPartyToGivenInstance(uuidOfProperty); - break; - - case MANUFACTURER_ITEMS_IDENTIFICATION: - sparql += extendSPARQLForManufacturersItemIdentificationToGiven(uuidOfProperty); - break; - - case CATALOGUE_DOCUMENT_REFERENCE: - sparql += extendSPARQLForCatalogueDocumentReferenceToGiven(uuidOfProperty); - break; - - default: - Logger.getAnonymousLogger().log(Level.WARNING, "Found no specific property mapping. "); - - return null; - } - - sparql += "}"; - return sparql; - } - - private String extendSPARQLForCatalogueDocumentReferenceToGiven(String uuidOfProperty) { - String sparql = "<" + uuidOfProperty + ">" - + " ?hasValue."; - return sparql; - } - - private String extendSPARQLForManufacturersItemIdentificationToGiven(String uuidOfProperty) { - String sparql = "<" + uuidOfProperty + ">" - + " ?hasValue."; - return sparql; - } - - private String extendSPARQLForManufacturerPartyToGivenInstance(String uuidOfProperty) { - String sparql = "<" + uuidOfProperty + ">" - + " ?hasValue."; - return sparql; - } - - private String extendSPARQLForDomainAndCustomPropertiesToGivenInstance(String uuidOfProperty, IReader reader) { - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?hasValue ?property ?quality where {"; - sparql += "<" + uuidOfProperty + ">" - + " ?property. <" - + uuidOfProperty - + "> ?quality."; - sparql += "}"; - Object result = reader.query(sparql); - List quantifier = reader.createResultList(result, "quality"); - if (!quantifier.isEmpty()) { - String type = quantifier.get(0); - sparql = "<" + uuidOfProperty + ">" - + " ?property."; - - if (type.contains("REAL_MEASURE")) { - sparql += "<" + uuidOfProperty + ">" - + " ?hasValue"; - } - - if (type.contains("QUANTITY")) { - sparql += "<" + uuidOfProperty + ">" - + " ?qType. ?qType ?hasValue."; - } - if (type.contains("STRING")) { - sparql += "<" + uuidOfProperty + ">" - + " ?hasValue."; - } - - } - return sparql; - } - - private String extendSPARQLForCertificateToGivenInstance(String uuidOfProperty) { - return "<" + uuidOfProperty + ">" - + " ?hasValue"; - } - - private String extendSPARQLForDimensionToGivenInstance(String uuidOfProperty) { - - return "<" + uuidOfProperty + ">" - + " ?property. " + "<" - + uuidOfProperty + ">" - + " ?measure. ?measure ?hasValue."; - } - - private PropertySource detectSourceOnBasisOfName(String propertyname) { - - if (propertyname.contains("Additional")) { - return PropertySource.ADDITIONAL_ITEM_PROPERTY; - } - PropertySource propertySource = detectSubsetofPotentialPropertySource(propertyname); - if (propertySource != PropertySource.UNKNOWN) { - return propertySource; - } - - return PropertySource.UNKNOWN; - } - - private List createMarmottaSPARQLQuery(InputParamaterForExecuteSelect inputParamaterForExecuteSelect, - boolean instanceNeeded, boolean propertyNeeded) { - - nimbleSpecificSPARQLDeriviation = new NimbleSpecificSPARQLDeriviationAndExecution((MarmottaReader) reader, - sqpDerivationService, sparqlDerivation); - - List result = new ArrayList(); - int counter = 0; - for (String param : inputParamaterForExecuteSelect.getParameters()) { - String sparql = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct "; - - if (instanceNeeded) { - sparql += " ?instance"; - } - - if (propertyNeeded) { - sparql += " ?property"; - } - sparql += " ?hasValue"; - - // Define it is a ItemType - sparql += " where{"; - sparql += "?instance . ?instance ?type. ?type ?code. ?code ?codeValue."; - - String urlOfconcept = inputParamaterForExecuteSelect.getConcept(); - if (sparqlDerivation != null) { - urlOfconcept = sparqlDerivation.getURIOfConcept(inputParamaterForExecuteSelect.getConcept()); - } - - sparql += addPropertyForMarmotta(inputParamaterForExecuteSelect.getParametersURL().get(counter), - inputParamaterForExecuteSelect.getPropertySources().get(counter)); - - sparql += "Filter regex( ?codeValue , \"" + urlOfconcept + "\")."; - - sparql += addFilter(param, inputParamaterForExecuteSelect.getFilters()); - sparql += "}"; - result.add(sparql); - counter++; - } - return result; - } - - private String addFilters(InputParamaterForExecuteSelect inputParamaterForExecuteSelect, - Map resolvedProperties, String sparql) { - String filter = ""; - for (Filter fil : inputParamaterForExecuteSelect.getFilters()) { - String filterText = ""; - String shortName = fil.getProperty(); - if (shortName == null) { - Logger.getAnonymousLogger().log(Level.WARNING, - "Filter cannot be applied without property name: " + fil); - continue; - } - - shortName = extractNameOfURL(shortName); - if (fil.isHasMaxBeenSet() && fil.isHasMinBeenSet()) { - filterText += "FILTER ( xsd:decimal(?" + shortName + ") <= xsd:decimal(" + fil.getMax() + "))."; - filterText += "FILTER ( xsd:decimal(?" + shortName + ") >= xsd:decimal(" + fil.getMin() + "))."; - } else { - // FILTER (?name="South"^^xsd:string) - if (fil.getExactValue().matches("[0-9]+\\.*[0-9]*")) { - filterText += "FILTER(?" + shortName + "= " + fil.getExactValue() + ")"; - } else { - - filterText += "FILTER(str(?" + shortName + ")= \"" + fil.getExactValue() + "\" ^^xsd:string)"; - } - } - filter += filterText; - } - - return sparql + filter; - } - - private String addFilter(String param, List filters) { - Filter chosen = null; - for (Filter filter : filters) { - if (filter.getProperty().substring(filter.getProperty().indexOf("#") + 1).equals(param)) { - chosen = filter; - break; - } - } - - String shortName = "hasValue"; - - String filterText = ""; - if (chosen != null) { - if (chosen.isHasMaxBeenSet() && chosen.isHasMinBeenSet()) { - filterText += "FILTER ( xsd:decimal(?" + shortName + ") <= xsd:decimal(" + chosen.getMax() + "))."; - filterText += "FILTER ( xsd:decimal(?" + shortName + ") >= xsd:decimal(" + chosen.getMin() + "))."; - } else { - // FILTER (?name="South"^^xsd:string) - if (chosen.getExactValue().matches("[0-9]+\\.*[0-9]*")) { - filterText += "FILTER(xsd:decimal(?" + shortName + ")= xsd:decimal(" + chosen.getExactValue() - + "))"; - } else { - - filterText += "FILTER(str(?" + shortName + ")= \"" + chosen.getExactValue() + "\" ^^xsd:string)"; - } - } - } - return filterText; - - // if (chosen==null){ - // return ""; - // } - // else{ - // return "Filter regex( ?hasValue , \"" + chosen.getExactValue() + - // "\")."; - // } - - } - - private String addPropertyForMarmotta(String propertyURL, PropertySource propertySource2) { - - String result = ""; - - PropertySource propertySource = detectPropertySource(propertyURL, propertySource2); - switch (propertySource) { - case ADDITIONAL_ITEM_PROPERTY: - - break; - case DOMAIN_SPECIFIC_PROPERTY: - result += extendForDomainSpecificProperty(propertyURL); - return result; - - case DESCRIPTION: - result += extendForDescriptionProperty(); - break; - case NAME: - result += extendForNameProperty(); - break; - case CERTIFICATE: - result += extendForCertificate(); - break; - case DIMENSION: - result += extendForDimension(propertyURL); - return result; - case MANUFACTURER_ITEMS_IDENTIFICATION: - - result += extendForManufacturerIdentification(); - return result; - case MANUFACTURER_PARTY: - result += extendForManufacturerParty(propertyURL); - return result; - - case CATALOGUE_DOCUMENT_REFERENCE: - result += extendForCatalogueDocuemntReference(propertyURL); - return result; - - case CUSTOM_STRING: - result += extendForCustomString(propertyURL); - return result; - case CUSTOM_DECIMAL: - result += extendForCustomDecimal(propertyURL); - return result; - default: - Logger.getAnonymousLogger().log(Level.WARNING, - "Found no specific property mapping, all properties will be requested"); - break; - - } - - if (propertySource != PropertySource.DOMAIN_SPECIFIC_PROPERTY) { - result += "?instance ?property ?hasValue ."; - } else { - result += "?code2 ?property."; - } - - return result; - } - - private String extendForCatalogueDocuemntReference(String propertyURL) { - String sparql = "?instance ?documentReference. ?documentReference ?hasValue."; - sparql += "?instance ?property ?documentReference ."; - return sparql; - } - - private String extendForManufacturerIdentification() { - String sparql = "?instance ?ManufacturerParty. ?ManufacturerParty ?hasValue."; - - sparql += "?instance ?property ?ManufacturerParty ."; - - return sparql; - } - - private String extendForManufacturerParty(String propertyURL) { - String sparql = "?instance ?ManufacturerParty. ?ManufacturerParty ?hasValue."; - - sparql += "?instance ?property ?ManufacturerParty ."; - - return sparql; - } - - private String extendForCustomString(String propertyName) { - - String sparql = "?instance" - + " ?propertyValue. ?propertyValue ?property. ?propertyValue ?hasValue. ?propertyValue ?codeOfProperty. ?codeOfProperty ?value."; - - sparql += "Filter (regex( ?property , \"" + propertyName + "\") && regex (?value, \"Custom\", \" i\"))."; - - return sparql; - } - - private String extendForCustomDecimal(String propertyName) { - String sparql = "?instance" - + " ?propertyValue. ?propertyValue ?property. ?propertyValue ?valueQ. ?valueQ ?hasValue. ?propertyValue ?codeOfProperty. ?codeOfProperty ?value."; - - sparql += "Filter (regex( ?property , \"" + propertyName + "\") && regex (?value, \"Custom\", \" i\"))."; - - return sparql; - } - - private String extendForDomainSpecificProperty(String propertyURL) { - - String sparql = ""; - String sparqlForValueQuanitity = "PREFIX rdf: PREFIX owl: PREFIX rdfs: PREFIX xsd: select distinct ?instance ?property ?hasValue where{ ?instance ?aproperty. ?aproperty ?property. ?aproperty ?hasValue. Filter regex( ?property , \"" - + propertyURL + "\").}"; - Object result = reader.query(sparqlForValueQuanitity); - List content = reader.createResultList(result, "hasValue"); - - // if the value is represented as DECIMAL - if (((content.size() > 0)) && (!(content.get(0).toLowerCase().equals("string")))) { - sparql = " ?instance ?aproperty. ?aproperty ?property. ?aproperty ?qt. ?qt ?hasValue."; - sparql += " Filter regex( ?property , \"" + propertyURL + "\")."; - - } else { - // if the value is represented as Value - sparql = " ?instance ?aproperty. ?aproperty ?property. ?aproperty ?hasValue."; - sparql += " Filter regex( ?property , \"" + propertyURL + "\")."; - } - return sparql; - } - - private String extendForDimension(String propertyName) { - - String sparql = "?instance" - - + " ?dimension. ?dimension ?property. ?dimension ?measure. ?measure ?hasValue"; - sparql += " Filter regex( ?property , \"" + propertyName + "\")."; - return sparql; - } - - private String extendForCertificate() { - return "?instance" - + " ?cert. ?cert ?hasValue ."; - } - - private String extendForDescriptionProperty() { - return "?instance" - + " ?hasValue ."; - - } - - private String extendForNameProperty() { - // TODO Auto-generated method stub - return "?instance" + "<" + NimbleAdaptionServiceOfSearchResults.propertyURLForName + "> ?hasValue ."; - } - - private PropertySource detectPropertySource(String propertyURL, PropertySource propertySource2) { - - switch (propertySource2) { - case DIMENSION: - return PropertySource.DIMENSION; - - case CUSTOM_DECIMAL: - return PropertySource.CUSTOM_DECIMAL; - - case CUSTOM_STRING: - return PropertySource.CUSTOM_STRING; - - case DOMAIN_SPECIFIC_PROPERTY: - return PropertySource.DOMAIN_SPECIFIC_PROPERTY; - - default: - - String propertyName = propertyURL.toLowerCase(); - int index = propertyName.indexOf("#"); - propertyName = propertyName.substring(index + 1); - if (propertyName.contains("name")) { - return PropertySource.NAME; - } - if (propertyName.contains("description")) { - return PropertySource.DESCRIPTION; - } - - PropertySource propertySource = detectSubsetofPotentialPropertySource(propertyName); - if (propertySource != PropertySource.UNKNOWN) { - return propertySource; - } - - if (nimbleSpecificSPARQLDeriviation.isItADomainSpecificPropertyWhichHasValues(propertyURL)) { - return PropertySource.DOMAIN_SPECIFIC_PROPERTY; - } - - } - return PropertySource.ADDITIONAL_ITEM_PROPERTY; - } - - public PropertySource detectSubsetofPotentialPropertySource(String propertyName) { - propertyName = propertyName.toLowerCase(); - if (propertyName.contains("certi")) { - return PropertySource.CERTIFICATE; - } - - if (propertyName.contains("dimension")) { - return PropertySource.DIMENSION; - } - - if (propertyName.contains("manufacturerparty")) { - return PropertySource.MANUFACTURER_PARTY; - - } - - if (propertyName.contains("manufacturerparty")) { - return PropertySource.MANUFACTURER_PARTY; - } - - if (propertyName.contains("manufacturersitemidentification")) { - return PropertySource.MANUFACTURER_ITEMS_IDENTIFICATION; - } - - if (propertyName.contains("manufacturersitemidentification")) { - return PropertySource.MANUFACTURER_ITEMS_IDENTIFICATION; - } - - if (propertyName.contains("cataloguedocumentreference")) { - return PropertySource.CATALOGUE_DOCUMENT_REFERENCE; - } - - return PropertySource.UNKNOWN; - } - - private List createJenaSPARQLQuery(InputParamaterForExecuteSelect inputParamaterForExecuteSelect) { - // TODO Auto-generated method stub - return null; - } - - public String extractNameOfURL(String param) { - if (param.contains("#")) { - param = param.substring(param.indexOf("#") + 1); - } - return param; - } -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/WrapperMessage.java b/src/main/java/eu/nimble/service/catalog/search/mediator/WrapperMessage.java deleted file mode 100644 index dbbea73..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/WrapperMessage.java +++ /dev/null @@ -1,300 +0,0 @@ -package eu.nimble.service.catalog.search.mediator; - -import java.util.List; - -public class WrapperMessage { - String namespace; - String query; - List propList; - - public WrapperMessage() { - } - - public WrapperMessage(String namespace, String query, - List propList) { - this.namespace = namespace; - this.query = query; - this.propList = propList; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public List getPropList() { - return propList; - } - - public void setPropList(List propList) { - this.propList = propList; - } -} - -class WrapperProperty { - int wrapperID; - - public int getWrapperID() { - return wrapperID; - } - - public void setWrapperID(int wrapperID) { - this.wrapperID = wrapperID; - } -} - -class WrapperHTTPProperty extends WrapperProperty { - String propertyFile; - String mappingFile; - String mappingSchema; - String ontologyFile; - - public WrapperHTTPProperty() { - } - - public WrapperHTTPProperty(int wrapperID, String propertyFile, - String mappingFile, String mappingSchema, String ontologyFile) { - this.wrapperID = wrapperID; - this.propertyFile = propertyFile; - this.mappingFile = mappingFile; - this.mappingSchema = mappingSchema; - this.ontologyFile = ontologyFile; - } - - public String getPropertyFile() { - return propertyFile; - } - - public void setPropertyFile(String propertyFile) { - this.propertyFile = propertyFile; - } - - public String getMappingFile() { - return mappingFile; - } - - public void setMappingFile(String mappingFile) { - this.mappingFile = mappingFile; - } - - public String getMappingSchema() { - return mappingSchema; - } - - public void setMappingSchema(String mappingSchema) { - this.mappingSchema = mappingSchema; - } - - public String getOntologyFile() { - return ontologyFile; - } - - public void setOntologyFile(String ontologyFile) { - this.ontologyFile = ontologyFile; - } -} - -class WrapperSQLProperty extends WrapperProperty { - String propertyFile; - String mappingFile; - String mappingSchema; - String ontologyFile; - - public WrapperSQLProperty() { - } - - public WrapperSQLProperty(int wrapperID, String propertyFile, - String mappingFile, String mappingSchema, String ontologyFile) { - this.wrapperID = wrapperID; - this.propertyFile = propertyFile; - this.mappingFile = mappingFile; - this.mappingSchema = mappingSchema; - this.ontologyFile = ontologyFile; - } - - public String getPropertyFile() { - return propertyFile; - } - - public void setPropertyFile(String propertyFile) { - this.propertyFile = propertyFile; - } - - public String getMappingFile() { - return mappingFile; - } - - public void setMappingFile(String mappingFile) { - this.mappingFile = mappingFile; - } - - public String getMappingSchema() { - return mappingSchema; - } - - public void setMappingSchema(String mappingSchema) { - this.mappingSchema = mappingSchema; - } - - public String getOntologyFile() { - return ontologyFile; - } - - public void setOntologyFile(String ontologyFile) { - this.ontologyFile = ontologyFile; - } -} - -class WrapperCSVProperty extends WrapperProperty { - String propertyFile; - String csvFile; - String mappingFile; - String mappingSchema; - String ontologyFile; - String datatypeDefinitionFile; - - public WrapperCSVProperty() { - } - - public WrapperCSVProperty(String csvFile, int wrapperID, - String propertyFile, String mappingFile, String mappingSchema, - String ontologyFile, String datatypeDefinitionFile) { - this.wrapperID = wrapperID; - this.propertyFile = propertyFile; - this.mappingFile = mappingFile; - this.mappingSchema = mappingSchema; - this.ontologyFile = ontologyFile; - this.datatypeDefinitionFile = datatypeDefinitionFile; - } - - public String getPropertyFile() { - return propertyFile; - } - - public void setPropertyFile(String propertyFile) { - this.propertyFile = propertyFile; - } - - public String getCsvFile() { - return csvFile; - } - - public void setCsvFile(String csvFile) { - this.csvFile = csvFile; - } - - public String getDatatypeDefinitionFile() { - return datatypeDefinitionFile; - } - - public void setDatatypeDefinitionFile(String datatypeDefinitionFile) { - this.datatypeDefinitionFile = datatypeDefinitionFile; - } - - public String getMappingFile() { - return mappingFile; - } - - public void setMappingFile(String mappingFile) { - this.mappingFile = mappingFile; - } - - public String getMappingSchema() { - return mappingSchema; - } - - public void setMappingSchema(String mappingSchema) { - this.mappingSchema = mappingSchema; - } - - public String getOntologyFile() { - return ontologyFile; - } - - public void setOntologyFile(String ontologyFile) { - this.ontologyFile = ontologyFile; - } -} - -class WrapperXLSProperty extends WrapperProperty { - String propertyFile; - String mappingFile; - String mappingSchema; - String ontologyFile; - String datatypeDefinitionFile; - String configFolder; - - public WrapperXLSProperty() { - } - - public WrapperXLSProperty(int wrapperID, String propertyFile, - String mappingFile, String mappingSchema, String ontologyFile, - String datatypeDefinitionFile, String configFolder) { - this.wrapperID = wrapperID; - this.propertyFile = propertyFile; - this.mappingFile = mappingFile; - this.mappingSchema = mappingSchema; - this.ontologyFile = ontologyFile; - this.datatypeDefinitionFile = datatypeDefinitionFile; - this.configFolder = configFolder; - } - - public String getPropertyFile() { - return propertyFile; - } - - public void setPropertyFile(String propertyFile) { - this.propertyFile = propertyFile; - } - - public String getDatatypeDefinitionFile() { - return datatypeDefinitionFile; - } - - public void setDatatypeDefinitionFile(String datatypeDefinitionFile) { - this.datatypeDefinitionFile = datatypeDefinitionFile; - } - - public String getMappingFile() { - return mappingFile; - } - - public void setMappingFile(String mappingFile) { - this.mappingFile = mappingFile; - } - - public String getMappingSchema() { - return mappingSchema; - } - - public void setMappingSchema(String mappingSchema) { - this.mappingSchema = mappingSchema; - } - - public String getOntologyFile() { - return ontologyFile; - } - - public void setOntologyFile(String ontologyFile) { - this.ontologyFile = ontologyFile; - } - - public String getConfigFolder() { - return configFolder; - } - - public void setConfigFolder(String configFolder) { - this.configFolder = configFolder; - } -} \ No newline at end of file diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/DataSource.java b/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/DataSource.java deleted file mode 100644 index 2351392..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/DataSource.java +++ /dev/null @@ -1,97 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2017.03.11 at 09:46:29 PM MEZ -// - - -package eu.nimble.service.catalog.search.mediator.datatypes; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

    Java class for DataSource complex type. - * - *

    The following schema fragment specifies the expected content contained within this class. - * - *

    - * <complexType name="DataSource">
    - *   <complexContent>
    - *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    - *       <sequence>
    - *         <element name="pathToConfigFile" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *         <element name="javaClassForWrapper" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *       </sequence>
    - *     </restriction>
    - *   </complexContent>
    - * </complexType>
    - * 
    - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DataSource", propOrder = { - "pathToConfigFile", - "javaClassForWrapper" -}) -public class DataSource { - - @XmlElement(required = true) - protected String pathToConfigFile; - @XmlElement(required = true) - protected String javaClassForWrapper; - - /** - * Gets the value of the pathToConfigFile property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPathToConfigFile() { - return pathToConfigFile; - } - - /** - * Sets the value of the pathToConfigFile property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPathToConfigFile(String value) { - this.pathToConfigFile = value; - } - - /** - * Gets the value of the javaClassForWrapper property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getJavaClassForWrapper() { - return javaClassForWrapper; - } - - /** - * Sets the value of the javaClassForWrapper property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setJavaClassForWrapper(String value) { - this.javaClassForWrapper = value; - } - -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/InformationServices.java b/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/InformationServices.java deleted file mode 100644 index fa18120..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/InformationServices.java +++ /dev/null @@ -1,134 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2017.03.11 at 09:46:29 PM MEZ -// - - -package eu.nimble.service.catalog.search.mediator.datatypes; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

    Java class for anonymous complex type. - * - *

    The following schema fragment specifies the expected content contained within this class. - * - *

    - * <complexType>
    - *   <complexContent>
    - *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    - *       <sequence>
    - *         <element name="Service" type="{}Service" maxOccurs="unbounded"/>
    - *         <element name="URLOfTripleStore" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *         <element name="InformationRequestServiceConfigurationFile" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *       </sequence>
    - *     </restriction>
    - *   </complexContent>
    - * </complexType>
    - * 
    - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "service", - "urlOfTripleStore", - "informationRequestServiceConfigurationFile" -}) -@XmlRootElement(name = "InformationServices") -public class InformationServices { - - @XmlElement(name = "Service", required = true) - protected List service; - @XmlElement(name = "URLOfTripleStore", required = true) - protected String urlOfTripleStore; - @XmlElement(name = "InformationRequestServiceConfigurationFile", required = true) - protected String informationRequestServiceConfigurationFile; - - /** - * Gets the value of the service property. - * - *

    - * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the service property. - * - *

    - * For example, to add a new item, do as follows: - *

    -     *    getService().add(newItem);
    -     * 
    - * - * - *

    - * Objects of the following type(s) are allowed in the list - * {@link Service } - * - * - */ - public List getService() { - if (service == null) { - service = new ArrayList(); - } - return this.service; - } - - /** - * Gets the value of the urlOfTripleStore property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getURLOfTripleStore() { - return urlOfTripleStore; - } - - /** - * Sets the value of the urlOfTripleStore property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setURLOfTripleStore(String value) { - this.urlOfTripleStore = value; - } - - /** - * Gets the value of the informationRequestServiceConfigurationFile property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInformationRequestServiceConfigurationFile() { - return informationRequestServiceConfigurationFile; - } - - /** - * Sets the value of the informationRequestServiceConfigurationFile property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInformationRequestServiceConfigurationFile(String value) { - this.informationRequestServiceConfigurationFile = value; - } - -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/MediatorResult.java b/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/MediatorResult.java deleted file mode 100644 index d6d405c..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/MediatorResult.java +++ /dev/null @@ -1,54 +0,0 @@ -package eu.nimble.service.catalog.search.mediator.datatypes; - -import java.io.Serializable; - -import org.springframework.util.MultiValueMap; - - -public class MediatorResult implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1L; - - private String[][] data; - private String[] columnNames; - - public String[][] getData() { - return data; - } - - public void setData(String[][] data) { - this.data = data; - } - - public String[] getColumnNames() { - return columnNames; - } - - public void setColumnNames(String[] columnNames) { - this.columnNames = columnNames; - } - - public String toString(){ - StringBuilder sb = new StringBuilder(10000); - for (String col: columnNames){ - sb.append(col + "|"); - } - sb.append("\n"); - for (String[] row : data){ - for (String item: row){ - sb.append(item); - sb.append( "|"); - } - sb.append( "\n"); - } - return sb.toString(); - } - - public String toOutput(String typeOfOutput) { - // TODO Auto-generated method stub - return toString(); - } -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/ObjectFactory.java b/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/ObjectFactory.java deleted file mode 100644 index ce089c7..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/ObjectFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2017.03.11 at 09:46:29 PM MEZ -// - - -package eu.nimble.service.catalog.search.mediator.datatypes; - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the eu.falcon.platform.wrapperconfiguration.datatypes package. - *

    An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: eu.falcon.platform.wrapperconfiguration.datatypes - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link InformationServices } - * - */ - public InformationServices createInformationServices() { - return new InformationServices(); - } - - /** - * Create an instance of {@link OutputWrapper } - * - */ - public OutputWrapper createOutputWrapper() { - return new OutputWrapper(); - } - - /** - * Create an instance of {@link Service } - * - */ - public Service createService() { - return new Service(); - } - - /** - * Create an instance of {@link DataSource } - * - */ - public DataSource createDataSource() { - return new DataSource(); - } - -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/OutputWrapper.java b/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/OutputWrapper.java deleted file mode 100644 index 69b745e..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/OutputWrapper.java +++ /dev/null @@ -1,96 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2017.03.11 at 09:46:29 PM MEZ -// - - -package eu.nimble.service.catalog.search.mediator.datatypes; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

    Java class for OutputWrapper complex type. - * - *

    The following schema fragment specifies the expected content contained within this class. - * - *

    - * <complexType name="OutputWrapper">
    - *   <complexContent>
    - *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    - *       <sequence>
    - *         <element name="javaClassForStorage" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *         <element name="configurationForStorage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
    - *       </sequence>
    - *     </restriction>
    - *   </complexContent>
    - * </complexType>
    - * 
    - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "OutputWrapper", propOrder = { - "javaClassForStorage", - "configurationForStorage" -}) -public class OutputWrapper { - - @XmlElement(required = true) - protected String javaClassForStorage; - protected String configurationForStorage; - - /** - * Gets the value of the javaClassForStorage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getJavaClassForStorage() { - return javaClassForStorage; - } - - /** - * Sets the value of the javaClassForStorage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setJavaClassForStorage(String value) { - this.javaClassForStorage = value; - } - - /** - * Gets the value of the configurationForStorage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConfigurationForStorage() { - return configurationForStorage; - } - - /** - * Sets the value of the configurationForStorage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConfigurationForStorage(String value) { - this.configurationForStorage = value; - } - -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/QuerySolutionModel.java b/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/QuerySolutionModel.java deleted file mode 100644 index 7b3eb17..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/QuerySolutionModel.java +++ /dev/null @@ -1,57 +0,0 @@ -package eu.nimble.service.catalog.search.mediator.datatypes; - -import javax.swing.table.DefaultTableModel; - -import de.biba.mediator.IQuerySolution; -import de.biba.mediator.ISolutionIterator; - -public class QuerySolutionModel extends DefaultTableModel { - - private static final long serialVersionUID = 7230652541592370017L; - private IQuerySolution solution; - private ISolutionIterator iter; - - - public QuerySolutionModel(IQuerySolution pSolution) { - super(); - if(pSolution==null) - return; - solution = pSolution; - iter = solution.getIterator(); - - } - - @Override - public int getColumnCount() { - if(iter==null) - return 0; -// System.out.println(solution.getColumnNames().size()); - return solution.getColumnNames().size(); - } - - @Override - public int getRowCount() { - if(iter==null) - return 0; - return iter.getSize(); - } - - @Override - public Object getValueAt(int pRow, int pColumn) { - if(solution== null || pColumn>=solution.getColumnNames().size()) - return null; - return iter.get(pColumn,pRow); - } - - @Override - public String getColumnName(int pColumn) { - if(solution==null) - return ""; - return solution.getColumnNames().get(pColumn); - } - - @Override - public boolean isCellEditable(int pRow, int pColumn) { - return false; - } -} diff --git a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/Service.java b/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/Service.java deleted file mode 100644 index 66064bf..0000000 --- a/src/main/java/eu/nimble/service/catalog/search/mediator/datatypes/Service.java +++ /dev/null @@ -1,212 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2017.03.11 at 09:46:29 PM MEZ -// - - -package eu.nimble.service.catalog.search.mediator.datatypes; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

    Java class for Service complex type. - * - *

    The following schema fragment specifies the expected content contained within this class. - * - *

    - * <complexType name="Service">
    - *   <complexContent>
    - *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    - *       <sequence>
    - *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
    - *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
    - *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
    - *         <element name="query" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
    - *         <element name="namespace" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *         <element name="DataSource" type="{}DataSource" maxOccurs="unbounded" minOccurs="0"/>
    - *       </sequence>
    - *     </restriction>
    - *   </complexContent>
    - * </complexType>
    - * 
    - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Service", propOrder = { - "id", - "name", - "description", - "query", - "namespace", - "dataSource" -}) -public class Service { - - protected Integer id; - protected Integer name; - protected Integer description; - protected String query; - @XmlElement(required = true) - protected String namespace; - @XmlElement(name = "DataSource") - protected List dataSource; - - /** - * Gets the value of the id property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getId() { - return id; - } - - /** - * Sets the value of the id property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setId(Integer value) { - this.id = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setName(Integer value) { - this.name = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setDescription(Integer value) { - this.description = value; - } - - /** - * Gets the value of the query property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getQuery() { - return query; - } - - /** - * Sets the value of the query property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setQuery(String value) { - this.query = value; - } - - /** - * Gets the value of the namespace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNamespace() { - return namespace; - } - - /** - * Sets the value of the namespace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNamespace(String value) { - this.namespace = value; - } - - /** - * Gets the value of the dataSource property. - * - *

    - * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the dataSource property. - * - *

    - * For example, to add a new item, do as follows: - *

    -     *    getDataSource().add(newItem);
    -     * 
    - * - * - *

    - * Objects of the following type(s) are allowed in the list - * {@link DataSource } - * - * - */ - public List getDataSource() { - if (dataSource == null) { - dataSource = new ArrayList(); - } - return this.dataSource; - } - -} diff --git a/src/main/java/eu/nimble/service/catalog/search/services/NimbleAdaptionServiceOfSearchResults.java b/src/main/java/eu/nimble/service/catalog/search/services/NimbleAdaptionServiceOfSearchResults.java index e613854..d4b4cef 100644 --- a/src/main/java/eu/nimble/service/catalog/search/services/NimbleAdaptionServiceOfSearchResults.java +++ b/src/main/java/eu/nimble/service/catalog/search/services/NimbleAdaptionServiceOfSearchResults.java @@ -2,11 +2,13 @@ import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import de.biba.triple.store.access.dmo.Entity; import de.biba.triple.store.access.enums.Language; import de.biba.triple.store.access.marmotta.MarmottaReader; -import eu.nimble.service.catalog.search.mediator.MediatorSPARQLDerivationAndExecution; +//import eu.nimble.service.catalog.search.mediator.MediatorSPARQLDerivationAndExecution; /** * This class enhance the results or the user defined input to the NIMBLE @@ -17,13 +19,13 @@ */ public class NimbleAdaptionServiceOfSearchResults { - private MediatorSPARQLDerivationAndExecution sparqlDerivation; + //private MediatorSPARQLDerivationAndExecution sparqlDerivation; private String languageLabel; public final static String propertyURLForName = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2#Name"; - public NimbleAdaptionServiceOfSearchResults(MediatorSPARQLDerivationAndExecution sparqlDerivation, String languageLabel) { + public NimbleAdaptionServiceOfSearchResults (String languageLabel) { super(); - this.sparqlDerivation = sparqlDerivation; + //this.sparqlDerivation = sparqlDerivation; this.languageLabel = languageLabel; } @@ -59,8 +61,9 @@ private void checkWhetherNameAsMandatoryPropertyMustBeAdded(List additio entity.setHidden(false); entity.setLanguage(language); entity.setUrl(propertyURLForName); - entity.setTranslatedURL( - sparqlDerivation.translateProperty(propertyURLForName, language, languageLabel).getTranslation()); + Logger.getAnonymousLogger().log(Level.INFO, "Not supported yet"); +// entity.setTranslatedURL( +// sparqlDerivation.translateProperty(propertyURLForName, language, languageLabel).getTranslation()); additionalProperties.add(entity); } diff --git a/src/main/java/eu/nimble/service/catalog/search/services/SQPDerivationService.java b/src/main/java/eu/nimble/service/catalog/search/services/SQPDerivationService.java index 7b231bd..7a4c6c7 100644 --- a/src/main/java/eu/nimble/service/catalog/search/services/SQPDerivationService.java +++ b/src/main/java/eu/nimble/service/catalog/search/services/SQPDerivationService.java @@ -14,7 +14,7 @@ import eu.nimble.service.catalog.search.impl.dao.sqp.SQPConfiguration; import eu.nimble.service.catalog.search.impl.dao.sqp.SQPConfigurations; import eu.nimble.service.catalog.search.impl.dao.sqp.SQPMapping; -import eu.nimble.service.catalog.search.mediator.MediatorSPARQLDerivationAndExecution; +//import eu.nimble.service.catalog.search.mediator.MediatorSPARQLDerivationAndExecution; /** * This service will be used to dtermine the sqps for a given concepts @@ -26,18 +26,18 @@ public class SQPDerivationService { private Map> availableSQPsUsingConceptsAsKey = new HashMap>(); private Map availableSQPsUsingNameAsKey = new HashMap(); - private MediatorSPARQLDerivationAndExecution sparqlDerivation = null; + //private MediatorSPARQLDerivationAndExecution sparqlDerivation = null; /** * Must be extenbded for using a database for lookup * * @param sqpConfigurationPath */ - public SQPDerivationService(MediatorSPARQLDerivationAndExecution sparqlDerivation, String sqpConfigurationPath) { - - this.sparqlDerivation = sparqlDerivation; - init(sqpConfigurationPath); - } +// public SQPDerivationService(MediatorSPARQLDerivationAndExecution sparqlDerivation, String sqpConfigurationPath) { +// +// this.sparqlDerivation = sparqlDerivation; +// init(sqpConfigurationPath); +// } public SQPConfiguration getSpecificSQPConfiguration(String command) { return availableSQPsUsingNameAsKey.get(command); @@ -73,25 +73,25 @@ public void init(String sqpConfigurationPath) { } } - /** - * Get all parent concepts and ask for each of them the available set - * - * @param concept - * @return - */ - public List getListOfAvailableSQPs(String concept) { - List result = new ArrayList(); - List allDerivedConcepts = sparqlDerivation.getAllDerivedConcepts(concept); - for (String dependantConcept : allDerivedConcepts) { - if (availableSQPsUsingConceptsAsKey.containsKey(dependantConcept)) { - for (SQPConfiguration sqpConfiguration : availableSQPsUsingConceptsAsKey.get(concept)) { - result.add(sqpConfiguration.getSQPName()); - } - - } - } - return result; - } +// /** +// * Get all parent concepts and ask for each of them the available set +// * +// * @param concept +// * @return +// */ +// public List getListOfAvailableSQPs(String concept) { +// List result = new ArrayList(); +// List allDerivedConcepts = sparqlDerivation.getAllDerivedConcepts(concept); +// for (String dependantConcept : allDerivedConcepts) { +// if (availableSQPsUsingConceptsAsKey.containsKey(dependantConcept)) { +// for (SQPConfiguration sqpConfiguration : availableSQPsUsingConceptsAsKey.get(concept)) { +// result.add(sqpConfiguration.getSQPName()); +// } +// +// } +// } +// return result; +// } public SQPConfiguration getSQPConfiguration(String concept, String orangeCommand) { if (availableSQPsUsingConceptsAsKey.containsKey(concept)) { diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml index 2e912e2..4fc4c11 100644 --- a/src/main/resources/bootstrap.yml +++ b/src/main/resources/bootstrap.yml @@ -24,18 +24,29 @@ management: solr: enabled: false + +nimble: + identity: + url: ${IDENTITY_SERVICE_URL:http://nimble-staging.salzburgresearch.at/identity} + shared: + property: + indexingserviceuri: ${INDEXING_SERVICE_URI:http://nimble-dev.ikap.biba.uni-bremen.de/index/} + catalogue: + search: + configuration: ${CATALOG_SEARCH_CONFIG:/resources/sqpConfiguration-default.xml} + --- spring: profiles: productive + nimble: + identity: + url: ${IDENTITY_SERVICE_URL:http://nimble-staging.salzburgresearch.at/identity} shared: property: - marmottauri: ${MARMOTTA_URL:} - languagelabel: ${LANGUAGE_LABEL:} - useSOLRIndex: ${USE_SOLR_INDEX:true} - hybridConfiguration: ${HYBRID_CONFIG:detectMeaningLanguageSpecific} + indexingserviceuri: ${INDEXING_SERVICE_URI:http://nimble-staging.salzburgresearch.at/index/} catalogue: search: configuration: ${CATALOG_SEARCH_CONFIG:/resources/sqpConfiguration-default.xml} diff --git a/src/test/java/eu/nimble/service/catalog/search/impl/IndexingServiceTest.java b/src/test/java/eu/nimble/service/catalog/search/impl/IndexingServiceTest.java new file mode 100644 index 0000000..0d4de0e --- /dev/null +++ b/src/test/java/eu/nimble/service/catalog/search/impl/IndexingServiceTest.java @@ -0,0 +1,683 @@ +package eu.nimble.service.catalog.search.impl; + +import static org.junit.Assert.*; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.List; + +import javax.validation.constraints.AssertTrue; + +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.junit.Ignore; +import org.junit.Test; + +import de.biba.triple.store.access.enums.Language; +import eu.nimble.service.catalog.search.impl.dao.*; +import eu.nimble.service.catalog.search.impl.Indexing.IndexingServiceReader; +import eu.nimble.service.catalog.search.impl.dao.Entity; +import eu.nimble.service.catalog.search.impl.dao.ItemMappingFieldInformation; +import eu.nimble.service.catalog.search.impl.dao.LocalOntologyView; +import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteOptionalSelect; +import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteSelect; +import eu.nimble.service.catalog.search.impl.dao.input.InputParameterdetectMeaningLanguageSpecific; +import eu.nimble.service.catalog.search.impl.dao.input.InputParamterForGetLogicalView; +import eu.nimble.service.catalog.search.impl.dao.output.OutputForExecuteSelect; +import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertiesFromConcept; + +public class IndexingServiceTest { + + @Ignore + @Test + public void justCheckWhetherEndpointIsAvailable() { + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#StoragePieceOfFurniture"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + List r = indexingServiceReader.getAllPropertiesIncludingEverything(urlForClas,null); + System.out.println(r.get(0)); + + } + + @Ignore + @Test + public void filterProperties(){ + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + + boolean result = indexingServiceReader.checkWhetherPropertyIsRelevant(null, urlForClas,null); + + System.out.println(result); + } + @Ignore + @Test + public void checkLanguagesStaging() { + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + + List languages = indexingServiceReader.getSupportedLanguages(null); + + System.out.println(languages); + assertTrue(languages.size() > 0); + } + + @Ignore + @Test + public void checkLanguagesStagingEcoHouse() { + String urlIndexingService = "http://nimble-dev.ikap.biba.uni-bremen.de/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + + List languages = indexingServiceReader.getSupportedLanguages(null); + + System.out.println(languages); + assertTrue(languages.size() > 0); + } + + @Ignore + @Test + public void testgetLogicalView() { + //String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#Shelf"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + inputParameterdetectMeaningLanguageSpecific.setKeyword("mdf"); + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + List lala = indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific,null ); + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(urlForClas,null); + InputParamterForGetLogicalView input = new InputParamterForGetLogicalView(); + input.setConcept(urlForClas); + input.setLanguage("en"); + input.setDistanceToFrozenConcept(0); + input.setStepRange(2); + // input.setOldJsonLogicalView(new LocalOntologyView()); + + + + String r = indexingServiceReader.getLogicalView(input,null); + System.out.println(r); + System.out.println(r); + String r2 = indexingServiceReader.getLogicalView(input,null); + + assertEquals(r, r2); + + } + + + + + @Ignore + @Test + public void testcreateSPARQLAndExecuteITFILTEROntologicalProperty(){ + + + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + //urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#TableTop"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParamaterForExecuteSelect executeSelect = new InputParamaterForExecuteSelect(); + executeSelect.getParametersURL().add("http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour"); + + executeSelect.setConcept(urlForClas); + + Filter filter = new Filter(); + filter.setProperty("http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour"); + filter.setExactValue("Natural"); + executeSelect.getFilters().add(filter); + + +// Filter filter2 = new Filter(); +// filter2.setProperty("http://UnknownSource#price"); +// filter2.setExactValue("18.0"); +// executeSelect.getFilters().add(filter2); +// executeSelect.getFilters().add(filter2); + +// String desc =" MEDILAND XL is made of 100% of Landes Pine selected wood fibres (MDF).\n All the products of the Mediland range are manufactured by FINSA France (Morcenx), the only MDF factory set in the heart of the Landes de Gascogne. The Landes forest is the biggest forest massif of Maritime Pine (Pinus Pinaster) located in the South of Europe. Mediland boards are well-known for their quality. They have a characteristical light colour that helps improve the final results of the product, especially for applications of lacquer, paint or varnish. E1 classification: low formaldehyde content."; +// Filter filter3 = new Filter(); +// filter3.setProperty("http://UnknownSource#description"); +// filter3.setExactValue(desc); +// executeSelect.getFilters().add(filter3); + + //precondition getProperties to laod the proeprtyCache + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(urlForClas,null); + List test = indexingServiceReader.getAllDifferentValuesForAProperty(urlForClas, "http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour",null); + System.out.println(indexingServiceReader.createSPARQLAndExecuteIT(executeSelect,null)); + } + + + @Ignore + @Test + public void testcreateSPARQLAndExecuteITFILTERPrice(){ + + + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + //urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#TableTop"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParamaterForExecuteSelect executeSelect = new InputParamaterForExecuteSelect(); + executeSelect.getParametersURL().add("http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour"); + executeSelect.getParametersURL().add("http://UnknownSource#name"); + executeSelect.getParametersURL().add("http://UnknownSource#description"); + executeSelect.getParametersURL().add("http://UnknownSource#price"); + executeSelect.setConcept(urlForClas); + + Filter filter = new Filter(); + filter.setProperty("http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour"); + filter.setExactValue("Natural"); + executeSelect.getFilters().add(filter); + + + Filter filter2 = new Filter(); + filter2.setProperty("http://UnknownSource#price"); + filter2.setExactValue("18.0"); + executeSelect.getFilters().add(filter2); + executeSelect.getFilters().add(filter2); + +// String desc =" MEDILAND XL is made of 100% of Landes Pine selected wood fibres (MDF).\n All the products of the Mediland range are manufactured by FINSA France (Morcenx), the only MDF factory set in the heart of the Landes de Gascogne. The Landes forest is the biggest forest massif of Maritime Pine (Pinus Pinaster) located in the South of Europe. Mediland boards are well-known for their quality. They have a characteristical light colour that helps improve the final results of the product, especially for applications of lacquer, paint or varnish. E1 classification: low formaldehyde content."; +// Filter filter3 = new Filter(); +// filter3.setProperty("http://UnknownSource#description"); +// filter3.setExactValue(desc); +// executeSelect.getFilters().add(filter3); + + //precondition getProperties to laod the proeprtyCache + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(urlForClas, null); + List test = indexingServiceReader.getAllDifferentValuesForAProperty(urlForClas, "http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour",null); + System.out.println(indexingServiceReader.createSPARQLAndExecuteIT(executeSelect,null)); + } + + @Ignore + @Test + public void testcreateSPARQLAndExecuteITFILTERName(){ + + + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#Board"; + //urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#TableTop"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParamaterForExecuteSelect executeSelect = new InputParamaterForExecuteSelect(); + //executeSelect.getParametersURL().add("http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour"); + executeSelect.getParametersURL().add("http://UnknownSource#name"); +// executeSelect.getParametersURL().add("http://UnknownSource#description"); +// executeSelect.getParametersURL().add("http://UnknownSource#price"); + executeSelect.setConcept(urlForClas); + + Filter filter = new Filter(); + filter.setProperty("http://UnknownSource#name"); + filter.setExactValue("Mediland XL"); + executeSelect.getFilters().add(filter); + + +// Filter filter2 = new Filter(); +// filter2.setProperty("http://UnknownSource#price"); +// filter2.setExactValue("18.0"); +// executeSelect.getFilters().add(filter2); +// executeSelect.getFilters().add(filter2); + +// String desc =" MEDILAND XL is made of 100% of Landes Pine selected wood fibres (MDF).\n All the products of the Mediland range are manufactured by FINSA France (Morcenx), the only MDF factory set in the heart of the Landes de Gascogne. The Landes forest is the biggest forest massif of Maritime Pine (Pinus Pinaster) located in the South of Europe. Mediland boards are well-known for their quality. They have a characteristical light colour that helps improve the final results of the product, especially for applications of lacquer, paint or varnish. E1 classification: low formaldehyde content."; +// Filter filter3 = new Filter(); +// filter3.setProperty("http://UnknownSource#description"); +// filter3.setExactValue(desc); +// executeSelect.getFilters().add(filter3); + + //precondition getProperties to laod the proeprtyCache + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + inputParameterdetectMeaningLanguageSpecific.setKeyword("mdf"); + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific,null ); + + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(urlForClas,null); + //List test = indexingServiceReader.getAllDifferentValuesForAProperty(urlForClas, "http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour"); + + System.out.println(indexingServiceReader.createSPARQLAndExecuteIT(executeSelect,null)); + System.out.println(indexingServiceReader.createSPARQLAndExecuteIT(executeSelect,null)); + } + + @Ignore + @Test + public void testcheckWhetherPropertyIsRelevant(){ + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#Chair"; + String property = "http://www.aidimme.es/FurnitureSectorOntology.owl#hasLegs"; + + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + inputParameterdetectMeaningLanguageSpecific.setKeyword("chairs"); + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + + + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific,null ); + + boolean properties = indexingServiceReader.checkWhetherPropertyIsRelevant(property, urlForClas,null); + assertTrue(properties); + + + } + @Ignore + @Test + public void testgetPropertyFromConcept(){ + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#Chair"; + String property = "http://www.aidimme.es/FurnitureSectorOntology.owl#hasLegs"; + + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + inputParameterdetectMeaningLanguageSpecific.setKeyword("chairs"); + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + + + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + List lala = indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific,null ); + System.out.println(lala); + + OutputForPropertiesFromConcept r = indexingServiceReader.getAllTransitiveProperties(urlForClas, Language.ENGLISH,null); + System.out.println(r.getOutputForPropertiesFromConcept()); + } + @Ignore + @Test + public void testgetPropertyFromConceptMDFBoard(){ + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + String property = "http://www.aidimme.es/FurnitureSectorOntology.owl#hasLegs"; + + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + inputParameterdetectMeaningLanguageSpecific.setKeyword("mdf"); + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + + + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + List lala = indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific,null ); + System.out.println(lala); + + OutputForPropertiesFromConcept r = indexingServiceReader.getAllTransitiveProperties(urlForClas, Language.ENGLISH,null); + System.out.println(r.getOutputForPropertiesFromConcept()); + } + @Ignore + @Test + public void testcreateSPARQLAndExecuteIT(){ + + + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#Board"; + //urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#TableTop"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParamaterForExecuteSelect executeSelect = new InputParamaterForExecuteSelect(); + executeSelect.getParametersURL().add("http://UnknownSource#name"); + executeSelect.getParametersURL().add("http://UnknownSource#description"); + executeSelect.getParametersURL().add("http://UnknownSource#price"); + executeSelect.setConcept(urlForClas); + + Filter filter = new Filter(); + filter.setProperty("http://UnknownSource#name"); + filter.setExactValue("Mediland XL"); + executeSelect.getFilters().add(filter); + + + Filter filter2 = new Filter(); + filter2.setProperty("http://UnknownSource#price"); + filter2.setExactValue("18.0"); + executeSelect.getFilters().add(filter2); + executeSelect.getFilters().add(filter2); + +// String desc =" MEDILAND XL is made of 100% of Landes Pine selected wood fibres (MDF).\n All the products of the Mediland range are manufactured by FINSA France (Morcenx), the only MDF factory set in the heart of the Landes de Gascogne. The Landes forest is the biggest forest massif of Maritime Pine (Pinus Pinaster) located in the South of Europe. Mediland boards are well-known for their quality. They have a characteristical light colour that helps improve the final results of the product, especially for applications of lacquer, paint or varnish. E1 classification: low formaldehyde content."; +// Filter filter3 = new Filter(); +// filter3.setProperty("http://UnknownSource#description"); +// filter3.setExactValue(desc); +// executeSelect.getFilters().add(filter3); + + //precondition getProperties to laod the proeprtyCache + + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + inputParameterdetectMeaningLanguageSpecific.setKeyword("board"); + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific,null ); + + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(urlForClas,null); + + System.out.println(indexingServiceReader.createSPARQLAndExecuteIT(executeSelect,null)); + } + + + @Ignore + @Test + public void testcreateSPARQLAndExecuteITPropertyUnknownSource(){ + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + //urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#TableTop"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParamaterForExecuteSelect executeSelect = new InputParamaterForExecuteSelect(); + executeSelect.getParametersURL().add("http://UnknownSource#name"); + //executeSelect.getParametersURL().add("http://UnknownSource#description"); + executeSelect.getParametersURL().add("http://UnknownSource#price"); + executeSelect.setConcept(urlForClas); + + //precondition getProperties to laod the proeprtyCache + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(urlForClas,null); + + eu.nimble.service.catalog.search.impl.dao.output.OutputForExecuteSelect r = indexingServiceReader.createSPARQLAndExecuteIT(executeSelect,null); + System.out.println(r); + } + +@Ignore + @Test + public void testcreateSPARQLAndExecuteITPropertyUBLSource(){ + String urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + //urlForClas = "http://www.aidimme.es/FurnitureSectorOntology.owl#TableTop"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParamaterForExecuteSelect executeSelect = new InputParamaterForExecuteSelect(); + executeSelect.getParametersURL().add("http://www.nimble-project.org/resource/ubl#freeOfCharge"); + //executeSelect.getParametersURL().add("http://UnknownSource#description"); + //executeSelect.getParametersURL().add("http://UnknownSource#price"); + executeSelect.setConcept(urlForClas); + + //precondition getProperties to laod the proeprtyCache + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(urlForClas,null); + + eu.nimble.service.catalog.search.impl.dao.output.OutputForExecuteSelect r = indexingServiceReader.createSPARQLAndExecuteIT(executeSelect,null); + System.out.println(r); + } + + + /** + * The test just serach for any valid result + */ + @Ignore + @Test + public void testdetectPossibleConceptsLanguageSpecific() { + String serach = "Shelf"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + inputParameterdetectMeaningLanguageSpecific.setKeyword(serach); + + List r = indexingServiceReader + .detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific,null); + assertTrue(r.size() > 0); + System.out.println(r.get(0)); + + } + + @Ignore + @Test + public void testdetectPossibleConceptsLanguageSpecificII() { + String serach = "Mdf"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + inputParameterdetectMeaningLanguageSpecific.setKeyword(serach); + + List r = indexingServiceReader + .detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific,null); + assertTrue(r.size() > 0); + System.out.println(r); + + } + + @Ignore + @Test + public void testdetectPossibleConceptsLanguageSpecificIII() { + //Auxiliary supply, additive, cleaning agent + //http://www.nimble-project.org/resource/eclass#0173-1#01-AAC350#007 + String serach = "agent"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + inputParameterdetectMeaningLanguageSpecific.setKeyword(serach); + + List r = indexingServiceReader + .detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific,null); + assertTrue(r.size() > 0); + System.out.println(r); + System.out.println(r); + + } + + + @Ignore + @Test + public void testgetAllDifferentValuesForAnInvalidProperty() { + String cocnept = "http://www.aidimme.es/FurnitureSectorOntology.owl#Product"; + String property = "http://www.aidimme.es/FurnitureSectorOntology.owl#hasPrice"; + + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + + + + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + + //precondition getProperties to laod the proeprtyCache + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(cocnept,null); + + List test = indexingServiceReader.getAllDifferentValuesForAProperty(cocnept, property,null); + System.out.println(test); + assertTrue(test.size() == 0); + } + @Ignore + @Test + public void testgetAllDifferentValuesForAUnknownPropertySource() { + String cocnept = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + String property = "http://UnknownSource#price"; + + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + + //precondition getProperties to laod the proeprtyCache + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(cocnept,null); + + List test = indexingServiceReader.getAllDifferentValuesForAProperty(cocnept, property, null); + System.out.println(test); + assertTrue(test.size() > 0); + } + + @Ignore + @Test + public void testgetAllDifferentValuesForAOntologynPropertySourceLegs() { + String cocnept = "http://www.aidimme.es/FurnitureSectorOntology.owl#Chair"; + String property = "http://www.aidimme.es/FurnitureSectorOntology.owl#hasLegs"; + + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + + //precondition getProperties to laod the proeprtyCache + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + inputParameterdetectMeaningLanguageSpecific.setKeyword("chair"); + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific, null ); + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(cocnept, null); + + List test = indexingServiceReader.getAllDifferentValuesForAProperty(cocnept, property, null); + System.out.println(test); + assertTrue(test.size() > 0); + } + + @Ignore + @Test + public void testgetAllDifferentValuesForAOntologynPropertySource() { + String cocnept = "http://www.aidimme.es/FurnitureSectorOntology.owl#Board"; + String property = "http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour"; + + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + + //precondition getProperties to laod the proeprtyCache + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + inputParameterdetectMeaningLanguageSpecific.setKeyword("board"); + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific, null ); + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(cocnept, null); + + List test = indexingServiceReader.getAllDifferentValuesForAProperty(cocnept, property, null); + System.out.println(test); + assertTrue(test.size() > 0); + } + + @Ignore + @Test + public void testgetAllDifferentValuesForAUnknownPropertySourceComplexJson() { + String cocnept = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + String property = "http://UnknownSource#price"; + + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + + //precondition getProperties to laod the proeprtyCache + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(cocnept, null); + + List test = indexingServiceReader.getAllDifferentValuesForAProperty(cocnept, property, null); + System.out.println(test); + assertTrue(test.size() > 0); + } + + @Ignore + @Test + public void testgetAllDifferentValuesForAUnknownPropertySourceName() { + String cocnept = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + String property = "http://UnknownSource#name"; + + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + + //precondition getProperties to laod the proeprtyCache + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(cocnept, null); + + List test = indexingServiceReader.getAllDifferentValuesForAProperty(cocnept, property, null); + System.out.println(test); + assertTrue(test.size() > 0); + } + + @Ignore + @Test + public void testcreateOPtionalSPARQLAndExecuteIT(){ + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + String uuid = "257423"; + + System.out.println(URLEncoder.encode("localName:\"540*\"")); + + InputParamaterForExecuteOptionalSelect inputParamaterForExecuteOptionalSelect = new InputParamaterForExecuteOptionalSelect(); + inputParamaterForExecuteOptionalSelect.setLanguage("en"); + inputParamaterForExecuteOptionalSelect.setUuid(uuid); + +// String gg= "http://nimble-staging.salzburgresearch.at/index/item/select?fq=commodityClassficationUri:%22http://www.aidimme.es/FurnitureSectorOntology.owl%23Product%22&fq=certificateType:%5B*%20TO%20*%5D&facet.field=certificateType"; +// System.out.println(URLDecoder.decode(gg)); + + OutputForExecuteSelect r = indexingServiceReader.createOPtionalSPARQLAndExecuteIT(inputParamaterForExecuteOptionalSelect, null); + System.out.println(r); + System.out.println("##########################"); + r = indexingServiceReader.createOPtionalSPARQLAndExecuteIT(inputParamaterForExecuteOptionalSelect, null); + System.out.println(r); + } + + @Ignore + @Test + public void testcreateOPtionalSPARQLAndExecuteITI(){ + String cocnept = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + String uuid = "255841"; + + InputParamaterForExecuteOptionalSelect inputParamaterForExecuteOptionalSelect = new InputParamaterForExecuteOptionalSelect(); + inputParamaterForExecuteOptionalSelect.setLanguage("en"); + inputParamaterForExecuteOptionalSelect.setUuid(uuid); + + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(cocnept, null); + System.out.println("##########################"); + OutputForExecuteSelect r = indexingServiceReader.createOPtionalSPARQLAndExecuteIT(inputParamaterForExecuteOptionalSelect, null); + System.out.println(r); + System.out.println(r); + } + @Ignore + @Test + public void testPropertiesFromfTheGreenGroupI(){ + //http://www.aidimme.es/FurnitureSectorOntology.owl#hasEAN + String cocnept = "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard"; + String property = "http://www.aidimme.es/FurnitureSectorOntology.owl#hasEAN"; + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + List properties = indexingServiceReader.getAllPropertiesIncludingEverything(cocnept, null); + System.out.println(indexingServiceReader.getAllDifferentValuesForAProperty(cocnept, property, null)); + + } + @Ignore + @Test + public void testgetAllMappableFields(){ + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + List r = indexingServiceReader.getAllMappableFields(); + } + @Ignore + @Test + public void testUBLProperties(){ + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + String urlForPropertyInformationUBL = "https://nimble-platform.salzburgresearch.at/nimble/indexing-service/"; + indexingServiceReader.setUrlForPropertyInformationUBL(urlForPropertyInformationUBL ); + System.out.println(indexingServiceReader.requestStandardPropertiesFromUBL(null)); + } + @Ignore + @Test + public void testrequestAllIndexFields(){ + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + System.out.println(indexingServiceReader.requestAllIndexFields()); + + } + + @Ignore + @Test + public void testgetDetectMeaningStaging() { + String urlIndexingService = "http://nimble-staging.salzburgresearch.at/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + inputParameterdetectMeaningLanguageSpecific.setKeyword("mdf"); + inputParameterdetectMeaningLanguageSpecific.setLanguage("en"); + List r = indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific, null); + System.out.println(r); + + } + + @Ignore + @Test + public void testgetDetectMeaningEcoHouse() { + //String urlIndexingService = "http://nimble-dev.ikap.biba.uni-bremen.de:9101/index/"; + String urlIndexingService = "http://nimble-dev.ikap.biba.uni-bremen.de/index/"; + IndexingServiceReader indexingServiceReader = new IndexingServiceReader(urlIndexingService); + InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = new InputParameterdetectMeaningLanguageSpecific(); + inputParameterdetectMeaningLanguageSpecific.setKeyword("chair"); + inputParameterdetectMeaningLanguageSpecific.setLanguage("sv"); + indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific, null); + List r = indexingServiceReader.detectPossibleConceptsLanguageSpecific(inputParameterdetectMeaningLanguageSpecific, null); + System.out.println(r); + System.out.println("ddd"); + } + + /** + * http://nimble-staging.salzburgresearch.at/search/getPropertyValuesDiscretised?inputAsJson={%22concept%22:%22http%3A%2F%2Fwww.aidimme.es%2FFurnitureSectorOntology.owl%23Chair%22,%22property%22:%22http%3A%2F%2FUnknownSource%23price%22,%22amountOfGroups%22:3,%22language%22:%22ENGLISH%22} + */ + + /** + * http://www.aidimme.es/FurnitureSectorOntology.owl#Piano + */ + +} diff --git a/src/test/java/eu/nimble/service/catalog/search/impl/MediatorSPARQLDerivationTest.java b/src/test/java/eu/nimble/service/catalog/search/impl/MediatorSPARQLDerivationTest.java deleted file mode 100644 index 4e7e102..0000000 --- a/src/test/java/eu/nimble/service/catalog/search/impl/MediatorSPARQLDerivationTest.java +++ /dev/null @@ -1,308 +0,0 @@ -package eu.nimble.service.catalog.search.impl; - -import static org.junit.Assert.assertTrue; - -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.junit.Ignore; -import org.junit.Test; -import org.mockito.Mock; - -import com.google.gson.Gson; - -import static org.mockito.Mockito.*; - -import eu.nimble.service.catalog.search.impl.dao.Entity; -import de.biba.triple.store.access.enums.Language; -import de.biba.triple.store.access.marmotta.MarmottaReader; -import eu.nimble.service.catalog.search.impl.dao.Filter; -import eu.nimble.service.catalog.search.impl.dao.Group; -import eu.nimble.service.catalog.search.impl.dao.LocalOntologyView; -import eu.nimble.service.catalog.search.impl.dao.enums.PropertySource; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteOptionalSelect; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteSelect; -import eu.nimble.service.catalog.search.impl.dao.input.Parameter; -import eu.nimble.service.catalog.search.impl.dao.input.Tuple; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForExecuteSelect; -import eu.nimble.service.catalog.search.impl.dao.output.TranslationResult; -import eu.nimble.service.catalog.search.mediator.MediatorSPARQLDerivationAndExecution; -import eu.nimble.service.catalog.search.mediator.NimbleSpecificSPARQLFactory; - -public class MediatorSPARQLDerivationTest extends MediatorSPARQLDerivationAndExecution { - - @Mock - MarmottaReader readerMock; - - private static final String C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL = "C:/ontology/FurnitureOntology-v1.5-biba_editedV2.owl"; - - @Test - @Ignore - public void testGroupingOfPropertyValues() { - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivation = new MediatorSPARQLDerivationAndExecution(); - - String concept = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Bed"; - String property = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#price"; - - Map> results = mediatorSPARQLDerivation.generateGroup(3, concept, property, PropertySource.DOMAIN_SPECIFIC_PROPERTY); - System.out.println(results); - - } - - @Test - @Ignore - public void testgetViewForOneStepRange() { - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivation = new MediatorSPARQLDerivationAndExecution( - C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - LocalOntologyView helper = new LocalOntologyView(); - String translationLabel = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#translation"; - this.setLanguagelabel(translationLabel); - - Entity concept = new Entity(); - concept.setUrl(getURIOfConcept("HighChair")); - String label = translateConcept(concept.getUrl(), Language.SPANISH, this.getLanguagelabel()).getTranslation(); - concept.setTranslatedURL(label); - - helper.setConcept(concept); - LocalOntologyView result = mediatorSPARQLDerivation.getViewForOneStepRange(helper.getConcept().getUrl(), helper, null, Language.SPANISH); - assertTrue(result.getDataproperties().size() > 0); - System.out.println(result.getDataproperties()); - System.out.println(result.getObjectproperties()); - } - - @Test - @Ignore - public void testgetViewForHighChair() { - - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivation = new MediatorSPARQLDerivationAndExecution( - C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - LocalOntologyView helper = new LocalOntologyView(); - String translationLabel = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#translation"; - this.setLanguagelabel(translationLabel); - - Entity concept = new Entity(); - concept.setUrl(getURIOfConcept("HighChair")); - String label = translateConcept(concept.getUrl(), Language.ENGLISH, this.getLanguagelabel()).getTranslation(); - concept.setTranslatedURL(label); - - helper.setConcept(concept); - LocalOntologyView result = mediatorSPARQLDerivation.getViewForOneStepRange(helper.getConcept().getUrl(), helper, null, Language.SPANISH); - assertTrue(result.getDataproperties().size() > 0); - System.out.println(result.getDataproperties()); - System.out.println(result.getObjectproperties()); - } - - - @Test - @Ignore - public void testCreateSPARQLMockedMarmotta() { - - final List cocnepts = new ArrayList(); - readerMock = mock(MarmottaReader.class); - cocnepts.add("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"); - cocnepts.add("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair2"); - when(readerMock.getAllTransitiveSubConcepts(anyString())).thenReturn(cocnepts); - when(readerMock.getAllConcepts(anyString())).thenReturn(cocnepts); - //List allPossibleProperties = reader.getAllProperties(property); - List properties1 = new ArrayList(); - properties1.add("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasHeight"); - when(readerMock.getAllProperties("hasHeight")).thenReturn(properties1); - - List properties2 = new ArrayList(); - properties2.add("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWidth"); - when(readerMock.getAllProperties("hasWidth")).thenReturn(properties2); - - String concept = "HighChair"; - String prop1 = "hasHeight"; - String prop2 = "hasWidth"; - - Filter f1 = new Filter(); - f1.setProperty("hasHeight"); - f1.setMax(5.2f); - f1.setMin(3.0f); - - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.getFilters().add(f1); - inputParamaterForExecuteSelect.setConcept(concept); - inputParamaterForExecuteSelect.getParameters().add(prop1); - inputParamaterForExecuteSelect.getParameters().add(prop2); - Parameter parameter1 = new Parameter(); - parameter1.getPath().add(new Tuple()); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - String sparql = createSparql(inputParamaterForExecuteSelect, readerMock); - assertTrue(sparql.length() > 10); - System.out.println(sparql); - - } - - @Test - @Ignore - public void testCreateSPARQL() { - initForSpecificOntology(C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - String concept = "HighChair"; - String prop1 = "hasHeight"; - String prop2 = "hasWidth"; - - Filter f1 = new Filter(); - f1.setProperty("hasHeight"); - f1.setMax(5.2f); - f1.setMin(3.0f); - - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.getFilters().add(f1); - inputParamaterForExecuteSelect.setConcept(concept); - inputParamaterForExecuteSelect.getParameters().add(prop1); - inputParamaterForExecuteSelect.getParameters().add(prop2); - Parameter parameter1 = new Parameter(); - parameter1.getPath().add(new Tuple()); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - String sparql = createSparql(inputParamaterForExecuteSelect); - - assertTrue(sparql.length() > 10); - System.out.println(sparql); - - } - - @Test - @Ignore - public void testcreateSPARQLAndExecuteIT(){ - initForSpecificOntology(C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - String concept = "HighChair"; - String prop1 = "hasHeight"; - String prop2 = "hasWidth"; - String translationLabel = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#translation"; - this.setLanguagelabel(translationLabel); - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept(concept); - inputParamaterForExecuteSelect.getParameters().add(prop1); - inputParamaterForExecuteSelect.getParameters().add(prop2); - inputParamaterForExecuteSelect.setLanguage("es"); - OutputForExecuteSelect result = createSPARQLAndExecuteIT(inputParamaterForExecuteSelect); - assertTrue(result.getColumns().size() > 0); - System.out.println(result); - - } - - @Test - @Ignore - public void testcreateSPARQLAndExecuteITII(){ - initForSpecificOntology(C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - String concept = "HighChair"; - String prop1 = "hasHeight"; - String prop2 = "hasWidth"; - String prop3 = "hasLegislationName"; - String translationLabel = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#translation"; - this.setLanguagelabel(translationLabel); - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept(concept); - inputParamaterForExecuteSelect.getParameters().add(prop1); - inputParamaterForExecuteSelect.getParameters().add(prop2); - inputParamaterForExecuteSelect.getParameters().add(prop3); - inputParamaterForExecuteSelect.setLanguage("en"); - - Parameter parameter1 = new Parameter(); - Parameter parameter2 = new Parameter(); - Parameter parameter3 = new Parameter(); - Tuple t1 = new Tuple(); - t1.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"); - t1.setUrlOfProperty(null); - - parameter1.getPath().add(t1); - parameter2.getPath().add(t1); - parameter3.getPath().add(t1); - - - - Tuple t2 = new Tuple(); - t2.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer"); - t2.setUrlOfProperty("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isManufacturedBy"); - - Tuple t3 = new Tuple(); - t3.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"); - t3.setUrlOfProperty("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#compliesWithLegislation"); - - - parameter3.getPath().add(t2); - parameter3.getPath().add(t3); - - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter2); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter3); - - OutputForExecuteSelect result = createSPARQLAndExecuteIT(inputParamaterForExecuteSelect); - assertTrue(result.getColumns().size() > 0); - System.out.println(result); - - } - - - - - - //http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#T950_Plus_Natural - @Test - @Ignore - public void testcreateOptionalSPARQLAndExecuteIT(){ - initForSpecificOntology(C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - String indi = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#T950_Plus_Natural"; - - InputParamaterForExecuteOptionalSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteOptionalSelect(); - String translationLabel = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#translation"; - this.setLanguagelabel(translationLabel); - inputParamaterForExecuteSelect.setLanguage("es"); - inputParamaterForExecuteSelect.setUuid(indi); - OutputForExecuteSelect result = createOPtionalSPARQLAndExecuteIT(inputParamaterForExecuteSelect); - assertTrue(result.getColumns().size() > 0); - System.out.println(result); - - } - - // - @Test - @Ignore - public void testgetLabelToConcept(){ - initForSpecificOntology("C:/ontology/FurnitureOntology-v1.5-biba_edited.owl"); - String indi = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#T950_Plus_Natural"; - String translationLabel = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#translation"; - - TranslationResult result = translateConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#ContactPerson", Language.SPANISH,translationLabel ); - System.out.println("Result: " + result); - - } - - @Test - @Ignore - public void testSPARQLFactory(){ - InputParamaterForExecuteSelect paramaterForExecuteSelect = new InputParamaterForExecuteSelect(); - paramaterForExecuteSelect.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - List parameters = new ArrayList(); - parameters.add("name"); - parameters.add("description"); - parameters.add("vanish"); - - List parameterURLS = new ArrayList(); - parameterURLS.add("urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2#Name"); - parameterURLS.add("urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2#Description"); - parameterURLS.add("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - paramaterForExecuteSelect.setParameters(parameters); - paramaterForExecuteSelect.setParametersURL(parameterURLS); - - Gson gson = new Gson(); - System.out.println(URLEncoder.encode(gson.toJson(paramaterForExecuteSelect))); - - MarmottaReader marmottaReader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - - NimbleSpecificSPARQLFactory factory = new NimbleSpecificSPARQLFactory(null,null); - List sparqls = factory.createSparql(paramaterForExecuteSelect, marmottaReader,true,true); - for (String str: sparqls){ - System.out.println(str); - } - - } -} diff --git a/src/test/java/eu/nimble/service/catalog/search/impl/TestInputParamtersAndOutputParameterForUI.java b/src/test/java/eu/nimble/service/catalog/search/impl/TestInputParamtersAndOutputParameterForUI.java deleted file mode 100644 index b8c49e9..0000000 --- a/src/test/java/eu/nimble/service/catalog/search/impl/TestInputParamtersAndOutputParameterForUI.java +++ /dev/null @@ -1,370 +0,0 @@ -package eu.nimble.service.catalog.search.impl; - -import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Test; - - -import com.google.gson.Gson; - -import eu.nimble.service.catalog.search.impl.dao.Entity; -import de.biba.triple.store.access.enums.Language; -import eu.nimble.service.catalog.search.impl.dao.Filter; -import eu.nimble.service.catalog.search.impl.dao.LocalOntologyView; -import eu.nimble.service.catalog.search.impl.dao.enums.PropertySource; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteOptionalSelect; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteSelect; -import eu.nimble.service.catalog.search.impl.dao.input.InputParameter; -import eu.nimble.service.catalog.search.impl.dao.input.InputParameterForGetReferencesFromAConcept; -import eu.nimble.service.catalog.search.impl.dao.input.InputParameterForPropertyValuesFromGreenGroup; -import eu.nimble.service.catalog.search.impl.dao.input.InputParameterForPropertyValuesFromOrangeGroup; -import eu.nimble.service.catalog.search.impl.dao.input.InputParameterForgetPropertyValuesDiscretised; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamterForGetLogicalView; -import eu.nimble.service.catalog.search.impl.dao.input.Parameter; -import eu.nimble.service.catalog.search.impl.dao.input.Tuple; -import eu.nimble.service.catalog.search.impl.dao.output.MeaningResult; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForGetLogicalView; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertyValuesFromOrangeGroup; - -public class TestInputParamtersAndOutputParameterForUI { - - @Test - public void doJson() { - InputParameter parameter = new InputParameter(); - parameter.setUserData(new String[] { "select ?Customer ?CustomerID where { ?Customer a \u003cCustomer\u003e. ?Customer \u003cCustomerID\u003e ?CustomerID.}", "http://www.semanticweb.org/dqu/ontologies/2016/1/untitled-ontology-43" }); - parameter.setTypeOfQuery("sparql"); - parameter.setTypeOfOutput("xml"); - - Gson gson = new Gson(); - System.out.println(gson.toJson(parameter)); - } - @Test - public void doJson2() { - InputParameter parameter = new InputParameter(); - parameter.setUserData(new String[] { "select ?S ?took where { ?S a \u003cSomething\u003e. ?S \u003ctook\u003e ?id.}", "http://NIMBLE.eu" }); - parameter.setTypeOfQuery("sparql"); - parameter.setTypeOfOutput("xml"); - - Gson gson = new Gson(); - System.out.println(gson.toJson(parameter)); - } - - @Test - public void doLocalOntologyView() { - LocalOntologyView parameter = new LocalOntologyView(); - Entity cocnept = new Entity(); - cocnept.setUrl("http://blupp"); - cocnept.setTranslatedURL("bla2"); - - - parameter.setConcept(cocnept); - List pros = new ArrayList<>(); - - - Entity entity = new Entity(); - entity.setUrl("http://blupp"); - entity.setTranslatedURL("bla2"); - - pros.add(entity); - parameter.setDataproperties(pros); - - Map map = new HashMap(); - map.put("conceprt2", new LocalOntologyView()); - parameter.setObjectproperties(map); - - - Gson gson = new Gson(); - System.out.println(URLEncoder.encode(gson.toJson(parameter))); - } - - @Test - public void doJson_InputParamterForGetLogicalView(){ - InputParamterForGetLogicalView InputParamterForGetLogicalView = new InputParamterForGetLogicalView(); - InputParamterForGetLogicalView.setConcept(URLEncoder.encode("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair")); - InputParamterForGetLogicalView.setFrozenConcept("ddd"); - InputParamterForGetLogicalView.setStepRange(2); - Gson gson = new Gson(); - System.out.println(gson.toJson(InputParamterForGetLogicalView)); - } - - //http://www.aidimme.es/FurnitureSectorOntology.owl - - @Test - public void do_Json_InputParameterForPropertyValuesFromGreenGroup(){ - InputParameterForPropertyValuesFromGreenGroup inputParameterForPropertyValuesFromGreenGroup = new InputParameterForPropertyValuesFromGreenGroup(); - inputParameterForPropertyValuesFromGreenGroup.setConceptURL(URLEncoder.encode("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair")); - inputParameterForPropertyValuesFromGreenGroup.setPropertyURL(URLEncoder.encode("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#hasWidth")); - - Gson gson = new Gson(); - System.out.println(gson.toJson(inputParameterForPropertyValuesFromGreenGroup)); - } - - @Test - public void do_Json_InputParameterForGetReferencesFromAConcept(){ - InputParameterForGetReferencesFromAConcept InputParameterForGetReferencesFromAConcept = new InputParameterForGetReferencesFromAConcept(); - InputParameterForGetReferencesFromAConcept.setConceptURL(URLEncoder.encode("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair")); - InputParameterForGetReferencesFromAConcept.setLanguage("es"); - Gson gson = new Gson(); - System.out.println(gson.toJson(InputParameterForGetReferencesFromAConcept)); - } - - @Test - public void do_Json_InputParameterForGetReferencesFromAConceptRemote(){ - InputParameterForGetReferencesFromAConcept InputParameterForGetReferencesFromAConcept = new InputParameterForGetReferencesFromAConcept(); - InputParameterForGetReferencesFromAConcept.setConceptURL(URLEncoder.encode("http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair")); - InputParameterForGetReferencesFromAConcept.setLanguage("es"); - Gson gson = new Gson(); - System.out.println(gson.toJson(InputParameterForGetReferencesFromAConcept)); - } - - @Test - public void do_Json_InputParameterForPropertyValuesFromGreenGroupForHydra(){ - InputParameterForPropertyValuesFromGreenGroup inputParameterForPropertyValuesFromGreenGroup = new InputParameterForPropertyValuesFromGreenGroup(); - inputParameterForPropertyValuesFromGreenGroup.setConceptURL(URLEncoder.encode("http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair")); - inputParameterForPropertyValuesFromGreenGroup.setPropertyURL(URLEncoder.encode("http://www.aidimme.es/FurnitureSectorOntology.owl#hasWidth")); - - Gson gson = new Gson(); - System.out.println(gson.toJson(inputParameterForPropertyValuesFromGreenGroup)); - } - - @Test - public void doJson_InputParamterForGetLogicalView2(){ - InputParamterForGetLogicalView InputParamterForGetLogicalView = new InputParamterForGetLogicalView(); - InputParamterForGetLogicalView.setConcept(URLEncoder.encode("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair")); - InputParamterForGetLogicalView.setFrozenConcept("HighChair"); - InputParamterForGetLogicalView.setStepRange(1); - InputParamterForGetLogicalView.setLanguage("es"); - InputParamterForGetLogicalView.setDistanceToFrozenConcept(0); - List conceptPath = new ArrayList(); - conceptPath.add(URLEncoder.encode("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair")); - Gson gson = new Gson(); - System.out.println(gson.toJson(InputParamterForGetLogicalView)); - } - - - - //InputParameterForgetPropertyValuesDiscretised - @Test - public void doJson_InputParameterForgetPropertyValuesDiscretised(){ - InputParameterForgetPropertyValuesDiscretised inputParameterForgetPropertyValuesDiscretised = new InputParameterForgetPropertyValuesDiscretised(); - inputParameterForgetPropertyValuesDiscretised.setAmountOfGroups(3); - inputParameterForgetPropertyValuesDiscretised.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#StackerRobot"); - inputParameterForgetPropertyValuesDiscretised.setProperty("Height"); - inputParameterForgetPropertyValuesDiscretised.setLanguage("en"); - inputParameterForgetPropertyValuesDiscretised.setPropertySource(PropertySource.DIMENSION); - Gson gson = new Gson(); - System.out.println(gson.toJson(inputParameterForgetPropertyValuesDiscretised)); - System.out.println(URLEncoder.encode(gson.toJson(inputParameterForgetPropertyValuesDiscretised))); - } - - @Test - public void doJson_InputParamaterForExecuteSelect(){ - - String concept = "http://www.nimble-project.org/resource/eclass/22292803"; - String prop1 = "name"; - String prop2 = "hasColour"; - String prop3 = "custom_dimensione"; - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept(concept); - inputParamaterForExecuteSelect.getParameters().add(prop1); - inputParamaterForExecuteSelect.getParameters().add(prop2); - inputParamaterForExecuteSelect.getParameters().add(prop3); - inputParamaterForExecuteSelect.setLanguage("en"); - - inputParamaterForExecuteSelect.getParametersURL().add("urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2#Name"); - inputParamaterForExecuteSelect.getParametersURL().add("http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour"); - inputParamaterForExecuteSelect.getParametersURL().add("custom_dimensione"); - - - inputParamaterForExecuteSelect.getPropertySources().add(PropertySource.DIRECT_PROPERTIES); - inputParamaterForExecuteSelect.getPropertySources().add(PropertySource.DOMAIN_SPECIFIC_PROPERTY); - inputParamaterForExecuteSelect.getPropertySources().add(PropertySource.DIMENSION); - - - Parameter parameter1 = new Parameter(); - Parameter parameter2 = new Parameter(); - Parameter parameter3 = new Parameter(); - Tuple t1 = new Tuple(); - t1.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"); - t1.setUrlOfProperty(null); - - parameter1.getPath().add(t1); - parameter2.getPath().add(t1); - parameter3.getPath().add(t1); - - - - Tuple t2 = new Tuple(); - t2.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer"); - t2.setUrlOfProperty("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isManufacturedBy"); - - Tuple t3 = new Tuple(); - t3.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"); - t3.setUrlOfProperty("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#compliesWithLegislation"); - - - parameter3.getPath().add(t2); - parameter3.getPath().add(t3); - - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter2); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter3); - - Gson gson = new Gson(); - System.out.println(gson.toJson(inputParamaterForExecuteSelect)); - } - - - @Test - public void doJson_InputParamaterForExecuteSelect_NIMBLE_56(){ - - String concept = "HighChair"; - String prop1 = "hasLegs"; - - String prop3 = "hasCompanyName"; - String translationLabel = "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#translation"; - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept(concept); - inputParamaterForExecuteSelect.getParameters().add(prop1); - - inputParamaterForExecuteSelect.getParameters().add(prop3); - inputParamaterForExecuteSelect.setLanguage("en"); - - Parameter parameter1 = new Parameter(); - Parameter parameter2 = new Parameter(); - Parameter parameter3 = new Parameter(); - - Tuple t1 = new Tuple(); - t1.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#HighChair"); - t1.setUrlOfProperty(null); - - parameter1.getPath().add(t1); - //parameter2.getPath().add(t1); - parameter3.getPath().add(t1); - - - - Tuple t2 = new Tuple(); - t2.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Manufacturer"); - t2.setUrlOfProperty("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#isManufacturedBy"); - -// Tuple t3 = new Tuple(); -// t3.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"); -// t3.setUrlOfProperty("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#compliesWithLegislation"); - - - parameter3.getPath().add(t2); - //parameter3.getPath().add(t3); - - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - //inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter2); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter3); - inputParamaterForExecuteSelect.getParametersURL().add("http://namespac#hasLegs"); - inputParamaterForExecuteSelect.getParametersURL().add("http://namespac#HasCompanyname"); - Gson gson = new Gson(); - System.out.println(gson.toJson(inputParamaterForExecuteSelect)); - } - - @Test - public void doJson_InputParamaterForExecuteOptionalSelect(){ - InputParamaterForExecuteOptionalSelect test = new InputParamaterForExecuteOptionalSelect(); - test.setUuid(URLEncoder.encode("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#T950_Plus_Natural")); - - try { - String result = URLEncoder.encode("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#T950_Plus_Natural", "UTF-8"); - System.out.println(result); - } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - Gson gson = new Gson(); - System.out.println(gson.toJson(test)); - } - - - @Test - public void doJson_MeaningResult() { - MeaningResult parameter = new MeaningResult(); - Map> map = new HashMap>(); - List properties = new ArrayList(); - properties.add("size"); - properties.add("weight"); - - map.put("Bed", properties); - //parameter.setConceptOverview(map); - parameter.setSearchTyp("ExplorativeSearch"); - - Gson gson = new Gson(); - System.out.println(gson.toJson(parameter)); - } - - @Test - public void doJson_InputParameterForPropertyValuesFromOrangeGroup() - { - InputParameterForPropertyValuesFromOrangeGroup forPropertyValuesFromOrangeGroup = new InputParameterForPropertyValuesFromOrangeGroup(); - String command = "companyName"; - String concept = "http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair"; - forPropertyValuesFromOrangeGroup.setConceptURL(concept); - forPropertyValuesFromOrangeGroup.setOrangeCommand(command); - Gson gson = new Gson(); - System.out.println(gson.toJson(forPropertyValuesFromOrangeGroup)); - } - - @Test - public void doJson_OutputForPropertyValuesFromOrangeGroup() - { - OutputForPropertyValuesFromOrangeGroup forPropertyValuesFromOrangeGroup = new OutputForPropertyValuesFromOrangeGroup(); - String command = "companyName"; - String concept = "http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair"; - forPropertyValuesFromOrangeGroup.getAllValues().add("Http://indiToConcept"); - forPropertyValuesFromOrangeGroup.setBelongsToTheFollowingConcept("http://goiodConcept"); - forPropertyValuesFromOrangeGroup.setItAConcept(true); - forPropertyValuesFromOrangeGroup.setITASimpleValue(false); - - Gson gson = new Gson(); - System.out.println(gson.toJson(forPropertyValuesFromOrangeGroup)); - } - - @Test - public void OutputForExecuteSelect() { - - InputParamaterForExecuteSelect test = new InputParamaterForExecuteSelect(); - test.setConcept("AirBed"); - test.getParameters().add("hieght"); - test.getParameters().add("size"); - Filter f1 = new Filter(); - f1.setMax(5.2f); - f1.setMin(3.0f); - test.getFilters().add(f1); - - eu.nimble.service.catalog.search.impl.dao.output.OutputForExecuteSelect output = new eu.nimble.service.catalog.search.impl.dao.output.OutputForExecuteSelect(); - output.setInput(test); - output.getColumns().add("height"); - output.getColumns().add("size"); - - ArrayList row1 = new ArrayList(); - row1.add("100"); - row1.add("34"); - - ArrayList row2 = new ArrayList(); - row2.add("1009"); - row2.add("37"); - - output.getRows().add(row1); - output.getRows().add(row2); - - - Gson gson = new Gson(); - System.out.println(gson.toJson(output)); - } - - -} diff --git a/src/test/java/eu/nimble/service/catalog/search/impl/TestNimbleSpecificSPARQLDeriviation.java b/src/test/java/eu/nimble/service/catalog/search/impl/TestNimbleSpecificSPARQLDeriviation.java deleted file mode 100644 index 2394a65..0000000 --- a/src/test/java/eu/nimble/service/catalog/search/impl/TestNimbleSpecificSPARQLDeriviation.java +++ /dev/null @@ -1,352 +0,0 @@ -package eu.nimble.service.catalog.search.impl; - -import static org.junit.Assert.fail; - -import java.io.File; -import java.util.List; - -import org.junit.Ignore; -import org.junit.Test; - -import de.biba.triple.store.access.dmo.Entity; -import de.biba.triple.store.access.enums.Language; -import de.biba.triple.store.access.jena.Reader; -import de.biba.triple.store.access.marmotta.MarmottaReader; -import eu.nimble.service.catalog.search.impl.dao.CustomPropertyInformation; -import eu.nimble.service.catalog.search.impl.dao.enums.PropertySource; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertiesFromConcept; -import eu.nimble.service.catalog.search.mediator.MediatorSPARQLDerivationAndExecution; -import eu.nimble.service.catalog.search.mediator.NimbleSpecificSPARQLDeriviationAndExecution; -import eu.nimble.service.catalog.search.services.SQPDerivationService; - -public class TestNimbleSpecificSPARQLDeriviation { - - private static final String C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL = "C:/ontology/FurnitureSectorTaxonomy-v1.8_BIBA.owl"; - - @Ignore - @Test - public void testcreateSPARQLForAllDomainSpecificProperties() { - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution(null, - null, null); - String sparql = deriviation.createSPARQLForAllDomainSpecificProperties(); - System.out.println(sparql); - - } - - @Ignore - @Test - public void testgetPropertyValuesForOrangeGroup() { - File file = new File("./src/main/resources/sqpConfiguration.xml"); - if (file.exists()) { - Reader reader = new Reader(); - reader.setModeToLocal(); - reader.loadOntologyModel(C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - - SQPDerivationService sqpDerivationService = new SQPDerivationService(null, - "./src/main/resources/sqpConfiguration.xml"); - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, null); - String command = "companyName"; - String concept = "http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair"; - eu.nimble.service.catalog.search.impl.dao.output.OutputForPropertyValuesFromOrangeGroup result = deriviation - .getPropertyValuesForOrangeGroup(command, concept,false); - System.out.println(result.getAllValues()); - - } else { - fail("No configuration file found"); - } - } - - //@Ignore - @Test - public void testgetAllDifferentValuesForAProperty() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.getAllDifferentValuesForAProperty( - "http://www.nimble-project.org/resource/eclass/22292803", - "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2#Name", PropertySource.DIRECT_PROPERTIES); - System.out.println(result); - } - - - @Test - public void testgetAllDifferentValuesForAProperty_DomainSpecific() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.getAllDifferentValuesForAProperty( - "http://www.nimble-project.org/resource/eclass/22292803", - "http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour", PropertySource.DOMAIN_SPECIFIC_PROPERTY); - System.out.println(result); - } - - - @Test - public void testdetectNimbleSpecificMeaningFromAKeyword() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.detectNimbleSpecificMeaningFromAKeyword("fruit", "http://www.w3.org/2004/02/skos/core#prefLabel", Language.ENGLISH); - System.out.println(result); - } - - @Test - public void testdetectNimbleSpecificMeaningFromAKeyword_MDFBOARD() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.detectNimbleSpecificMeaningFromAKeyword("MDF laminated", "http://www.w3.org/2004/02/skos/core#prefLabel", Language.ENGLISH); - System.out.println(result); - } - - @Ignore - @Test - public void testdetectNimbleSpecificMeaningFromAKeywordRefrringInstance() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.detectNimbleSpecificMeaningFromAKeywordReferringToInstances("MDF laminated", "http://www.w3.org/2004/02/skos/core#prefLabel", Language.ENGLISH,false); - System.out.println(result); - } - - @Ignore - @Test - public void testgetAllDifferentValuesForAProperty_Dimension() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.getAllDifferentValuesForAProperty( - "http://www.nimble-project.org/resource/eclass/22292803", - "custom_dimension", PropertySource.DIMENSION); - System.out.println(result); - } - @Ignore - @Test - public void testgetAllDifferentValuesForAProperty_Custom() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.getAllDifferentValuesForAProperty( - "http://www.nimble-project.org/resource/eclass/22292803", - "custom_prop", PropertySource.CUSTOM_STRING); - System.out.println(result); - } - - @Ignore - @Test - public void testgetAllDifferentValuesForAProperty_Custom_DECIMAL() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.getAllDifferentValuesForAProperty( - "http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish", - - "drying time", PropertySource.CUSTOM_DECIMAL); - System.out.println(result); - } - @Ignore - @Test - public void testgetAllDifferentValuesForAProperty_MANUFACTURERPARTY() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.getAllDifferentValuesForAProperty( - "http://www.nimble-project.org/resource/eclass/22292803", - "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#ManufacturerParty", PropertySource.DIRECT_PROPERTIES); - - System.out.println(result); - } - @Ignore - @Test - public void testgetAllDifferentValuesForAProperty_MANUFACTURERPARTYIDENTIFICATION() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.getAllDifferentValuesForAProperty( - "http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish", - "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#ManufacturersItemIdentification", PropertySource.DIRECT_PROPERTIES); - System.out.println(result); - } - - - @Ignore - @Test - public void testgetAllDifferentValuesForAProperty_Description() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.getAllDifferentValuesForAProperty( - "http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish", - "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2#Description", PropertySource.DIRECT_PROPERTIES); - System.out.println(result); - } - - - - @Test - public void testgetAdditionalPropertiesWhichAreDerivedFromAbox() { - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - List result = deriviation.getAdditionalPropertiesWhichAreDerivedFromAbox( - "http://www.nimble-project.org/resource/eclass/22292803"); - System.out.println(result); - } - - - - - @Test - public void testgetAllAvailableCustomPropertiesWhichAreDerivedFromAbox (){ - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - - List result = deriviation.getAllAvailableCustomPropertiesWhichAreDerivedFromAbox("http://www.nimble-project.org/resource/eclass/22292803"); - System.out.println(result); - - } - - - @Test - public void testgetAllAvailableDimensionsPropertiesWhichAreDerivedFromAbox (){ - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - - List result = deriviation.getAllAvailableDimensionsWhichAreDerivedFromAbox("http://www.nimble-project.org/resource/eclass/22292803"); - System.out.println(result); - - } - - @Ignore - @Test - public void testgetAllAvailableEClassOrDomainProperties(){ - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - - List result = deriviation.getAllAvailableEClassOrDomainPropertiesFromAbox("http://www.nimble-project.org/resource/eclass/22292803"); - - System.out.println(result); - } - @Ignore - @Test - public void testgetAllPropertiesIncludingEverything(){ - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - OutputForPropertiesFromConcept result = deriviation.getAllPropertiesIncludingEverything("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - System.out.println(result.getOutputForPropertiesFromConcept()); - } - - @Ignore - @Test - public void testgetAllPropertiesIncludingEverythingEClass(){ - MarmottaReader reader = new MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - MediatorSPARQLDerivationAndExecution mediatorSPARQLDerivationAndExecution = null; - SQPDerivationService sqpDerivationService = new SQPDerivationService(mediatorSPARQLDerivationAndExecution, - "./src/main/resources/sqpConfiguration.xml"); - mediatorSPARQLDerivationAndExecution = new MediatorSPARQLDerivationAndExecution( - "https://nimble-platform.salzburgresearch.at/marmotta", true, sqpDerivationService); - NimbleSpecificSPARQLDeriviationAndExecution deriviation = new NimbleSpecificSPARQLDeriviationAndExecution( - reader, sqpDerivationService, mediatorSPARQLDerivationAndExecution); - OutputForPropertiesFromConcept result = deriviation.getAllPropertiesIncludingEverything("http://www.nimble-project.org/resource/eclass/22292803"); - System.out.println(result.getOutputForPropertiesFromConcept()); - } - -} diff --git a/src/test/java/eu/nimble/service/catalog/search/impl/TestSOLRReader.java b/src/test/java/eu/nimble/service/catalog/search/impl/TestSOLRReader.java deleted file mode 100644 index f51d0d5..0000000 --- a/src/test/java/eu/nimble/service/catalog/search/impl/TestSOLRReader.java +++ /dev/null @@ -1,163 +0,0 @@ -package eu.nimble.service.catalog.search.impl; - -import java.util.List; -import java.util.Map; - -import org.junit.Ignore; -import org.junit.Test; - -import de.biba.triple.store.access.enums.Language; -import de.biba.triple.store.access.enums.PropertyType; -import eu.nimble.service.catalog.search.impl.SOLRAccess.SOLRReader; -import eu.nimble.service.catalog.search.impl.dao.Filter; -import eu.nimble.service.catalog.search.impl.dao.Group; -import eu.nimble.service.catalog.search.impl.dao.enums.PropertySource; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteOptionalSelect; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteSelect; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForExecuteSelect; - -public class TestSOLRReader { - - @Test - @Ignore - public void testgetConnection() { - SOLRReader solrReader = new SOLRReader(); - Object response = solrReader.query("*.*"); - System.out.println(solrReader.createResultList(response, "item_manufacturer_name")); - // :*&rows=0&wt=csv - - } - - @Test - @Ignore - public void testgetConcepts() { - SOLRReader solrReader = new SOLRReader(); - List concepts = solrReader.getAllConcepts("PieceOfFurniture"); - System.out.println(concepts); - } - - // getPropertyType - @Test - @Ignore - public void testgetPropertyType() { - SOLRReader solrReader = new SOLRReader(); - PropertyType properType = solrReader - .getPropertyType("http://www.aidimme.es/FurnitureSectorOntology.owl#hasCatalogue"); - System.out.println(properType); - } - - // getAllPropertiesIncludingEverything - @Test - @Ignore - public void testgetgetAllPropertiesIncludingEverything() { - SOLRReader solrReader = new SOLRReader(); - List properType = solrReader - .getAllPropertiesIncludingEverything("http://www.aidimme.es/FurnitureSectorOntology.owl#Company"); - System.out.println(properType); - } - - @Test - @Ignore - public void testgetNativeSupportedLangauges() { - SOLRReader reader = new SOLRReader(); - List result = reader.getNativeSupportedLangauges(); - System.out.println(result); - } - - @Test - @Ignore - public void testtranslateProperty() { - SOLRReader reader = new SOLRReader(); - String label = reader.translateProperty("http://www.w3.org/ns/org#memberOf", Language.ENGLISH); - System.out.println(label); - - String label2 = reader.translateProperty("http://www.w3.org/ns/org#memberOf", Language.SPANISH); - System.out.println(label2); - } - - @Test - @Ignore - public void testgetAllValuesForAGivenProperty() { - SOLRReader reader = new SOLRReader( - "http://nimble-staging.salzburgresearch.at/marmotta/solr/catalogue_semantic_search/", "", ""); - List result = reader.getAllValuesForAGivenProperty( - "http://www.aidimme.es/FurnitureSectorOntology.owl#MDFBoard", "item_price", - PropertySource.ADDITIONAL_ITEM_PROPERTY); - } - - @Test - @Ignore - public void testcreateSPARQLAndExecuteIT() { - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept("*"); - inputParamaterForExecuteSelect.setLanguage("en"); - inputParamaterForExecuteSelect.getParametersURL().add("item_name"); - inputParamaterForExecuteSelect.getParametersURL().add("item_price"); - - SOLRReader reader = new SOLRReader(); - OutputForExecuteSelect executeSelect = reader.createSPARQLAndExecuteIT(inputParamaterForExecuteSelect); - System.out.println(executeSelect); - } - - @Test - @Ignore - public void testcreateSPARQLAndExecuteITMinValue() { - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept("*"); - inputParamaterForExecuteSelect.setLanguage("en"); - inputParamaterForExecuteSelect.getParametersURL().add("item_name"); - inputParamaterForExecuteSelect.getParametersURL().add("item_price"); - - Filter filter = new Filter(); - filter.setMin(100); - filter.setProperty("item_price"); - inputParamaterForExecuteSelect.getFilters().add(filter); - - SOLRReader reader = new SOLRReader(); - OutputForExecuteSelect executeSelect = reader.createSPARQLAndExecuteIT(inputParamaterForExecuteSelect); - System.out.println(executeSelect); - } - - @Test - @Ignore - public void testcreateOPtionalSPARQLAndExecuteIT() { - InputParamaterForExecuteOptionalSelect inputParamaterForExecuteOptionalSelect = new InputParamaterForExecuteOptionalSelect(); - inputParamaterForExecuteOptionalSelect.setLanguage("en"); - inputParamaterForExecuteOptionalSelect.setUuid( - "urn:oasis:names:specification:ubl:schema:xsd:Catalogue-2#INS776a79b6-5e86-4ebd-9b71-eaca8e92a257_CatalogueLineType_12"); - SOLRReader reader = new SOLRReader(); - OutputForExecuteSelect executeSelect = reader - .createOPtionalSPARQLAndExecuteIT(inputParamaterForExecuteOptionalSelect); - System.out.println(executeSelect); - } - - @Test - @Ignore - public void testgetRangeOfProperty(){ - SOLRReader reader = new SOLRReader(); - List ranges = reader.getRangeOfProperty("http://www.aidimme.es/FurnitureSectorOntology.owl#hasStyle"); - System.out.println(ranges); - - } - - @Test - @Ignore - public void testgenerateGroup(){ - SOLRReader reader = new SOLRReader(); - Map> result = reader.generateGroup(2,"http://www.aidimme.es/FurnitureSectorOntology.owl#PieceOfFurniture", "item_price"); - System.out.println(result); - } - - @Test - @Ignore - public void testgetAllObjectPropertiesIncludingEverythingAndReturnItsRange(){ - SOLRReader reader = new SOLRReader(); - String conceptURL = ("http://www.aidimme.es/FurnitureSectorOntology.owl#PieceOfFurniture"); - List obs = (reader.getAllObjectPropertiesIncludingEverythingAndReturnItsRange(conceptURL )); - for (String[] o: obs){ - System.out.println(o[0] +"->" + o[1]); - } - - } - -} diff --git a/src/test/java/eu/nimble/service/catalog/search/impl/TestSearchController.java b/src/test/java/eu/nimble/service/catalog/search/impl/TestSearchController.java deleted file mode 100644 index 11143e6..0000000 --- a/src/test/java/eu/nimble/service/catalog/search/impl/TestSearchController.java +++ /dev/null @@ -1,815 +0,0 @@ -package eu.nimble.service.catalog.search.impl; - -import static org.junit.Assert.*; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.List; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.mockito.Mock; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; - -import com.google.gson.Gson; - -import de.biba.triple.store.access.dmo.Entity; -import de.biba.triple.store.access.enums.Language; -import de.biba.triple.store.access.marmotta.MarmottaReader; -import eu.nimble.service.catalog.search.impl.SOLRAccess.SOLRReader; -import eu.nimble.service.catalog.search.impl.dao.Filter; -import eu.nimble.service.catalog.search.impl.dao.HybridConfiguration; -import eu.nimble.service.catalog.search.impl.dao.enums.PropertySource; -import eu.nimble.service.catalog.search.impl.dao.enums.TypeOfDataSource; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteOptionalSelect; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamaterForExecuteSelect; -import eu.nimble.service.catalog.search.impl.dao.input.InputParameterForPropertyValuesFromGreenGroup; -import eu.nimble.service.catalog.search.impl.dao.input.InputParameterdetectMeaningLanguageSpecific; -import eu.nimble.service.catalog.search.impl.dao.input.InputParamterForGetLogicalView; -import eu.nimble.service.catalog.search.impl.dao.input.Parameter; -import eu.nimble.service.catalog.search.impl.dao.input.Tuple; -import eu.nimble.service.catalog.search.impl.dao.output.OutputForExecuteSelect; - -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.any; - -public class TestSearchController { - - private static final String SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML = "./src/main/resources/sqpConfiguration.xml"; - - SearchController serachController; - - @Mock - SOLRReader readerMock; - - private static final String C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL = "C:/ontology/FurnitureSectorTaxonomy-v1.8_BIBA.owl"; - - // @Ignore - // @Before - // public void setUp() { - // serachController = new SearchController(); - // serachController.setOntologyFile(C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - // serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - // serachController.init(); - // - // } - - @Ignore - @Test - public void testgetPropertyValuesFromOrangeGroup() { - serachController = new SearchController(); - serachController.setOntologyFile(C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.init(); - String inputAsJson = "{\"conceptURL\":\"http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair\",\"orangeCommand\":\"companyName\"}"; - System.out.println(URLEncoder.encode(inputAsJson)); - HttpEntity result = serachController.getPropertyValuesFromOrangeGroup(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - } - - @Ignore - @Test - public void testgetSQP() { - String inputAsJson = "{\"concept\":\"http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair\",\"stepRange\":1,\"language\":\"en\",\"frozenConcept\":\"HighChair\",\"distanceToFrozenConcept\":0,\"conceptURIPath\":[],\"currenSelections\":[]}"; - System.out.println(URLEncoder.encode(inputAsJson)); - - HttpEntity result = serachController.getSQP(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - } - - @Test - public void testgetLogicalView_Marmotta() { - - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - InputParamterForGetLogicalView inputParamterForGetLogicalView = new InputParamterForGetLogicalView(); - inputParamterForGetLogicalView.setConcept("http://www.nimble-project.org/resource/eclass/22292803"); - inputParamterForGetLogicalView.setStepRange(1); - inputParamterForGetLogicalView.setLanguage("en"); - - HttpEntity result = serachController.getLogicalView(inputParamterForGetLogicalView); - String r = result.getBody().toString(); - System.out.println(r); - - } - - @Test - public void testgetLogicalView_Marmotta2() { - - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("http://nimble-staging.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - InputParamterForGetLogicalView inputParamterForGetLogicalView = new InputParamterForGetLogicalView(); - inputParamterForGetLogicalView.setConcept("http://www.nimble-project.org/resource/eclass/29160508"); - inputParamterForGetLogicalView.setStepRange(1); - inputParamterForGetLogicalView.setLanguage("en"); - - HttpEntity result = serachController.getLogicalView(inputParamterForGetLogicalView); - String r = result.getBody().toString(); - System.out.println(r); - - } - - - @Test - public void testgetPropertyFromConcept() { - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - InputParamterForGetLogicalView inputParamterForGetLogicalView = new InputParamterForGetLogicalView(); - inputParamterForGetLogicalView.setConcept("http://www.nimble-project.org/resource/eclass/22292803"); - inputParamterForGetLogicalView.setStepRange(1); - inputParamterForGetLogicalView.setLanguage("en"); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamterForGetLogicalView); - HttpEntity result = serachController.getPropertyFromConcept(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - - } - - @Test - public void testgetPropertyFromConceptII() { - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - InputParamterForGetLogicalView inputParamterForGetLogicalView = new InputParamterForGetLogicalView(); - inputParamterForGetLogicalView.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - inputParamterForGetLogicalView.setStepRange(1); - inputParamterForGetLogicalView.setLanguage("en"); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamterForGetLogicalView); - HttpEntity result = serachController.getPropertyFromConcept(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - - } - - @Ignore - @Test - public void testgetPropertyValuesFromGreenGroup_BUG_NIMBLE93() { - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - InputParameterForPropertyValuesFromGreenGroup inputParameterForPropertyValuesFromGreenGroup = new InputParameterForPropertyValuesFromGreenGroup(); - inputParameterForPropertyValuesFromGreenGroup.setConceptURL("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - inputParameterForPropertyValuesFromGreenGroup.setPropertySource(PropertySource.CUSTOM_DECIMAL); - inputParameterForPropertyValuesFromGreenGroup.setPropertyURL("dryingTime"); - - Gson gson = new Gson(); - - String inputAsJson = gson.toJson(inputParameterForPropertyValuesFromGreenGroup); - System.out.println(inputAsJson); - HttpEntity result = serachController.getPropertyValuesFromGreenGroup(inputAsJson); - - String r = result.getBody().toString(); - System.out.println(r); - - assertTrue(r.contains("20")); - - } - @Ignore - @Test - public void testgetPropertyValuesFromGreenGroup_BUG_DomainSpecificProperties() { - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - InputParameterForPropertyValuesFromGreenGroup inputParameterForPropertyValuesFromGreenGroup = new InputParameterForPropertyValuesFromGreenGroup(); - inputParameterForPropertyValuesFromGreenGroup.setConceptURL("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - inputParameterForPropertyValuesFromGreenGroup.setPropertySource(PropertySource.DOMAIN_SPECIFIC_PROPERTY); - inputParameterForPropertyValuesFromGreenGroup.setPropertyURL("http://www.aidimme.es/FurnitureSectorOntology.owl#hasViscosity"); - - Gson gson = new Gson(); - - String inputAsJson = gson.toJson(inputParameterForPropertyValuesFromGreenGroup); - System.out.println(inputAsJson); - HttpEntity result = serachController.getPropertyValuesFromGreenGroup(inputAsJson); - - String r = result.getBody().toString(); - System.out.println(r); - - assertTrue(r.contains("20")); - - } - - - - - - - @Test - @Ignore - public void testExecuteSPARQLSelect_Bug_NIMBLE_81() { - - /** - * { "parametersIncludingPath": [ { "urlOfProperty": - * "http%3A%2F%2Fwww.aidimme.es%2FFurnitureSectorOntology.owl%23hasHeight", - * "path": [ { "concept": - * "http%3A%2F%2Fwww.aidimme.es%2FFurnitureSectorOntology.owl%23HighChair" - * } ] } ], "parameters": [ "tieneAltura" ], "parametersURL": [ - * "http%3A%2F%2Fwww.aidimme.es%2FFurnitureSectorOntology.owl%23hasHeight" - * ], "filters": [], "orangeCommandSelected": { "names": [] }, - * "concept": - * "http%3A%2F%2Fwww.aidimme.es%2FFurnitureSectorOntology.owl%23HighChair", - * "language": "es" } - */ - - serachController = new SearchController(); - serachController.setOntologyFile(C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.init(); - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair"); - inputParamaterForExecuteSelect.getParameters().add("tieneAltura"); - inputParamaterForExecuteSelect.setLanguage("es"); - inputParamaterForExecuteSelect.getParametersURL().add("http://www.aidimme.es/FurnitureSectorOntology.owl#hasHeight"); - - Tuple t1 = new Tuple(); - t1.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair"); - t1.setUrlOfProperty(null); - - Parameter parameter1 = new Parameter(); - parameter1.getPath().add(t1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamaterForExecuteSelect); - - HttpEntity result = serachController.executeSPARQLSelect(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - } - - @Test - @Ignore - public void testExecuteSPARQLSelectWithOrange() { - - - - serachController = new SearchController(); - serachController.setOntologyFile(C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.init(); - - String ontology = "C:/ontology/FurnitureSectorTaxonomy-v1.8_BIBA.owl"; - - String concept = "HighChair"; - String prop1 = "hasHeight"; - String prop2 = "hasWidth"; - String prop3 = "hasLegislationName"; - String prop4 = "companyName"; - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept(concept); - inputParamaterForExecuteSelect.getParameters().add(prop1); - inputParamaterForExecuteSelect.getParameters().add(prop2); - // inputParamaterForExecuteSelect.getParameters().add(prop3); - inputParamaterForExecuteSelect.getParameters().add(prop4); - inputParamaterForExecuteSelect.setLanguage("en"); - - Parameter parameter1 = new Parameter(); - Parameter parameter2 = new Parameter(); - Parameter parameter3 = new Parameter(); - Parameter parameter4 = new Parameter(); - Tuple t1 = new Tuple(); - t1.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair"); - t1.setUrlOfProperty(null); - - parameter1.getPath().add(t1); - parameter2.getPath().add(t1); - // parameter3.getPath().add(t1); - - Tuple t2 = new Tuple(); - t2.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Manufacturer"); - t2.setUrlOfProperty("http://www.aidimme.es/FurnitureSectorOntology.owl#isManufacturedBy"); - - Tuple t3 = new Tuple(); - t3.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"); - t3.setUrlOfProperty( - "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#compliesWithLegislation"); - - parameter3.getPath().add(t2); - parameter3.getPath().add(t3); - - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter2); - // inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter3); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter4); - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamaterForExecuteSelect); - - HttpEntity result = serachController.executeSPARQLSelect(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - - } - - @Test - @Ignore - public void testExecuteSPARQLSelectWithOrangeII() { - - - serachController = new SearchController(); - serachController.setOntologyFile(C_ONTOLOGY_FURNITURE_TAXONOMY_V1_4_BIBA_OWL); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.init(); - - String ontology = "C:/ontology/FurnitureSectorTaxonomy-v1.8_BIBA.owl"; - - String concept = "HighChair"; - String prop1 = "hasHeight"; - String prop2 = "hasWidth"; - String prop3 = "hasLegislationName"; - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept(concept); - inputParamaterForExecuteSelect.getParameters().add(prop1); - inputParamaterForExecuteSelect.getParameters().add(prop2); - // inputParamaterForExecuteSelect.getParameters().add(prop3); - - inputParamaterForExecuteSelect.setLanguage("en"); - - Parameter parameter1 = new Parameter(); - Parameter parameter2 = new Parameter(); - Parameter parameter3 = new Parameter(); - - Tuple t1 = new Tuple(); - t1.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair"); - t1.setUrlOfProperty(null); - - parameter1.getPath().add(t1); - parameter2.getPath().add(t1); - // parameter3.getPath().add(t1); - - Tuple t2 = new Tuple(); - t2.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Manufacturer"); - t2.setUrlOfProperty("http://www.aidimme.es/FurnitureSectorOntology.owl#isManufacturedBy"); - - Tuple t3 = new Tuple(); - t3.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"); - t3.setUrlOfProperty( - "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#compliesWithLegislation"); - - parameter3.getPath().add(t2); - parameter3.getPath().add(t3); - - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter2); - // inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter3); - - inputParamaterForExecuteSelect.getOrangeCommandSelected().getNames().add("companyName"); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamaterForExecuteSelect); - System.out.println(URLEncoder.encode(inputAsJson)); - - HttpEntity result = serachController.executeSPARQLSelect(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - - } - - @Ignore - @Test - public void testdetectMeaningLanguageSpecific() { - - InputParameterdetectMeaningLanguageSpecific input = new InputParameterdetectMeaningLanguageSpecific(); - input.setLanguage("en"); - input.setKeyword("Varnish"); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(input); - - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.init(); - HttpEntity result = serachController.detectMeaningLanguageSpecific(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - } - - @Ignore - @Test - public void testdetectMeaningLanguageSpecificII() { - - InputParameterdetectMeaningLanguageSpecific input = new InputParameterdetectMeaningLanguageSpecific(); - input.setLanguage("en"); - //input.setKeyword("Fruit"); - input.setKeyword("MDF laminated"); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(input); - - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - // MarmottaReader marmottaReader = new - // MarmottaReader("https://nimble-platform.salzburgresearch.at/marmotta"); - // marmottaReader.setModeToRemote(); - // List entities = - // marmottaReader.getAllConceptsLanguageSpecific("Fruit", - // Language.ENGLISH); - // System.out.println(entities); - - HttpEntity result = serachController.detectMeaningLanguageSpecific(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - } - - @Ignore - @Test - public void testExecuteSPARQLSelectAgainstEClass() { - - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - String concept = "http://www.nimble-project.org/resource/eclass/22292803"; - String prop1 = "name"; - String prop2 = "hasColour"; - String prop3 = "custom_dimensione"; - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept(concept); - inputParamaterForExecuteSelect.getParameters().add(prop1); - inputParamaterForExecuteSelect.getParameters().add(prop2); - // inputParamaterForExecuteSelect.getParameters().add(prop3); - - inputParamaterForExecuteSelect.getParametersURL() - .add("urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2#Name"); - inputParamaterForExecuteSelect.getParametersURL() - .add("http://www.aidimme.es/FurnitureSectorOntology.owl#hasColour"); - inputParamaterForExecuteSelect.getParametersURL().add("custom_dimensione"); - - inputParamaterForExecuteSelect.getPropertySources().add(PropertySource.DIRECT_PROPERTIES); - inputParamaterForExecuteSelect.getPropertySources().add(PropertySource.DOMAIN_SPECIFIC_PROPERTY); - - inputParamaterForExecuteSelect.setLanguage("en"); - - Parameter parameter1 = new Parameter(); - Parameter parameter2 = new Parameter(); - Parameter parameter3 = new Parameter(); - - // Tuple t1 = new Tuple(); - // t1.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#HighChair"); - // t1.setUrlOfProperty(null); - // - // parameter1.getPath().add(t1); - // parameter2.getPath().add(t1); - // // parameter3.getPath().add(t1); - // - // Tuple t2 = new Tuple(); - // t2.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Manufacturer"); - // t2.setUrlOfProperty("http://www.aidimme.es/FurnitureSectorOntology.owl#isManufacturedBy"); - // - // Tuple t3 = new Tuple(); - // t3.setConcept("http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#Legislation"); - // t3.setUrlOfProperty( - // "http://www.semanticweb.org/ontologies/2013/4/Ontology1367568797694.owl#compliesWithLegislation"); - // - // parameter3.getPath().add(t2); - // parameter3.getPath().add(t3); - - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter2); - // inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter3); - - // inputParamaterForExecuteSelect.getOrangeCommandSelected().getNames().add("companyName"); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamaterForExecuteSelect); - System.out.println(URLEncoder.encode(inputAsJson)); - - HttpEntity result = serachController.executeSPARQLSelect(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - } - @Ignore - @Test - public void testExecuteOptionalSPARQLSelectAgainstEClass() { - - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - String indi = "urn:oasis:names:specification:ubl:schema:xsd:Catalogue-2#INS2b1b4356-0457-4cf5-8f57-8663857b3c40_ItemType_1"; - InputParamaterForExecuteOptionalSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteOptionalSelect(); - inputParamaterForExecuteSelect.setLanguage("en"); - inputParamaterForExecuteSelect.setUuid(indi); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamaterForExecuteSelect); - System.out.println(URLEncoder.encode(inputAsJson)); - - HttpEntity result = serachController.executeSPARQLWithOptionalSelect(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - } - - @Test - @Ignore - public void testexecuteSPARQLWithOptionalSelect() { - String indi = "http://www.aidimme.es/FurnitureSectorOntology.owl#T950_Plus_Natural"; - - InputParamaterForExecuteOptionalSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteOptionalSelect(); - String translationLabel = "http://www.aidimme.es/FurnitureSectorOntology.owl#translation"; - // this.setLanguagelabel(translationLabel); - inputParamaterForExecuteSelect.setLanguage("en"); - inputParamaterForExecuteSelect.setUuid(indi); - inputParamaterForExecuteSelect.getOrangeCommandSelected().getNames().add("companyName"); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamaterForExecuteSelect); - System.out.println(URLEncoder.encode(inputAsJson)); - - HttpEntity result = serachController.executeSPARQLWithOptionalSelect(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - } - - @Test - public void testExecuteSparQLSeelct_Bug_NIMBLE_94(){ - //String inputAsJson = "{\"input\":{ \"concept\":\"http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish\", \"language\":\"en\", \"parameters\":[\"CatalogueDocumentReference\"], \"parametersURL\":[\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#CatalogueDocumentReference\"], \"parametersIncludingPath\":[ { \"urlOfProperty\":\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#CatalogueDocumentReference\", \"path\":[{\"concept\":\"http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish\"}]} } ],\"filters\":[],\"orangeCommandSelected\":{\"names\":[]}, \"propertySources\":[\"DIRECT_PROPERTIES\"]]}"; - - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - inputParamaterForExecuteSelect.getParameters().add("CatalogueDocumentReference"); - inputParamaterForExecuteSelect.setLanguage("en"); - inputParamaterForExecuteSelect.getParametersURL().add("urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#CatalogueDocumentReference"); - inputParamaterForExecuteSelect.getPropertySources().add(PropertySource.DIRECT_PROPERTIES); - Tuple t1 = new Tuple(); - t1.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - t1.setUrlOfProperty(null); - - Parameter parameter1 = new Parameter(); - parameter1.getPath().add(t1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamaterForExecuteSelect); - - - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - HttpEntity result = serachController.executeSPARQLSelect(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - - } - - @Test - public void testExecuteSparQLSeelct_Bug_NIMBLE_94_Filter(){ - //String inputAsJson = "{\"input\":{ \"concept\":\"http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish\", \"language\":\"en\", \"parameters\":[\"CatalogueDocumentReference\"], \"parametersURL\":[\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#CatalogueDocumentReference\"], \"parametersIncludingPath\":[ { \"urlOfProperty\":\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#CatalogueDocumentReference\", \"path\":[{\"concept\":\"http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish\"}]} } ],\"filters\":[],\"orangeCommandSelected\":{\"names\":[]}, \"propertySources\":[\"DIRECT_PROPERTIES\"]]}"; - - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - inputParamaterForExecuteSelect.getParameters().add("CatalogueDocumentReference"); - inputParamaterForExecuteSelect.setLanguage("en"); - inputParamaterForExecuteSelect.getParametersURL().add("urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#CatalogueDocumentReference"); - inputParamaterForExecuteSelect.getPropertySources().add(PropertySource.DIRECT_PROPERTIES); - Tuple t1 = new Tuple(); - t1.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - t1.setUrlOfProperty(null); - - Parameter parameter1 = new Parameter(); - parameter1.getPath().add(t1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - - Filter filter = new Filter(); - filter.setProperty("urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#CatalogueDocumentReference"); - filter.setExactValue("db46244e-8e43-48a6-b523-51b4da3a82f2"); - inputParamaterForExecuteSelect.getFilters().add(filter); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamaterForExecuteSelect); - - - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - HttpEntity result = serachController.executeSPARQLSelect(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - - } - - @Test - public void testExecuteSparQLSeelct_Bug_NIMBLE_94_Filter_DomainSpecific(){ - //String inputAsJson = "{\"input\":{ \"concept\":\"http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish\", \"language\":\"en\", \"parameters\":[\"CatalogueDocumentReference\"], \"parametersURL\":[\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#CatalogueDocumentReference\"], \"parametersIncludingPath\":[ { \"urlOfProperty\":\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2#CatalogueDocumentReference\", \"path\":[{\"concept\":\"http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish\"}]} } ],\"filters\":[],\"orangeCommandSelected\":{\"names\":[]}, \"propertySources\":[\"DIRECT_PROPERTIES\"]]}"; - - - InputParamaterForExecuteSelect inputParamaterForExecuteSelect = new InputParamaterForExecuteSelect(); - inputParamaterForExecuteSelect.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - inputParamaterForExecuteSelect.getParameters().add("hasViscosity"); - inputParamaterForExecuteSelect.setLanguage("en"); - inputParamaterForExecuteSelect.getParametersURL().add("http://www.aidimme.es/FurnitureSectorOntology.owl#hasViscosity"); - inputParamaterForExecuteSelect.getPropertySources().add(PropertySource.DOMAIN_SPECIFIC_PROPERTY); - Tuple t1 = new Tuple(); - t1.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Varnish"); - t1.setUrlOfProperty(null); - - Parameter parameter1 = new Parameter(); - parameter1.getPath().add(t1); - inputParamaterForExecuteSelect.getParametersIncludingPath().add(parameter1); - - Filter filter = new Filter(); - filter.setProperty("http://www.aidimme.es/FurnitureSectorOntology.owl#hasViscosity"); - filter.setExactValue("15"); - inputParamaterForExecuteSelect.getFilters().add(filter); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(inputParamaterForExecuteSelect); - - - SearchController serachController = new SearchController(); - serachController.setMarmottaUri("https://nimble-platform.salzburgresearch.at/marmotta"); - serachController.setOntologyFile("null"); - serachController.setSqpConfigurationPath(SRC_MAIN_RESOURCES_SQP_CONFIGURATION_XML); - serachController.setLanguageLabel("http://www.w3.org/2004/02/skos/core#prefLabel"); - serachController.init(); - - HttpEntity result = serachController.executeSPARQLSelect(inputAsJson); - String r = result.getBody().toString(); - System.out.println(r); - - } - - @Ignore - @Test - public void testgetInstantiatedPropertiesFromConceptForSOLR(){ - - //pre - SearchController serachController = new SearchController(); - serachController.setUseSOLRIndex(true); - serachController.init(); - - InputParamterForGetLogicalView inputParamterForGetLogicalView = new InputParamterForGetLogicalView(); - inputParamterForGetLogicalView.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#Seat"); - inputParamterForGetLogicalView.setLanguage("es"); - - Gson gson = new Gson(); - String input = gson.toJson(inputParamterForGetLogicalView); - System.out.println(URLEncoder.encode(input)); - HttpEntity result = serachController.getInstantiatedPropertiesFromConcept(input); - - - String r = result.getBody().toString(); - System.out.println(r); - - - } - - @Test - public void testgetLogicalViewForSOLR(){ - - //pre - InputParamterForGetLogicalView inputParamterForGetLogicalView = new InputParamterForGetLogicalView(); - inputParamterForGetLogicalView.setConcept("http://www.aidimme.es/FurnitureSectorOntology.owl#PieceOfFurniture"); - inputParamterForGetLogicalView.setLanguage("es"); - inputParamterForGetLogicalView.setStepRange(2); - - - SearchController serachController = new SearchController(); - serachController.setUseSOLRIndex(true); - serachController.init(); - - - - Gson gson = new Gson(); - String input = gson.toJson(inputParamterForGetLogicalView); - System.out.println(URLEncoder.encode(input)); - HttpEntity result = serachController.getLogicalView(inputParamterForGetLogicalView); - - - String r = result.getBody().toString(); - System.out.println(r); - - - - } - - - @Test - public void testHybridModus_DetectMeaningLanguageSpecific_SOL_NotInvoked(){ - - SearchController serachController = new SearchController(); - serachController.setUseSOLRIndex(true); - //serachController.init(); - - readerMock = mock(SOLRReader.class); - serachController.setSolrReader(readerMock); - - - - when(readerMock.getAllConceptsLanguageSpecific(anyString(), any(Language.class))).thenReturn( new ArrayList()); - - InputParameterdetectMeaningLanguageSpecific input = new InputParameterdetectMeaningLanguageSpecific(); - input.setLanguage("en"); - input.setKeyword("Varnish"); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(input); - - - HttpEntity result = serachController.detectMeaningLanguageSpecific(inputAsJson); - - - assertEquals(serachController.gethConfiguration().getDetectMeaningLanguageSpecific(), TypeOfDataSource.MARMOTTA); - verify(readerMock, times(0)).getAllConceptsLanguageSpecific(anyString(), any(Language.class)); - - } - - @Test - public void testHybridModus_DetectMeaningLanguageSpecific_SOL_Invoked(){ - - SearchController serachController = new SearchController(); - serachController.setUseSOLRIndex(true); - - readerMock = mock(SOLRReader.class); - serachController.setSolrReader(readerMock); - - serachController.gethConfiguration().setDetectMeaningLanguageSpecific("SOLR"); - - when(readerMock.getAllConceptsLanguageSpecific(anyString(), any(Language.class))).thenReturn( new ArrayList()); - - InputParameterdetectMeaningLanguageSpecific input = new InputParameterdetectMeaningLanguageSpecific(); - input.setLanguage("en"); - input.setKeyword("Varnish"); - - Gson gson = new Gson(); - String inputAsJson = gson.toJson(input); - - - HttpEntity result = serachController.detectMeaningLanguageSpecific(inputAsJson); - - - assertEquals(serachController.gethConfiguration().getDetectMeaningLanguageSpecific(), TypeOfDataSource.SOLR); - verify(readerMock, times(1)).getAllConceptsLanguageSpecific(anyString(), any(Language.class)); - - - - } - - - -} diff --git a/start-Debug-using_Marmotta.bat b/start-Debug-using_Marmotta.bat deleted file mode 100644 index 2199be9..0000000 --- a/start-Debug-using_Marmotta.bat +++ /dev/null @@ -1 +0,0 @@ -mvnDebug spring-boot:run -Dnimble.shared.property.marmottauri=http://nimble-staging.salzburgresearch.at/marmotta -Dnimble.shared.property.languagelabel=http://www.w3.org/2004/02/skos/core#prefLabel \ No newline at end of file diff --git a/startUsingOnlyIndexingService.bat b/startUsingOnlyIndexingService.bat new file mode 100644 index 0000000..1b9c7ec --- /dev/null +++ b/startUsingOnlyIndexingService.bat @@ -0,0 +1 @@ +mvnDebug spring-boot:run -Dnimble.shared.property.indexingserviceuri="http://nimble-dev.ikap.biba.uni-bremen.de:9101/" \ No newline at end of file diff --git a/startWithMarmotta.bat b/startWithMarmotta.bat deleted file mode 100644 index ae80ac2..0000000 --- a/startWithMarmotta.bat +++ /dev/null @@ -1 +0,0 @@ -mvn spring-boot:run -Dnimble.shared.property.marmottauri=http://nimble-staging.salzburgresearch.at/marmotta -Dnimble.shared.property.languagelabel=http://www.w3.org/2004/02/skos/core#prefLabel \ No newline at end of file diff --git a/start_Debug-using-SOLR-Marmotta-Hybrid.bat b/start_Debug-using-SOLR-Marmotta-Hybrid.bat deleted file mode 100644 index fb37761..0000000 --- a/start_Debug-using-SOLR-Marmotta-Hybrid.bat +++ /dev/null @@ -1 +0,0 @@ -mvnDebug spring-boot:run -Dnimble.shared.property.marmottauri=http://nimble-staging.salzburgresearch.at/marmotta -Dnimble.shared.property.languagelabel=http://www.w3.org/2004/02/skos/core#prefLabel -Dnimble.shared.property.useSOLRIndex=true -Dnimble.shared.property.hybridConfiguration=detectMeaningLanguageSpecific \ No newline at end of file