Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using same property for linking a subject to objects of different types #304

Open
helkri opened this issue Apr 1, 2019 · 0 comments
Open

Comments

@helkri
Copy link

helkri commented Apr 1, 2019

Hi, Thank you for BrightstarDB!
I am trying to use the entity framework but I have trouble creating a certain type of connections (see image). My guess is that I am doing something wrong with the interface of the entity.
Do you have an idea?

linking

Interfaces:

    [Entity("ge:LocationDescription")]
    public interface ILocation
    {
        [Identifier("ge:Locations/")]
        string Id { get; }

        [PropertyType("af-x:hasfacet")] 
        IIdentifier LocationIdentifier { get; set; }

        [PropertyType("af-x:hasfacet")] 
        IWrittenName Name { get; set; }
    }
    
    [Entity("af-r:identifier")]
    public interface IIdentifier
    {
        [Identifier("geid:Identifiers/")]
        string Id { get; }

        [PropertyType("af-x:hasvalue")]
        string Value { get; set; }
    }

    [Entity("iao:writtenname")]
    public interface IWrittenName
    {
        [Identifier("geid:Names/")]
        string Id { get; }

        [PropertyType("af-x:hasvalue")] 
        string Value { get; set; }
    }

Instantiation:

var location = databaseContext.Locations.Create();
var identifier = databaseContext.Identifiers.Create();
var writtenName = databaseContext.WrittenNames.Create();
identifier.Value = "E2-07";
writtenName.Value = "Lab 23";
location.LocationIdentifier = identifier;
location.Name = writtenName;
databaseContext.SaveChanges();

Resulting triples:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant