question about adding namespaces
- Dominant language
- Rust
- Stars
- 289
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
Dear developers, I have been exploring the usage of this tool in my data transformation pipeline. If find it to be quite useful in forming RDF documents. However, I am not sure on how to specify the namespace of my graphs I produce. For example:
```datalog
clusterA(a, p1) .
clusterA(a, p2) .
clusterA(a, p3) .
clusterA(a, p4) .
clusterA(a, p0) .
clusterA(b, p100) .
clusterA(b, p101) .
clusterB(A, p0) .
clusterB(A, p1) .
clusterB(B, p2) .
clusterB(B, p100) .
% cluster(?name, ?proteins)
@prefix up: .
@prefix base: .
@prefix xsd: .
@prefix rdf: .
cluster1(IRI(?X), IRI(?y)) :- clusterB(?X, ?y).
cluster2(IRI(?X), IRI(?y)) :- clusterA(?X, ?y) .
% When a Cluster in set X is connected to a Cluster in set Y.
isConnected(?clusterNameX, ?p, ?clusterNameY) :-
cluster1(?clusterNameX, ?p) , % it must be in X
cluster2(?clusterNameY, ?p) . % it must be in Y.
% When a cluster X has a connection to Y.
hasOutConnection(?X, ?Y) :-
isConnected(?X, ?p, ?Y) .
% When a cluster X has n connections to Y.
hasOutConnectionCount(?X, ?Y, #count(?p)) :-
isConnected(?X, ?p, ?Y) .
% When a cluster X has n connections to Y.
hasTotalConnections(?X, #sum(?count, ?p)) :-
hasOutConnectionCount(?X, ?p, ?count) .
hasWeightedConnection(?X, ?Y, ?w) :-
hasOutConnectionCount(?X, ?Y, ?count) ,
hasTotalConnections(?X, ?total),
?w = ?count / double(?total).
hasConnection(?X, ?Y) :-
hasOutConnection(?X, ?Y),
hasOutConnection(?Y, ?X) .
% Exporting our analysis to RDF
cluster(?X, ?p, clusterA) :-
cluster1(?X, ?p) .
cluster(?X, ?p, clusterB) :-
cluster2(?X, ?p) .
up:Protein(?X, ?p, ?T) :-
cluster(?X, ?p, ?T) ,
?p = concat("-", str(?p)) .
graph(?X, base:hasMember, ?p) :-
cluster(?X, ?p, ?T).
graph(?p, base:memberOf, ?X) :-
cluster(?X, ?p, ?T).
graph(?X, base:cluster, ?T) :-
cluster(?X, ?p, ?T).
graph(?p, rdf:type, up:Protein) :-
up:Protein(?X, ?p, ?T).
graph(?X, base:connectsTo, ?Y) :-
hasOutConnection(?X, ?Y) .
graph(?X, base:connectsTo, ?Y) :-
hasOutConnection(?Y, ?X) .
graph(?key, rdf:type, rdf:Statement),
graph(?key, rdf:predicate, base:hasOutConnection),
graph(?key, rdf:object, ?Y),
graph(?key, rdf:value, double(?w)),
graph(?key, rdf:subject, ?X),:-
hasOutConnection(?X, ?Y) ,
hasWeightedConnection(?X, ?Y, ?w),
?key = f"http://example.com/clustering/{?Y}-{?Y}",
?key = uri(?key).
@export graph :- rdf{resource="rdf.ttl"}.
@export hasTotalConnections :-
csv{resource="connectivity.csv"} .
@export hasWeightedConnection :-
csv{resource="hasWeightedConnection.csv",
format=(any,any,double)} .
```
Then I get the error that complex terms are not supported. Is there a better way to do this? I am sure its possible but I cannot find it in the documentation.
Contributor guide
Research direction
The issue names no source files or tests; start by reproducing the reported “complex terms are not supported” error with the supplied Datalog and RDF export example. Trace how namespace declarations and RDF exports are handled, and make the supported way to produce namespaced graphs clear and verifiable.
Written by the indexing model from the issue text.
Assessment
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100