Is it possible to find out the parent containers of an element?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to find out the parent containers of an element?

Manuel Reimer-3
Hello,

it's easy to find out which elements are in an container (GetElements),
but I need the opposite of that. I have an RDF file which looks like this:

parent1
|-sub2
| '-element1
'-element2

parent2
|-element3
'-element1

parent3
|-element4
'-sub3
   '-element1

Now I need a way to find out which containers are parent for, for
example "element1", where the parents would be "sub2", "parent2" and
"sub3". If this would help: It would be no problem to place a parent
over "parent1", "parent2" and "parent3", even if I wouldn't need that
for the functionality in my program.

Thank you very much in advance

Manuel Reimer
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to find out the parent containers of an element?

Axel Hecht
Manuel Reimer wrote:

> Hello,
>
> it's easy to find out which elements are in an container (GetElements),
> but I need the opposite of that. I have an RDF file which looks like this:
>
> parent1
> |-sub2
> | '-element1
> '-element2
>
> parent2
> |-element3
> '-element1
>
> parent3
> |-element4
> '-sub3
>   '-element1
>
> Now I need a way to find out which containers are parent for, for
> example "element1", where the parents would be "sub2", "parent2" and
> "sub3". If this would help: It would be no problem to place a parent
> over "parent1", "parent2" and "parent3", even if I wouldn't need that
> for the functionality in my program.
>
> Thank you very much in advance
>
> Manuel Reimer

Go over ArcLabelsIn and use nsIRDFContainerUtils::IsOrdinalProperty to
check if they're container arcs. Then use GetSources for each ordinal
property.

Axel
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to find out the parent containers of an element?

Neil-4
Axel Hecht wrote:

> Manuel Reimer wrote:
>
>> it's easy to find out which elements are in an container
>> (GetElements), but I need the opposite of that. I have an RDF file
>> which looks like this:
>>
>> parent1
>> |-sub2
>> | '-element1
>> '-element2
>>
>> parent2
>> |-element3
>> '-element1
>>
>> parent3
>> |-element4
>> '-sub3
>>   '-element1
>
> Go over ArcLabelsIn and use nsIRDFContainerUtils::IsOrdinalProperty to
> check if they're container arcs. Then use GetSources for each ordinal
> property.

Although you might be able to assume that container arcs only link
containers thus saving you a step.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf