use of fr.lirmm.graphik.util.URI in project graal by graphik-team.
the class TermTest method testURI.
@Test
public void testURI() {
URI uri = URIUtils.createURI("http://toto.fr");
Term t1 = DefaultTermFactory.instance().createConstant("http://toto.fr");
Term t2 = DefaultTermFactory.instance().createConstant(uri);
Assert.assertNotEquals(t1, t2);
}
use of fr.lirmm.graphik.util.URI in project graal by graphik-team.
the class RDF4jUtils method valueToTerm.
public Term valueToTerm(Value value) {
if (value instanceof Resource) {
return DefaultTermFactory.instance().createConstant(urizer.output(value.toString()));
} else {
// Literal
org.eclipse.rdf4j.model.Literal l = (org.eclipse.rdf4j.model.Literal) value;
URI uri = URIUtils.createURI(l.getDatatype().toString());
String label = l.getLabel();
if (uri.equals(URIUtils.RDF_LANG_STRING)) {
Optional<String> opt = l.getLanguage();
if (opt.isPresent()) {
label += "@";
label += opt.get();
}
}
return DefaultTermFactory.instance().createLiteral(uri, label);
}
}
use of fr.lirmm.graphik.util.URI in project graal by graphik-team.
the class DlgpParserTest method backslashedDoubleQuoteTest.
// /////////////////////////////////////////////////////////////////////////
// MISCS
// /////////////////////////////////////////////////////////////////////////
@Test
public void backslashedDoubleQuoteTest() throws ParseException {
Atom a = DlgpParser.parseAtom("p(\"test\\\"test\").");
Term identifier = a.getTerm(0);
Assert.assertTrue(identifier instanceof Literal);
URI datatype = ((Literal) identifier).getDatatype();
Assert.assertEquals(URIUtils.XSD_STRING, datatype);
Object value = ((Literal) identifier).getValue();
Assert.assertEquals("test\"test", value);
}
use of fr.lirmm.graphik.util.URI in project graal by graphik-team.
the class GraalUtils method createPredicate.
/**
* @param property
* @return a {@link Predicate} with arity 2 which represents the specified owl object property.
*/
public static Predicate createPredicate(OWLObjectPropertyExpression property) {
Predicate predicate = null;
URI uri = convertIRI(property.asOWLObjectProperty().getIRI());
predicate = new Predicate(uri, 2);
return predicate;
}
use of fr.lirmm.graphik.util.URI in project graal by graphik-team.
the class GraalUtils method createPredicate.
/**
* @param property
* @return a {@link Predicate} with arity 2 which represents the specified owl data property.
*/
public static Predicate createPredicate(OWLDataPropertyExpression property) {
Predicate predicate = null;
URI uri = convertIRI(property.asOWLDataProperty().getIRI());
predicate = new Predicate(uri, 2);
return predicate;
}
Aggregations