use of com.bigdata.rdf.model.BigdataURI in project wikidata-query-rdf by wikimedia.
the class IsSomeValueUnitTest method testReturnFalseOnConcreteValue.
@Test
public void testReturnFalseOnConcreteValue() throws QueryEvaluationException {
switchToBlank();
BigdataURI uri = store().getValueFactory().createURI("http://unittest.local/testReturnFalseOnConcreteValue");
add(uri, uri, uri);
add(uri, uri, store().getValueFactory().createLiteral("foo"));
TupleQueryResult tqr = query("select ?s where { ?s <" + uri + "> ?o FILTER wikibase:isSomeValue(?o) }");
assertThat(tqr.hasNext()).isFalse();
}
use of com.bigdata.rdf.model.BigdataURI in project wikidata-query-rdf by wikimedia.
the class IsSomeValueUnitTest method testReturnTrueOnBNode.
@Test
public void testReturnTrueOnBNode() throws QueryEvaluationException {
switchToBlank();
BigdataURI uri = store().getValueFactory().createURI("http://unittest.local/testReturnTrueOnBNode");
add(uri, uri, store().getValueFactory().createBNode());
TupleQueryResult tqr = query("select ?s where { ?s <" + uri + "> ?o FILTER wikibase:isSomeValue(?o) }");
assertThat(tqr.hasNext()).isTrue();
BindingSet result = tqr.next();
assertThat(result).matches((e) -> binds("s", uri).matches(e));
}
use of com.bigdata.rdf.model.BigdataURI in project wikidata-query-rdf by wikimedia.
the class IsSomeValueUnitTest method testReturnTrueOnSkolemPrefix.
@Test
public void testReturnTrueOnSkolemPrefix() throws QueryEvaluationException {
switchToSkolem();
BigdataURI uri = store().getValueFactory().createURI("http://unittest.local/testReturnTrueOnSkolemPrefix");
BigdataURI skolem = store().getValueFactory().createURI(scheme.wellKnownBNodeIRIPrefix(), "91212dc3fcc8b65607d27f92b36e5761");
add(uri, uri, skolem);
TupleQueryResult tqr = query("select ?s where { ?s <" + uri + "> ?o FILTER wikibase:isSomeValue(?o) }");
assertThat(tqr.hasNext()).isTrue();
BindingSet result = tqr.next();
assertThat(result).matches((e) -> binds("s", uri).matches(e));
}
use of com.bigdata.rdf.model.BigdataURI in project wikidata-query-rdf by wikimedia.
the class AbstractMultiTypeExtension method resolveDataType.
/**
* Convert the literal into a uri as resolved by the resolve this extension
* received on construction.
*/
@SuppressWarnings("rawtypes")
protected BigdataURI resolveDataType(LiteralExtensionIV literal) {
IV extensionIV = literal.getExtensionIV();
BigdataURI dt = dataTypes.get(extensionIV);
if (dt == null) {
throw new IllegalArgumentException("Unrecognized datatype: " + extensionIV);
}
return dt;
}
use of com.bigdata.rdf.model.BigdataURI in project wikidata-query-rdf by wikimedia.
the class GeoService method getGlobeNode.
/**
* Create globe node with appropriate value for coordSystem.
*/
protected TermNode getGlobeNode(BigdataValueFactory vf, ServiceParams serviceParams) {
final TermNode globeNode = serviceParams.get(GLOBE_PARAM, null);
if (globeNode == null) {
return new DummyConstantNode(vf.createLiteral(WKTSerializer.NO_GLOBE));
}
if (!globeNode.isConstant()) {
// FIXME: add support for this
throw new IllegalArgumentException("Non-constant globe value is not supported yet.");
}
BigdataValue v = globeNode.getValue();
if (v instanceof BigdataURI) {
WKTSerializer ser = new WKTSerializer();
try {
return new DummyConstantNode(vf.createLiteral(ser.trimCoordURI(v.stringValue())));
} catch (GeoSpatialSearchException e) {
// Unexpectedly wrong URI - still pass it along
return globeNode;
}
}
return globeNode;
}
Aggregations