Using the sample provided I was able to retrieve the properties, but what I
wanted  is to be able to put values in it.
Here is a sample code:
        MetaStructureClass employee = namespace.getMetaClass( "employee",
true );
        MetaStructureProperty firstName = namespace.getMetaProperty(
"firstName", true );
        firstName.setRange( new DatatypeClassRange( String.class ) );
        MetaStructureProperty lastName = namespace.getMetaProperty(
"lastName", true );
        lastName.setRange( new DatatypeClassRange( String.class ) );
        MetaStructureProperty middleName = namespace.getMetaProperty(
"middleName", true );
        middleName.setRange( new DatatypeClassRange( String.class ) );
        MetaStructureProperty age = namespace.getMetaProperty( "age", true
);
        age.setRange( new DatatypeClassRange( Integer.class ) );
        employee.getDirectProperties().add( firstName );
        employee.getDirectProperties().add( lastName );
        employee.getDirectProperties().add( middleName );
        employee.getDirectProperties().add( age );

My objective is to put/add property values to the ff as in:
firstName = "John";
lastName = "Doe";
middleName = "Smith";
age = 25;

That's what I understand using meta structure, but would that be possible?
If yes can you please show me how?

Thanks.

Jers


On Mon, Aug 3, 2009 at 9:30 PM, Mattias Persson
<[email protected]>wrote:

> Oh ok, you use the same methods for getting the classes and properties
> as for creating them:
> (the true/false 2:nd argument is the "allowCreate" option, so that if
> true then the class/property will be created if it didn't already
> exist).
>
> MetaStructureClass myClass =
>    namespace.getMetaClass( "myClass", false );
> MetaStructureProperty myProperty =
>    namespace.getMetaProperty( "myProperty", false );
> myProperty.setCardinalty( 1 );
>
> for ( MetaStructureProperty propertyAssociatedWithMyClass :
>    myClass.getDirectProperties() )
> {
> }
> ...or...
> for ( MetaStructureProperty propertyAssociatedWithMyClass :
>    myClass.getAllProperties() )
> {
> }
>
>
> At least that's what I think you mean :)
>
> 2009/8/3 Jerry Juanico <[email protected]>:
> > Hi Mattias,
> >
> > With this information I was able to fix my dilemma.Thanks.
> >
> > One more thing. OK I already set-up the schema.
> > Along with it is the expected values, range, data type, etc.
> >
> > But the thing is I cannot access or put values on the properties that I
> have
> > created.
> > I ran out of options, can u give me some hint?
> > Thanks again
> >
> > Jers
> >
> > On Mon, Aug 3, 2009 at 5:39 PM, Mattias Persson
> > <[email protected]>wrote:
> >
> >> Hi,
> >>
> >> I think you'd like to use something like this:
> >>
> >> MetaStructureClass userClass = ...
> >> MetaStructureClass accountClass = ...
> >> MetaStructureProperty userHasAccount =
> >>    namespace.getMetaProperty( "user_has_account", true );
> >> userClass.getDirectProperties().add( userHasAccount );
> >> userHasAccount.setRange(
> >>    new MetaStructureClassRange( accountClass ) );
> >>
> >> Is that what you're looking for?
> >>
> >> 2009/8/3 Jerry Juanico <[email protected]>:
> >> > Hi All,
> >> >
> >> > I am currently working with one of the features of ne04j, which is the
> >> meta
> >> > structure.
> >> > I have tried implementing the test examples and it works fine.
> >> > But the whole concept is still vague to me.
> >> >
> >> > I have noticed that the relationship type is automatic once I invoke
> the
> >> > class and property instance.
> >> >
> >> > I am expecting that it's possible to defined specific relationship
> type
> >> as I
> >> > did in a simple node/relationship/property structure, but I cannot
> find
> >> any
> >> > from the list of  meta structure API.
> >> >
> >> > Can someone tell me how?
> >> >
> >> > Thanks.
> >> >
> >> > Jerry
> >> > _______________________________________________
> >> > Neo mailing list
> >> > [email protected]
> >> > https://lists.neo4j.org/mailman/listinfo/user
> >> >
> >>
> >>
> >>
> >> --
> >> Mattias Persson, [[email protected]]
> >> Neo Technology, www.neotechnology.com
> >> _______________________________________________
> >> Neo mailing list
> >> [email protected]
> >> https://lists.neo4j.org/mailman/listinfo/user
> >>
> > _______________________________________________
> > Neo mailing list
> > [email protected]
> > https://lists.neo4j.org/mailman/listinfo/user
> >
>
>
>
> --
> Mattias Persson, [[email protected]]
> Neo Technology, www.neotechnology.com
> _______________________________________________
> Neo mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to