trustgraph-base 0.16.6__tar.gz → 0.16.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/PKG-INFO +2 -2
  2. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/api/api.py +17 -18
  3. trustgraph-base-0.16.7/trustgraph/base_version.py +1 -0
  4. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/knowledge/__init__.py +1 -0
  5. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/knowledge/defs.py +8 -0
  6. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/knowledge/document.py +11 -1
  7. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/knowledge/organization.py +11 -1
  8. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/knowledge/publication.py +11 -1
  9. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph_base.egg-info/PKG-INFO +2 -2
  10. trustgraph-base-0.16.6/trustgraph/base_version.py +0 -1
  11. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/README.md +0 -0
  12. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/setup.cfg +0 -0
  13. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/setup.py +0 -0
  14. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/api/__init__.py +0 -0
  15. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/base/__init__.py +0 -0
  16. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/base/base_processor.py +0 -0
  17. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/base/consumer.py +0 -0
  18. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/base/consumer_producer.py +0 -0
  19. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/base/producer.py +0 -0
  20. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/__init__.py +0 -0
  21. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/agent_client.py +0 -0
  22. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/base.py +0 -0
  23. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/document_embeddings_client.py +0 -0
  24. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/document_rag_client.py +0 -0
  25. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/embeddings_client.py +0 -0
  26. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/graph_embeddings_client.py +0 -0
  27. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/graph_rag_client.py +0 -0
  28. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/llm_client.py +0 -0
  29. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/prompt_client.py +0 -0
  30. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/clients/triples_query_client.py +0 -0
  31. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/exceptions.py +0 -0
  32. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/knowledge/identifier.py +0 -0
  33. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/log_level.py +0 -0
  34. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/objects/__init__.py +0 -0
  35. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/objects/field.py +0 -0
  36. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/objects/object.py +0 -0
  37. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/rdf.py +0 -0
  38. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/__init__.py +0 -0
  39. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/agent.py +0 -0
  40. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/documents.py +0 -0
  41. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/graph.py +0 -0
  42. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/metadata.py +0 -0
  43. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/models.py +0 -0
  44. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/object.py +0 -0
  45. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/prompt.py +0 -0
  46. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/retrieval.py +0 -0
  47. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/topic.py +0 -0
  48. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph/schema/types.py +0 -0
  49. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph_base.egg-info/SOURCES.txt +0 -0
  50. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph_base.egg-info/dependency_links.txt +0 -0
  51. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph_base.egg-info/requires.txt +0 -0
  52. {trustgraph-base-0.16.6 → trustgraph-base-0.16.7}/trustgraph_base.egg-info/top_level.txt +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trustgraph-base
3
- Version: 0.16.6
3
+ Version: 0.16.7
4
4
  Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
5
5
  Home-page: https://github.com/trustgraph-ai/trustgraph
6
6
  Author: trustgraph.ai
7
7
  Author-email: security@trustgraph.ai
8
8
  License: UNKNOWN
9
- Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.16.6.tar.gz
9
+ Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.16.7.tar.gz
10
10
  Platform: UNKNOWN
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
@@ -4,7 +4,7 @@ import json
4
4
  import dataclasses
5
5
  import base64
6
6
 
7
- from trustgraph.knowledge import hash
7
+ from trustgraph.knowledge import hash, Uri, Literal
8
8
 
9
9
  class ProtocolException(Exception):
10
10
  pass
@@ -12,14 +12,6 @@ class ProtocolException(Exception):
12
12
  class ApplicationException(Exception):
13
13
  pass
14
14
 
15
- class Uri(str):
16
- def is_uri(self): return True
17
- def is_literal(self): return False
18
-
19
- class Literal(str):
20
- def is_uri(self): return False
21
- def is_literal(self): return True
22
-
23
15
  @dataclasses.dataclass
24
16
  class Triple:
25
17
  s : str
@@ -213,9 +205,16 @@ class Api:
213
205
  "limit": limit
214
206
  }
215
207
 
