Search in sources :

Example 11 with UrisScheme

use of org.wikidata.query.rdf.common.uri.UrisScheme in project wikidata-query-rdf by wikimedia.

the class DefaultUrisSchemeUnitTest method conceptUriHttps.

@Test
public void conceptUriHttps() throws URISyntaxException {
    UrisScheme uris = new DefaultUrisScheme(new URI("https://acme2.test"), WIKIBASE_ENTITY_PREFIX, WIKIBASE_ENTITY_DATA_PREFIX, WIKIBASE_INITIALS);
    assertThat(uris.entityURIs()).contains("https://acme2.test/entity/");
    assertThat(uris.entityIdToURI("Q1")).isEqualTo("https://acme2.test/entity/Q1");
    assertThat(uris.entityIdToURI("P1")).isEqualTo("https://acme2.test/entity/P1");
    assertThat(uris.entityData()).isEqualTo("https://acme2.test/wiki/Special:EntityData/");
    assertThat(uris.entityDataHttps()).isEqualTo("http://acme2.test/wiki/Special:EntityData/");
}
Also used : UrisScheme(org.wikidata.query.rdf.common.uri.UrisScheme) DefaultUrisScheme(org.wikidata.query.rdf.common.uri.DefaultUrisScheme) DefaultUrisScheme(org.wikidata.query.rdf.common.uri.DefaultUrisScheme) URI(java.net.URI) Test(org.junit.Test)

Example 12 with UrisScheme

use of org.wikidata.query.rdf.common.uri.UrisScheme in project wikidata-query-rdf by wikimedia.

the class DefaultUrisSchemeUnitTest method initialsOrder.

@Test
public void initialsOrder() throws URISyntaxException {
    UrisScheme uris = new DefaultUrisScheme(new URI("https://acme2.test"), WIKIBASE_ENTITY_PREFIX, WIKIBASE_ENTITY_DATA_PREFIX, WIKIBASE_INITIALS);
    // See https://phabricator.wikimedia.org/T230588 for reasons for this order
    assertThat(uris.inlinableEntityInitials()).containsExactly("P", "Q");
}
Also used : UrisScheme(org.wikidata.query.rdf.common.uri.UrisScheme) DefaultUrisScheme(org.wikidata.query.rdf.common.uri.DefaultUrisScheme) DefaultUrisScheme(org.wikidata.query.rdf.common.uri.DefaultUrisScheme) URI(java.net.URI) Test(org.junit.Test)

Example 13 with UrisScheme

use of org.wikidata.query.rdf.common.uri.UrisScheme in project wikidata-query-rdf by wikimedia.

the class DefaultUrisSchemeUnitTest method fromHost.

@Test
public void fromHost() {
    UrisScheme uris = UrisSchemeFactory.forWikidataHost("acme.test");
    assertThat(uris.entityURIs()).contains("http://acme.test/entity/");
    assertThat(uris.entityIdToURI("Q1")).isEqualTo("http://acme.test/entity/Q1");
    assertThat(uris.entityIdToURI("P1")).isEqualTo("http://acme.test/entity/P1");
    assertThat(uris.entityData()).isEqualTo("http://acme.test/wiki/Special:EntityData/");
    assertThat(uris.entityDataHttps()).isEqualTo("https://acme.test/wiki/Special:EntityData/");
}
Also used : UrisScheme(org.wikidata.query.rdf.common.uri.UrisScheme) DefaultUrisScheme(org.wikidata.query.rdf.common.uri.DefaultUrisScheme) Test(org.junit.Test)

Example 14 with UrisScheme

use of org.wikidata.query.rdf.common.uri.UrisScheme in project wikidata-query-rdf by wikimedia.

the class DefaultUrisSchemeUnitTest method defaultUris.

@Test
public void defaultUris() {
    UrisScheme uris = UrisSchemeFactory.getURISystem();
    assertThat(uris.entityURIs()).contains("http://www.wikidata.org/entity/");
    assertThat(uris.entityIdToURI("Q1")).isEqualTo("http://www.wikidata.org/entity/Q1");
    assertThat(uris.entityIdToURI("P1")).isEqualTo("http://www.wikidata.org/entity/P1");
    assertThat(uris.entityData()).isEqualTo("http://www.wikidata.org/wiki/Special:EntityData/");
    assertThat(uris.entityDataHttps()).isEqualTo("https://www.wikidata.org/wiki/Special:EntityData/");
}
Also used : UrisScheme(org.wikidata.query.rdf.common.uri.UrisScheme) DefaultUrisScheme(org.wikidata.query.rdf.common.uri.DefaultUrisScheme) Test(org.junit.Test)

Aggregations

UrisScheme (org.wikidata.query.rdf.common.uri.UrisScheme)14 Test (org.junit.Test)9 DefaultUrisScheme (org.wikidata.query.rdf.common.uri.DefaultUrisScheme)7 URI (java.net.URI)6 MetricRegistry (com.codahale.metrics.MetricRegistry)3 IOException (java.io.IOException)2 Duration (java.time.Duration)2 ExecutorService (java.util.concurrent.ExecutorService)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 HttpClient (org.eclipse.jetty.client.HttpClient)2 ContentResponse (org.eclipse.jetty.client.api.ContentResponse)2 RDFHandler (org.openrdf.rio.RDFHandler)2 HttpClientUtils.buildHttpClient (org.wikidata.query.rdf.tool.HttpClientUtils.buildHttpClient)2 Change (org.wikidata.query.rdf.tool.change.Change)2 Munger (org.wikidata.query.rdf.tool.rdf.Munger)2 RdfClient (org.wikidata.query.rdf.tool.rdf.client.RdfClient)2 FunctionRegistry (com.bigdata.rdf.sparql.ast.FunctionRegistry)1 RemoteServiceFactoryImpl (com.bigdata.rdf.sparql.ast.service.RemoteServiceFactoryImpl)1 ServiceRegistry (com.bigdata.rdf.sparql.ast.service.ServiceRegistry)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1