RDF4J beans library

RDF4J library for Java bean serialization.

License

License

GroupId

GroupId

com.github.kburger
ArtifactId

ArtifactId

rdf4j-beans
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

RDF4J beans library
RDF4J library for Java bean serialization.
Project URL

Project URL

https://github.com/kburger/rdf4j-beans/
Source Code Management

Source Code Management

https://github.com/kburger/rdf4j-beans

Download rdf4j-beans

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.kburger/rdf4j-beans/ -->
<dependency>
    <groupId>com.github.kburger</groupId>
    <artifactId>rdf4j-beans</artifactId>
    <version>0.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.kburger/rdf4j-beans/
implementation 'com.github.kburger:rdf4j-beans:0.3.0'
// https://jarcasting.com/artifacts/com.github.kburger/rdf4j-beans/
implementation ("com.github.kburger:rdf4j-beans:0.3.0")
'com.github.kburger:rdf4j-beans:jar:0.3.0'
<dependency org="com.github.kburger" name="rdf4j-beans" rev="0.3.0">
  <artifact name="rdf4j-beans" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.kburger', module='rdf4j-beans', version='0.3.0')
)
libraryDependencies += "com.github.kburger" % "rdf4j-beans" % "0.3.0"
[com.github.kburger/rdf4j-beans "0.3.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.25
org.eclipse.rdf4j : rdf4j-rio-api jar 2.2

test (6)

Group / Artifact Type Version
org.spockframework : spock-core jar 1.1-groovy-2.4-rc-2
org.codehaus.groovy : groovy-all jar 2.4.10
cglib : cglib-nodep jar 3.2.5
org.eclipse.rdf4j : rdf4j-rio-turtle jar 2.2
org.slf4j : slf4j-simple jar 1.7.25
org.slf4j : jcl-over-slf4j jar 1.7.25

Project Modules

There are no modules declared in this project.

rdf4j-beans

Build Status Coverage Status Codacy Badge Maven Central Javadocs

Java beans IO library for RDF4J.

usage

Add the rdf4j-beans dependency in your POM:

<dependency>
    <groupId>com.github.kburger</groupId>
    <artifactId>rdf4j-beans</artifactId>
    <version>0.3.0</version>
</dependency>

Annotate your beans:

@Type("http://example.com/Type")
public class MyBean {
    @Predicate(value = "http://purl.org/dc/terms/title", isLiteral = true)
    private String title;
    
    public MyBean(String title) {
        this.title = title;
    }
    
    public String getTitle() {
        return title;
    }
}

Invoke the mapper:

BeanMapper mapper = new BeanMapper();
mapper.write(new OutputStreamWriter(System.out), new MyBean("example"), "http://example.com/subject", RDFFormat.TURTLE);

Or read from source:

@prefix ex: <http://example.com/> .
@prefix dc: <http://purl.org/dc/terms> .

ex:subject a ex:Type ;
    dc:title "Hello world!" .
MyBean bean = mapper.read(new StringReader(content), MyBean.class, "http://example.com/subject", RDFFormat.TURTLE);
assert bean.getTitle().equals("Hello world!");

changelog

0.3.0

  • Support for inherited properties.

0.2.0

  • Support for bean deserialization.
  • Fix for handling property null values.

0.1.0

  • Initial release.
  • Support for bean serialization.

Versions

Version
0.3.0
0.2.0
0.1.0