SWI-Prolog Semantic Web Library 3.0
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog Semantic Web Library 3.0
        • Introduction
        • Scalability
        • Two RDF APIs
        • Plugin modules for rdf_db
        • library(semweb/turtle): Turtle: Terse RDF Triple Language
        • library(semweb/rdf_ntriples): Process files in the RDF N-Triples format
        • library(semweb/rdfa): Extract RDF from an HTML or XML DOM
        • library(semweb/rdfs): RDFS related queries
        • Managing RDF input files
        • library(semweb/sparql_client): SPARQL client library
        • library(semweb/rdf_compare): Compare RDF graphs
        • library(semweb/rdf_portray): Portray RDF resources
          • rdf_portray_as/1
          • rdf_portray_lang/1
        • Related packages
        • Version 3 release notes

12 library(semweb/rdf_portray): Portray RDF resources

To be done
- Define alternate predicate to use for providing a comment
- Use rdf:type if there is no meaningful label?
- Smarter guess whether or not the local identifier might be meaningful to the user without a comment. I.e. does it look‘word-like'?

This module defines rules for user:portray/1 to help tracing and debugging RDF resources by printing them in a more concise representation and optionally adding comment from the label field to help the user interpreting the URL. The main predicates are:

  • rdf_portray_as/1 defines the overall style
  • rdf_portray_lang/1 selects languages for extracting label comments
[det]rdf_portray_as(+Style)
Set the style used to portray resources. Style is one of:
prefix:id
Write as NS:ID, compatible with what can be handed to the rdf predicates. This is the default.
writeq
Use quoted write of the full resource.
prefix:label
Write namespace followed by the label. This format cannot be handed to rdf/3 and friends, but can be useful if resource-names are meaningless identifiers.
prefix:id=label
This combines prefix:id with prefix:label, providing both human readable output and output that can be pasted into the commandline.
[det]rdf_portray_lang(+Lang)
If Lang is a list, set the list or preferred languages. If it is a single atom, push this language as the most preferred language.