Skip to content

Instantly share code, notes, and snippets.

@afs
Created May 11, 2023 10:03
Show Gist options
  • Save afs/784a757fea4bf10d984e5985da148593 to your computer and use it in GitHub Desktop.
Save afs/784a757fea4bf10d984e5985da148593 to your computer and use it in GitHub Desktop.
public static void main(String...args) {
Model model = ModelFactory.createDefaultModel();
Resource subject1 = ResourceFactory.createResource("http://example/s1");
Resource subject2 = ResourceFactory.createResource("http://example/s2");
Property property = ResourceFactory.createProperty("http://example/p");
Long longValue = 6L;
model.addLiteral(subject1, property, ResourceFactory.createTypedLiteral(longValue.toString(), XSDDatatype.XSDlong));
model.addLiteral(subject2, property, longValue);
RDFWriter.source(model).lang(Lang.TTL).output(System.out);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment