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
          • rdf_equal_graphs/3
        • library(semweb/rdf_portray): Portray RDF resources
        • Related packages
        • Version 3 release notes

11 library(semweb/rdf_compare): Compare RDF graphs

This library provides predicates that compare RDF graphs. The current version only provides one predicate: rdf_equal_graphs/3 verifies that two graphs are identical after proper labeling of the blank nodes.

Future versions of this library may contain more advanced operations, such as diffing two graphs.

[semidet]rdf_equal_graphs(+GraphA, +GraphB, -Substition)
True if GraphA and GraphB are the same under Substition. Substition is a list of BNodeA = BNodeB, where BNodeA is a blank node that appears in GraphA and BNodeB is a blank node that appears in GraphB.
GraphA is a list of rdf(S,P,O) terms
GraphB is a list of rdf(S,P,O) terms
Substition is a list if NodeA = NodeB terms.
To be done
The current implementation is rather naive. After dealing with the subgraphs that contain no bnodes, it performs a fully non-deterministic substitution.