Coder Social home page Coder Social logo

rdf4j-schema-generator's Introduction

RDF4J Schema Generator

Build Status Coverage Status

RDF4J Schema Generator provides a command line tool and maven plugin that allows to create constants for RDF primitives for a given namespace from RDF ontology files.

How To

  1. Clone from https://github.com/ansell/rdf4j-schema-generator.git
  2. Run ./rdf4j-schema-generator <input-file> <output-file>
  3. Additional information can be configured using command-line parameters

Command Line Options

  <input-file>                            the input file to read from
  [<output-file>]                         the output file to write, StdOut if
                                          omitted
  -b,--languageBundles                    generate L10N LanguageBundles
  -c,--constantCase <constantCase>        case to use for URI constants,
                                          possible values: LOWER_UNDERSCORE,
                                          LOWER_CAMEL, UPPER_CAMEL,
                                          UPPER_UNDERSCORE
  -C,--stringConstantCase <constantCase>  case to use for String constants, see
                                          constantCase
  -f,--format <input-format>              mime-type of the input file (will try
                                          to guess if absent)
  -h,--help                               print this help
  -l,--language <prefLang>                preferred language for schema
                                          labels
  -n,--name <ns>                          the name of the namespace (will try to
                                          guess from the input file if absent)
  -P,--stringConstantPrefix <prefix>      prefix to create string constants
                                          (e.g. _)
  -p,--package <package>                  package declaration (will use default
                                          (empty) package if absent)
  -s,--spaces <indent>                    use spaces for indentation (tabs if
                                          missing, 4 spaces if no number given)
  -S,--stringConstantSuffix <suffix>      suffix to create string constants
                                          (e.g. _STRING)
  -u,--uri <prefix>                       the prefix for the schema (if not
                                          available in the input file)

Run from Git

Maven Plugin

<build>
    <plugins>
        <plugin>
            <groupId>com.github.ansell.rdf4j-schema-generator</groupId>
            <artifactId>schema-generator-maven-plugin</artifactId>
            <version>0.4.2</version>
            <executions>
                <execution>
                    <id>generate-schemas</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <output>${project.build.directory}/generated-sources/rdf4j-schemas</output>
                <packageName>com.example.rdf4j.schemas</packageName>
                <mimeType>text/turtle</mimeType>
                <preferredLanguage>en</preferredLanguage>
                <createResourceBundles>true</createResourceBundles>
                <constantCase>UPPER_UNDERSCORE</constantCase>
                <createStringConstants>true</createStringConstants>
                <stringConstantCase>UPPER_UNDERSCORE</stringConstantCase>
                <stringConstantPrefix>_</stringConstantPrefix>
                <stringConstantSuffix>_STRING</stringConstantSuffix>
                <schemas>
                    <schema>
                        <className>LDP</className>
                        <prefix>http://www.w3.org/ns/ldp#</prefix>
                        <file>core/src/test/resources/ldp.ttl</file>
                    </schema>
                    <schema>
                        <className>RDF</className>
                        <url>http://www.w3.org/1999/02/22-rdf-syntax-ns</url>
                    </schema>
                </schemas>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>com.github.ansell.rdf4j-schema-generator</groupId>
        <artifactId>schema-generator</artifactId>
        <version>0.4.2</version>
    </dependency>
</dependencies>

Changelog

2018-11-03

  • Release 0.4.2
  • Upgrade to RDF4J-2.4.1

2017-05-25

  • Release 0.4
  • Update dependency versions

2017-04-03

  • Release 0.3
  • Add schema auto-discovery

2017-02-28

  • Release 0.2
  • Support local name string constants that are widely used
  • Support rendering templates using Freemarker for extensibility and maintenance

2017-02-24

  • Release 0.1

2017-02-23

  • Rebranded to rdf4j-schema-generator
  • Converted to use RDF4J
  • Version dropped to 0.1-SNAPSHOT for active development

rdf4j-schema-generator's People

Contributors

ansell avatar dglachs avatar ja-fra avatar kissen avatar tkurz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

kissen

rdf4j-schema-generator's Issues

fields defined twice when using maven plugin

When using the maven plugin I get a
Could not generate schema BibframeVocab: field BibframeVocab.ACQUISITION_SOURCE_STRING is defined twice

<schema> <className>BibframeVocab</className> <url>http://id.loc.gov/ontologies/bibframe.rdf</url> </schema>

no exception is thrown when using the command line:
./rdf4j-schema-generator -f Application/rdf+xml bibframe.rdf -name BibframeVocab > BibframVocab.java

adding <mimeType>Application/rdf+xml</mimeType> yields to Date value may not be null

I have no idea what could be wrong.

Thanx

Support templates

It would be useful to abstract out the various rendering parts into one of more templates.

Add schema auto-discovery support

Add schema auto-discovery support through the optional generation of META-INF/services files pointing to generated vocabulary classes.

Whether or not they are useful depends on whether the template supports it, so a new non-static template should be created as an example of how schemas should be automatically discovered, along with a registry that can load instances of the schemas created.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.