RDF

YAML Schema to RDF Generator

Generate a JSON LD representation of the model

class linkml.generators.rdfgen.RDFGenerator(schema: Union[str, TextIO, linkml_runtime.linkml_model.meta.SchemaDefinition, ForwardRef('Generator'), pathlib.Path], schemaview: linkml_runtime.utils.schemaview.SchemaView | None = None, format: str | None = None, metadata: bool = True, useuris: bool | None = None, log_level: int | None = 30, mergeimports: bool | None = True, source_file_date: str | None = None, source_file_size: int | None = None, logger: logging.Logger | None = None, verbose: bool | None = None, output: str | None = None, namespaces: linkml_runtime.utils.namespaces.Namespaces | None = None, directory_output: bool = False, base_dir: str = None, metamodel_name_map: dict[str, str] = None, importmap: str | collections.abc.Mapping[str, str] | None = None, emit_prefixes: set[str] = <factory>, metamodel: linkml.utils.schemaloader.SchemaLoader = None, stacktrace: bool = False, include: str | pathlib.Path | linkml_runtime.linkml_model.meta.SchemaDefinition | None = None, emit_metadata: bool = False, context: list[str] = None, original_schema: linkml_runtime.linkml_model.meta.SchemaDefinition = None)[source]
context: list[str] = None
emit_metadata: bool = False
end_schema(output: str | None = None, context: str = None, **_) str[source]

Visited once at the end of generation

@param kwargs: Arguments passed through from CLI – implementation dependent

generatorname: ClassVar[str] = 'rdfgen.py'

Name of the generator. Override with os.path.basename(__file__)

generatorversion: ClassVar[str] = '0.1.1'

Version of the generator. Consider deprecating and instead use overall linkml version

original_schema: SchemaDefinition = None

//github.com/linkml/linkml/issues/871

Type:

See https

uses_schemaloader: ClassVar[bool] = True

Old-style generator that uses the SchemaLoader and visitor pattern

valid_formats: ClassVar[list[str]] = ['ttl', 'hext', 'json-ld', 'n3', 'nquads', 'nt', 'nt11', 'ntriples', 'patch', 'trig', 'trix', 'ttl', 'turtle', 'xml']

Allowed formats - first format is default

visit_all_class_slots: ClassVar[bool] = False

False means only visit own slots, True means visit all slots

Type:

Visitor ClassVar

CLI

gen-rdf

Generate an RDF representation of a LinkML model

gen-rdf [OPTIONS] YAMLFILE

Options

-o, --output <output>

Output file name

--context <context>

JSONLD context file (default: https://w3id.org/linkml/meta.context.jsonld)

Default:

'https://w3id.org/linkml/meta.context.jsonld'

-V, --version

Show the version and exit.

-f, --format <format>

Output format

Default:

'ttl'

Options:

ttl | hext | json-ld | n3 | nquads | nt | nt11 | ntriples | patch | trig | trix | ttl | turtle | xml

--metadata, --no-metadata

Include metadata in output

Default:

True

--useuris, --metauris

Use class and slot URIs over model uris

Default:

True

-im, --importmap <importmap>

Import mapping file

--log_level <log_level>

Logging level

Default:

'WARNING'

Options:

CRITICAL | ERROR | WARNING | INFO | DEBUG

-v, --verbose

Verbosity. Takes precedence over –log_level.

--mergeimports, --no-mergeimports

Merge imports into source file (default=mergeimports)

--stacktrace, --no-stacktrace

Print a stack trace when an error occurs

Default:

False

Arguments

YAMLFILE

Required argument