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: Optional[linkml_runtime.utils.schemaview.SchemaView] = None, format: Optional[str] = None, metadata: bool = True, useuris: Optional[bool] = None, log_level: Optional[int] = 30, mergeimports: Optional[bool] = True, source_file_date: Optional[str] = None, source_file_size: Optional[int] = None, logger: Optional[logging.Logger] = None, verbose: Optional[bool] = None, output: Optional[str] = None, namespaces: Optional[linkml_runtime.utils.namespaces.Namespaces] = None, directory_output: bool = False, base_dir: str = None, metamodel_name_map: Dict[str, str] = None, importmap: Union[str, Mapping[str, str], NoneType] = None, emit_prefixes: Set[str] = <factory>, metamodel: linkml.utils.schemaloader.SchemaLoader = None, stacktrace: bool = False, include: Union[str, pathlib.Path, linkml_runtime.linkml_model.meta.SchemaDefinition, NoneType] = None, emit_metadata: bool = False, context: List[str] = None, original_schema: linkml_runtime.linkml_model.meta.SchemaDefinition = None, **_kwargs)[source]#
context: List[str] = None#
emit_metadata: bool = False#
end_schema(output: str | None = None, context: str | None = 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