216
- if s: input["s"] = s
217
- if p: input["p"] = p
218
- if o: input["o"] = o
208
+ if not isinstance(s, Uri):
209
+ raise RuntimeError("s must be Uri")
210
+ if not isinstance(p, Uri):
211
+ raise RuntimeError("p must be Uri")
212
+ if not isinstance(o, Uri) and not isinstance(o, Literal):
213
+ raise RuntimeError("o must be Uri or Literal")
214
+
215
+ if s: input["s"] = { "v": str(s), "e": isinstance(s, Uri), }
216
+ if p: input["p"] = { "v": str(p), "e": isinstance(p, Uri), }
217
+ if o: input["o"] = { "v": str(o), "e": isinstance(o, Uri), }
219
218
 
220
219
  url = f"{self.url}triples-query"
221
220
 
@@ -273,9 +272,9 @@ class Api:
273
272
  if metadata:
274
273
  metadata.emit(
275
274
  lambda t: triples.append({
276
- "s": t.s.value,
277
- "p": t.p.value,
278
- "o": t.o.value
275
+ "s": { "v": t["s"], "e": isinstance(t["s"], Uri) },
276
+ "p": { "v": t["p"], "e": isinstance(t["p"], Uri) },
277
+ "o": { "v": t["o"], "e": isinstance(t["o"], Uri) }
279
278
  })
280
279
  )
281
280
 
@@ -312,9 +311,9 @@ class Api:
312
311
  if metadata:
313
312
  metadata.emit(
314
313
  lambda t: triples.append({
315
- "s": t.s.value,
316
- "p": t.p.value,
317
- "o": t.o.value
314
+ "s": { "v": t["s"], "e": isinstance(t["s"], Uri) },
315
+ "p": { "v": t["p"], "e": isinstance(t["p"], Uri) },
316
+ "o": { "v": t["o"], "e": isinstance(t["o"], Uri) }
318
317
  })
319
318
  )
320
319
 
@@ -0,0 +1 @@
1
+ __version__ = "0.16.7"
@@ -1,4 +1,5 @@
1
1
 
2
+ from . defs import *
2
3
  from . identifier import *
3
4
  from . publication import *
4
5
  from . document import *
@@ -23,3 +23,11 @@ URL = 'https://schema.org/url'
23
23
  IDENTIFIER = 'https://schema.org/identifier'
24
24
  KEYWORD = 'https://schema.org/keywords'
25
25
 
26
+ class Uri(str):
27
+ def is_uri(self): return True
28
+ def is_literal(self): return False
29
+
30
+ class Literal(str):
31
+ def is_uri(self): return False
32
+ def is_literal(self): return True
33
+
@@ -1,6 +1,16 @@
1
1
 
2
2
  from . defs import *
3
- from .. schema import Triple, Value
3
+
4
+ def Value(value, is_uri):
5
+ if is_uri:
6
+ return Uri(value)
7
+ else:
8
+ return Literal(value)
9
+
10
+ def Triple(s, p, o):
11
+ return {
12
+ "s": s, "p": p, "o": o,
13
+ }
4
14
 
5
15
  class DigitalDocument:
6
16
 
@@ -1,6 +1,16 @@
1
1
 
2
2
  from . defs import *
3
- from .. schema import Triple, Value
3
+
4
+ def Value(value, is_uri):
5
+ if is_uri:
6
+ return Uri(value)
7
+ else:
8
+ return Literal(value)
9
+
10
+ def Triple(s, p, o):
11
+ return {
12
+ "s": s, "p": p, "o": o,
13
+ }
4
14
 
5
15
  class Organization:
6
16
  def __init__(self, id, name=None, description=None):
@@ -1,6 +1,16 @@
1
1
 
2
2
  from . defs import *
3
- from .. schema import Triple, Value
3
+
4
+ def Value(value, is_uri):
5
+ if is_uri:
6
+ return Uri(value)
7
+ else:
8
+ return Literal(value)
9
+
10
+ def Triple(s, p, o):
11
+ return {
12
+ "s": s, "p": p, "o": o,
13
+ }
4
14
 
5
15
  class PublicationEvent:
6
16
  def __init__(
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trustgraph-base
3
- Version: 0.16.6
3
+ Version: 0.16.7
4
4
  Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
5
5
  Home-page: https://github.com/trustgraph-ai/trustgraph
6
6
  Author: trustgraph.ai
7
7
  Author-email: security@trustgraph.ai
8
8
  License: UNKNOWN
9
- Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.16.6.tar.gz
9
+ Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.16.7.tar.gz
10
10
  Platform: UNKNOWN
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
@@ -1 +0,0 @@
1
- __version__ = "0.16.6"