This section describes the remaining predicates of the
library(semweb/rdf_db)
module.
- rdf_bnode(-Id)
- Generate a unique anonymous identifier for a subject.
- [nondet]rdf_source_location(+Subject,
-Location)
- True when triples for Subject are loaded from Location.
Location | is a term File:Line. |
- [det]rdf_generation(-Generation)
- True when Generation is the current generation of the
database. Each modification to the database increments the generation.
It can be used to check the validity of cached results deduced from the
database. Committing a non-empty transaction increments the generation
by one.
When inside a transaction, Generation is unified to a term
TransactionStartGen + InsideTransactionGen. E.g., 4+3
means that the transaction was started at generation 4 of the global
database and we have created 3 new generations inside the transaction.
Note that this choice of representation allows for comparing generations
using Prolog arithmetic. Comparing a generation in one transaction with
a generation in another transaction is meaningless.
- rdf_estimate_complexity(?Subject,
?Predicate, ?Object, -Complexity)
- Return the number of alternatives as indicated by the database internal
hashed indexing. This is a rough measure for the number of alternatives
we can expect for an rdf_has/3
call using the given three arguments. When called with three variables,
the total number of triples is returned. This estimate is used in query
optimisation. See also rdf_predicate_property/2
and
rdf_statistics/1 for
additional information to help optimizers.
- [nondet]rdf_statistics(?KeyValue)
- Obtain statistics on the RDF database. Defined statistics are:
- graphs(-Count)
- Number of named graphs.
- triples(-Count)
- Total number of triples in the database. This is the number of asserted
triples minus the number of retracted ones. The number of visible
triples in a particular context may be different due to visibility rules
defined by the logical update view and transaction isolation.
- resources(-Count)
- Number of resources that appear as subject or object in a triple. See rdf_resource/1.
- properties(-Count)
- Number of current predicates. See rdf_current_predicate/1.
- literals(-Count)
- Number of current literals. See rdf_current_literal/1.
- gc(GCCount, ReclaimedTriples,
ReindexedTriples, Time)
- Information about the garbage collector.
- searched_nodes(-Count)
- Number of nodes expanded by rdf_reachable/3
and
rdf_reachable/5.
- lookup(rdf(S,P,O,G), Count)
- Number of queries that have been performed for this particular
instantiation pattern. Each of S,P,O,G
is either + or -. Fails in case the number of performed queries is zero.
- hash_quality(rdf(S,P,O,G), Buckets, Quality,
PendingResize)
- Statistics on the index for this pattern. Indices are created lazily on
the first relevant query.
- triples_by_graph(Graph, Count)
- This statistics is produced for each named graph. See
triples
for the interpretation of this value.
- [semidet]rdf_match_label(+How,
+Pattern, +Label)
- True if Label matches Pattern according to How. How
is one of
icase
, substring
, word
, prefix
or like
. For backward compatibility, exact
is
a synonym for icase
.
- [semidet]lang_matches(+Lang,
+Pattern)
- True if Lang matches Pattern. This implements XML
language matching conform RFC 4647. Both Lang and Pattern
are dash-separated strings of identifiers or (for Pattern)
the wildcard *. Identifiers are matched case-insensitive and a * matches
any number of identifiers. A short pattern is the same as *.
- [semidet]lang_equal(+Lang1,
+Lang2)
- True if two RFC language specifiers denote the same language
- See also
- lang_matches/2.
- rdf_reset_db
- Remove all triples from the RDF database and reset all its statistics.
- bug
- This predicate checks for active queries, but this check is not properly
synchronized and therefore the use of this predicate is unsafe in
multi-threaded contexts. It is mainly used to run functionality tests
that need to start with an empty database.
- [det]rdf_version(-Version)
- True when Version is the numerical version-id of this
library. The version is computed as
Major*10000 + Minor*100 + Patch.