Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
git clone https://github.com/rdfa/librdfa

And install the library (make sure to have all the libraries that librdfa uses).

Code Block
languagebash
./autogen.sh
./configure
make
make install

Building from source

In order to compile librdfa-rdf4j, change into the source directory and execute install using maven.

Code Block
mvn clean install

Install

You can install libdrfa-rdf4j adding the following maven dependency (make sure to have installed the the librdfa library):

Code Block
languagejava
<dependency>
   <groupId>org.apache.any23</groupId>
   <artifactId>apache-any23-librdfa</artifactId>
   <version>${librdfa.rdf4j.version}</version>
</dependency>

Use

Once you have installed librdfa-rdf4j, you can use the parser with the Rio API. For example:

Code Block
languagejava
RDFParser rdfParser = Rio.createParser(RDFFormat.RDFA);
Model model = new LinkedHashModel();
rdfParser.setRDFHandler(new StatementCollector(model));
rdfParser.parse(in, "http://www.example.org./");


librdfa extractor

Any23 uses by default Semargl with the standard RDFa 1.1. However, you can change it setting the property any23.extraction.rdfa.programmatic to off to use Semargl with the standard RDFa 1.0. And in order to use librdfa extractor you just need to set the property any23.extraction.rdfa.librdfa. If the librdfa property is set, it will override the Semargl property without regard the value that is set. By default the librdfa property is off. After, you change the extractor you can use Any23 as usual. 

Info

Remember to install librdfa library to use the librdfa extractor.

In order to change the property,  you can set the ANY23_OPTS environmental variable or setting the property in the Configuration class. Check the official documentation for more details.