GetPropertiesByIterator

Returns a handle to a property.
If input property is zero, the handle will point to the first relevant property.
If all properties are past (or no relevant properties are found), the function will return 0.

Syntax

public const string enginedll = @"engine.dll";

[DllImport(enginedll, EntryPoint = "GetPropertiesByIterator")]
public static extern Int64 GetPropertiesByIterator(Int64 model, Int64 rdfProperty);    

Property model

Size: 64 bit / 8 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

Property rdfProperty

Size: 64 bit / 8 byte (value)
This attribute represents a handle to the property, this can be either a datatype property (attribute), an object property (relation) or non-defined property. The handle will be static during the life-time of the model, when the model (or part of it) is saved and opened again, the handle will most probably be different.

Example (based on pure API calls)

Here you can find code snippits that show how the API call GetPropertiesByIterator can be used.

using RDF;      //  include at least engine.cs within your solution

public Int64 GetPropertyCnt(Int64 model)
{
    Int64   propertyCnt = 0,
            myIteratedProperty = RDF.engine.GetPropertiesByIterator(model, 0);
    while (myIteratedProperty != 0)
    {
        IntPtr    propertyNamePtr = IntPtr.Zero;
        RDF.engine.GetNameOfProperty(myIteratedProperty, out propertyNamePtr);
        string propertyName = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(propertyNamePtr);
        Console.WriteLine(propertyName);
        myIteratedProperty = RDF.engine.GetPropertiesByIterator(model, myIteratedProperty);
        propertyCnt++;
    }
    Console.WriteLine();

    return  propertyCnt;
}

public void Example()
{
    Int64 model = RDF.engine.CreateModel();

    if (model != 0)
    {
        Int64   propertyCnt = GetPropertyCnt(model);

        //
        //  Add a new property
        //
        RDF.engine.CreateProperty(model, 0, "CreatedPropertyToTestPropertyCnt");

        System.Diagnostics.Debug.Assert(GetPropertyCnt(model) == propertyCnt + 1);

        Int64   propertyCntThroughAPI = 0;
        RDF.engine.OrderedHandles(model, (IntPtr) null, out propertyCntThroughAPI, (IntPtr) null, 0, 0);

        System.Diagnostics.Debug.Assert(GetPropertyCnt(model) == propertyCntThroughAPI);

        RDF.engine.CloseModel(model);
    }
}