List of usage examples for org.apache.http.client.utils URIBuilder toString
@Override
public String toString()
From source file:org.instagram4j.DefaultInstagramClient.java
@Override public Result<Location[]> getLocationsNearby(double latitude, double longitude, Integer radiusKm, Parameter... params) throws InstagramException { URIBuilder uri = createUriBuilder("https://api.instagram.com/v1/locations/search", params); uri.addParameter("lat", String.format("%.5f", latitude)); uri.addParameter("lng", String.format("%.5f", longitude)); if (radiusKm != null && radiusKm > 0) uri.addParameter("distance", radiusKm.toString()); return queryEntities(uri.toString(), Location.class); }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testPopulateResourcesForSingleComponentMetric() throws Exception { setUpCommonMocks();//from w w w . j ava 2s .c o m TestStreamProvider streamProvider = new TestStreamProvider(SINGLE_COMPONENT_METRICS_FILE_PATH); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = PropertyHelper .getMetricPropertyIds(Resource.Type.Component); AMSPropertyProvider propertyProvider = new AMSComponentPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID); String propertyId = PropertyHelper.getPropertyId("metrics/rpc", "RpcQueueTime_avg_time"); Resource resource = new ResourceImpl(Resource.Type.Component); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(HOST_NAME_PROPERTY_ID, "h1"); resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "NAMENODE"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); temporalInfoMap.put(propertyId, new TemporalInfoImpl(1416528759233L, 1416531129231L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(propertyId), temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); URIBuilder uriBuilder = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder.addParameter("metricNames", "rpc.rpc.RpcQueueTimeAvgTime"); uriBuilder.addParameter("appId", "NAMENODE"); uriBuilder.addParameter("startTime", "1416528759233"); uriBuilder.addParameter("endTime", "1416531129231"); Assert.assertEquals(uriBuilder.toString(), streamProvider.getLastSpec()); Number[][] val = (Number[][]) res.getPropertyValue(propertyId); Assert.assertNotNull("No value for property " + propertyId, val); Assert.assertEquals(238, val.length); }
From source file:org.instagram4j.DefaultInstagramClient.java
@Override public Result<Media[]> getRecentMediaNearby(double latitude, double longitude, Integer radiusMeters, Parameter... params) throws InstagramException { URIBuilder uri = createUriBuilder("https://api.instagram.com/v1/media/search", params); uri.addParameter("lat", String.format("%.5f", latitude)); uri.addParameter("lng", String.format("%.5f", longitude)); if (radiusMeters != null && radiusMeters > 0) uri.addParameter("distance", radiusMeters.toString()); return queryEntities(uri.toString(), Media.class); }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testAggregateFunctionForComponentMetrics() throws Exception { AmbariManagementController ams = createNiceMock(AmbariManagementController.class); PowerMock.mockStatic(AmbariServer.class); expect(AmbariServer.getController()).andReturn(ams); AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class); Clusters clusters = createNiceMock(Clusters.class); Cluster cluster = createNiceMock(Cluster.class); ComponentInfo componentInfo = createNiceMock(ComponentInfo.class); StackId stackId = new StackId("HDP", "2.2"); expect(ams.getClusters()).andReturn(clusters).anyTimes(); try {//from ww w.java2s .c o m expect(clusters.getCluster(anyObject(String.class))).andReturn(cluster).anyTimes(); } catch (AmbariException e) { e.printStackTrace(); } expect(cluster.getCurrentStackVersion()).andReturn(stackId).anyTimes(); expect(ams.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes(); expect(ambariMetaInfo.getComponentToService("HDP", "2.2", "HBASE_REGIONSERVER")).andReturn("HBASE") .anyTimes(); expect(ambariMetaInfo.getComponent("HDP", "2.2", "HBASE", "HBASE_REGIONSERVER")).andReturn(componentInfo) .anyTimes(); expect(componentInfo.getTimelineAppid()).andReturn("HBASE"); replay(ams, clusters, cluster, ambariMetaInfo, componentInfo); PowerMock.replayAll(); TestStreamProvider streamProvider = new TestStreamProvider(AGGREGATE_METRICS_FILE_PATH); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = PropertyHelper .getMetricPropertyIds(Resource.Type.Component); PropertyHelper.updateMetricsWithAggregateFunctionSupport(propertyIds); AMSComponentPropertyProvider propertyProvider = new AMSComponentPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID); String propertyId = PropertyHelper.getPropertyId("metrics/rpc", "NumOpenConnections._sum"); Resource resource = new ResourceImpl(Resource.Type.Component); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "HBASE_REGIONSERVER"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); temporalInfoMap.put(propertyId, new TemporalInfoImpl(1429824611300L, 1429825241400L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(propertyId), temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); URIBuilder uriBuilder = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder.addParameter("metricNames", "rpc.rpc.NumOpenConnections._sum"); uriBuilder.addParameter("appId", "HBASE"); uriBuilder.addParameter("startTime", "1429824611300"); uriBuilder.addParameter("endTime", "1429825241400"); Assert.assertEquals(uriBuilder.toString(), streamProvider.getLastSpec()); Number[][] val = (Number[][]) res.getPropertyValue(propertyId); Assert.assertEquals(32, val.length); }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testPopulateResourcesForSingleHostMetric() throws Exception { setUpCommonMocks();//ww w. jav a2s.c o m TestStreamProvider streamProvider = new TestStreamProvider(SINGLE_HOST_METRICS_FILE_PATH); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = PropertyHelper .getMetricPropertyIds(Resource.Type.Host); AMSPropertyProvider propertyProvider = new AMSHostPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, HOST_NAME_PROPERTY_ID); Resource resource = new ResourceImpl(Resource.Type.Host); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(HOST_NAME_PROPERTY_ID, "h1"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); temporalInfoMap.put(PROPERTY_ID1, new TemporalInfoImpl(1416445244800L, 1416448936474L, 15L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(PROPERTY_ID1), temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); URIBuilder uriBuilder = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder.addParameter("metricNames", "cpu_user"); uriBuilder.addParameter("hostname", "h1"); uriBuilder.addParameter("appId", "HOST"); uriBuilder.addParameter("startTime", "1416445244800"); uriBuilder.addParameter("endTime", "1416448936474"); Assert.assertEquals(uriBuilder.toString(), streamProvider.getLastSpec()); Number[][] val = (Number[][]) res.getPropertyValue(PROPERTY_ID1); Assert.assertNotNull("No value for property " + PROPERTY_ID1, val); Assert.assertEquals(111, val.length); }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testPopulateMetricsForEmbeddedHBase() throws Exception { AmbariManagementController ams = createNiceMock(AmbariManagementController.class); PowerMock.mockStatic(AmbariServer.class); expect(AmbariServer.getController()).andReturn(ams); AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class); Clusters clusters = createNiceMock(Clusters.class); Cluster cluster = createNiceMock(Cluster.class); ComponentInfo componentInfo = createNiceMock(ComponentInfo.class); StackId stackId = new StackId("HDP", "2.2"); expect(ams.getClusters()).andReturn(clusters).anyTimes(); try {/*from w w w. j av a2 s . c o m*/ expect(clusters.getCluster(anyObject(String.class))).andReturn(cluster).anyTimes(); } catch (AmbariException e) { e.printStackTrace(); } expect(cluster.getCurrentStackVersion()).andReturn(stackId).anyTimes(); expect(ams.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes(); expect(ambariMetaInfo.getComponentToService("HDP", "2.2", "METRICS_COLLECTOR")).andReturn("AMS").anyTimes(); expect(ambariMetaInfo.getComponent("HDP", "2.2", "AMS", "METRICS_COLLECTOR")).andReturn(componentInfo) .anyTimes(); expect(componentInfo.getTimelineAppid()).andReturn("AMS-HBASE"); replay(ams, clusters, cluster, ambariMetaInfo, componentInfo); PowerMock.replayAll(); TestStreamProvider streamProvider = new TestStreamProvider(EMBEDDED_METRICS_FILE_PATH); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = PropertyHelper .getMetricPropertyIds(Resource.Type.Component); AMSPropertyProvider propertyProvider = new AMSComponentPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID); String propertyId = PropertyHelper.getPropertyId("metrics/hbase/regionserver", "requests"); Resource resource = new ResourceImpl(Resource.Type.Component); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(HOST_NAME_PROPERTY_ID, "h1"); resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "METRICS_COLLECTOR"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); temporalInfoMap.put(propertyId, new TemporalInfoImpl(1421694000L, 1421697600L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(propertyId), temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); URIBuilder uriBuilder = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder.addParameter("metricNames", "regionserver.Server.totalRequestCount"); uriBuilder.addParameter("appId", "AMS-HBASE"); uriBuilder.addParameter("startTime", "1421694000"); uriBuilder.addParameter("endTime", "1421697600"); Assert.assertEquals(uriBuilder.toString(), streamProvider.getLastSpec()); Number[][] val = (Number[][]) res.getPropertyValue(propertyId); Assert.assertEquals(189, val.length); }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testPopulateResourcesForRegexpMetrics() throws Exception { setUpCommonMocks();//from w w w. j av a 2 s.c om TestStreamProvider streamProvider = new TestStreamProvider(MULTIPLE_COMPONENT_REGEXP_METRICS_FILE_PATH); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = new HashMap<String, Map<String, PropertyInfo>>() { { put("RESOURCEMANAGER", new HashMap<String, PropertyInfo>() { { put("metrics/yarn/Queue/$1.replaceAll(\"([.])\",\"/\")/AvailableMB", new PropertyInfo("yarn.QueueMetrics.Queue=(.+).AvailableMB", true, false)); } }); } }; AMSPropertyProvider propertyProvider = new AMSComponentPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID); String propertyId1 = "metrics/yarn/Queue/root/AvailableMB"; Resource resource = new ResourceImpl(Resource.Type.Component); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(HOST_NAME_PROPERTY_ID, "h1");// should be set? resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); temporalInfoMap.put(propertyId1, new TemporalInfoImpl(1416528759233L, 1416531129231L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(propertyId1), temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); URIBuilder uriBuilder = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder.addParameter("metricNames", "yarn.QueueMetrics.Queue=root.AvailableMB"); uriBuilder.addParameter("appId", "RESOURCEMANAGER"); uriBuilder.addParameter("startTime", "1416528759233"); uriBuilder.addParameter("endTime", "1416531129231"); Assert.assertEquals(uriBuilder.toString(), streamProvider.getLastSpec()); Number[][] val = (Number[][]) res.getPropertyValue("metrics/yarn/Queue/root/AvailableMB"); Assert.assertNotNull("No value for property metrics/yarn/Queue/root/AvailableMB", val); Assert.assertEquals(238, val.length); }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testFilterOutOfBandMetricData() throws Exception { setUpCommonMocks();// w w w . ja va2s. co m TestStreamProvider streamProvider = new TestStreamProvider(SINGLE_HOST_METRICS_FILE_PATH); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = PropertyHelper .getMetricPropertyIds(Resource.Type.Host); AMSPropertyProvider propertyProvider = new AMSHostPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, HOST_NAME_PROPERTY_ID); Resource resource = new ResourceImpl(Resource.Type.Host); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(HOST_NAME_PROPERTY_ID, "h1"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); // Chopped a section in the middle temporalInfoMap.put(PROPERTY_ID1, new TemporalInfoImpl(1416446744801L, 1416447224801L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(PROPERTY_ID1), temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); URIBuilder uriBuilder = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder.addParameter("metricNames", "cpu_user"); uriBuilder.addParameter("hostname", "h1"); uriBuilder.addParameter("appId", "HOST"); uriBuilder.addParameter("startTime", "1416446744801"); uriBuilder.addParameter("endTime", "1416447224801"); Assert.assertEquals(uriBuilder.toString(), streamProvider.getLastSpec()); Number[][] val = (Number[][]) res.getPropertyValue(PROPERTY_ID1); Assert.assertNotNull("No value for property " + PROPERTY_ID1, val); // 4 entries fit into the default allowance limit Assert.assertEquals(25, val.length); }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testPopulateResourcesForHostComponentHostMetrics() throws Exception { setUpCommonMocks();// w w w . j a v a2 s .c o m TestStreamProviderForHostComponentHostMetricsTest streamProvider = new TestStreamProviderForHostComponentHostMetricsTest( null); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = PropertyHelper .getMetricPropertyIds(Resource.Type.HostComponent); AMSPropertyProvider propertyProvider = new AMSHostComponentPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, HOST_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID); Resource resource = new ResourceImpl(Resource.Type.Host); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(HOST_NAME_PROPERTY_ID, "h1"); resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "DATANODE"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); // Set same time ranges to make sure the query comes in as grouped and // then turns into a separate query to the backend temporalInfoMap.put(PROPERTY_ID1, new TemporalInfoImpl(1416445244801L, 1416448936464L, 1L)); temporalInfoMap.put(PROPERTY_ID3, new TemporalInfoImpl(1416445244801L, 1416448936464L, 1L)); Request request = PropertyHelper.getReadRequest(new HashSet<String>() { { add(PROPERTY_ID1); add(PROPERTY_ID3); add("params/padding/NONE"); // Ignore padding to match result size } }, temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); Set<String> specs = streamProvider.getAllSpecs(); Assert.assertEquals(2, specs.size()); String hostMetricSpec = null; String hostComponentMetricsSpec = null; for (String spec : specs) { if (spec.contains("HOST")) { hostMetricSpec = spec; } else { hostComponentMetricsSpec = spec; } } Assert.assertNotNull(hostMetricSpec); Assert.assertNotNull(hostComponentMetricsSpec); // Verify calls URIBuilder uriBuilder1 = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder1.addParameter("metricNames", "dfs.datanode.BlocksReplicated"); uriBuilder1.addParameter("hostname", "h1"); uriBuilder1.addParameter("appId", "DATANODE"); uriBuilder1.addParameter("startTime", "1416445244801"); uriBuilder1.addParameter("endTime", "1416448936464"); Assert.assertEquals(uriBuilder1.toString(), hostComponentMetricsSpec); URIBuilder uriBuilder2 = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder2.addParameter("metricNames", "cpu_user"); uriBuilder2.addParameter("hostname", "h1"); uriBuilder2.addParameter("appId", "HOST"); uriBuilder2.addParameter("startTime", "1416445244801"); uriBuilder2.addParameter("endTime", "1416448936464"); Assert.assertEquals(uriBuilder2.toString(), hostMetricSpec); Number[][] val = (Number[][]) res.getPropertyValue(PROPERTY_ID1); Assert.assertEquals(111, val.length); val = (Number[][]) res.getPropertyValue(PROPERTY_ID3); Assert.assertNotNull("No value for property " + PROPERTY_ID3, val); Assert.assertEquals(8, val.length); }
From source file:org.wikidata.wdtk.rdf.WikidataPropertyTypes.java
/** * Find the datatype of a property online. * * @param propertyIdValue//from ww w. jav a 2 s. co m * @return IRI of the datatype * @throws IOException * @throws URISyntaxException * , IOException */ String fetchPropertyType(PropertyIdValue propertyIdValue) throws IOException, URISyntaxException { logger.info("Fetching datatype of property " + propertyIdValue.getId() + " online."); URIBuilder uriBuilder; uriBuilder = new URIBuilder(this.webAPIUrl); uriBuilder.setParameter("action", "wbgetentities"); uriBuilder.setParameter("ids", propertyIdValue.getId()); uriBuilder.setParameter("format", "json"); uriBuilder.setParameter("props", "datatype"); InputStream inStream = this.webResourceFetcher.getInputStreamForUrl(uriBuilder.toString()); JsonNode jsonNode = this.objectMapper.readTree(inStream); String datatype = jsonNode.path("entities").path(propertyIdValue.getId()).path("datatype").asText(); if (datatype == null || "".equals(datatype)) { logger.error("Could not find datatype of property " + propertyIdValue.getId() + " online."); return null; } switch (datatype) { case "wikibase-item": return DatatypeIdValue.DT_ITEM; case "wikibase-property": return DatatypeIdValue.DT_PROPERTY; case "string": return DatatypeIdValue.DT_STRING; case "quantity": return DatatypeIdValue.DT_QUANTITY; case "url": return DatatypeIdValue.DT_URL; case "globe-coordinate": return DatatypeIdValue.DT_GLOBE_COORDINATES; case "time": return DatatypeIdValue.DT_TIME; case "commonsMedia": return DatatypeIdValue.DT_COMMONS_MEDIA; case "monolingualtext": return DatatypeIdValue.DT_MONOLINGUAL_TEXT; default: logger.error("Got unkown datatype " + datatype); return null; } }