Nested Triples

27 views
Skip to first unread message

jes...@arte-consultores.com

unread,
Sep 2, 2019, 7:35:49 AM9/2/19
to rdflib-dev
Hi, i have a problem.

I'm new with this RDFLIB on Python and i want to make and nested structure, but i can't figure how to and what I'm doing wrong.

Help please :D

Thank you all :D

I'm traying to create this:

<dct:accrualPeriodicity>
<dct:Frequency>
<rdf:value>
<time:DurationDescription>
<rdfs:label>Daily</rdfs:label>
<time:days rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal">1</time:days>
</time:DurationDescription>
</rdf:value>
</dct:Frequency>
</dct:accrualPeriodicity>


but with this code i made i got this:

<dct:accrualPeriodicity>
<dct:Frequency rdf:nodeID="N2a442c84e6cd4ce6809cb50e4abac611">
<rdf:value>
<rdf:value rdf:nodeID="Nf6cc7775cfbd4ec0960ff0d13036ad9a">
<time1:DurationDescription>
<time1:DurationDescription rdf:nodeID="Ncc7a5147a77a4e9a9b2d0fca8581df2d">
<rdfs:label>Daily</rdfs:label>
<time1:days rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1</time1:days>
</time1:DurationDescription>
</time1:DurationDescription>
</rdf:value>
</rdf:value>
</dct:Frequency>
</dct:accrualPeriodicity>


This is the part of the code:


if frequency is not None:
frequency_details = BNode()
value_node = BNode()
duration_desc_node = BNode()

# AccrualPeriodicity
g.add((dataset_ref, DCT.accrualPeriodicity, frequency_details))
# Frequency
g.add((frequency_details, RDF.type, DCT.Frequency))

# Value
g.add((value_node, RDF.type, RDF.value))
g.add((frequency_details, RDF.value, value_node))

# DurationDescription Label and Time:X
g.add((value_node, TIME.DurationDescription, duration_desc_node))
g.add((duration_desc_node, RDF.type, TIME.DurationDescription))
g.add((duration_desc_node, RDFS.label, Literal(frequency)))
g.add((duration_desc_node, TIME.days, Literal(1)))

jes...@arte-consultores.com

unread,
Sep 2, 2019, 9:33:34 AM9/2/19
to rdflib-dev
Just deleted the value_node BNode and it worked
Reply all
Reply to author
Forward
0 new messages